Skip to content

Commit 146e5e0

Browse files
committed
added test programs for MSGPACK-42
1 parent 6e99f9d commit 146e5e0

13 files changed

Lines changed: 1263 additions & 0 deletions
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package org.msgpack.annotation;
2+
3+
import java.io.ByteArrayOutputStream;
4+
5+
import org.junit.Test;
6+
import org.msgpack.MessagePack;
7+
8+
9+
public class TestOptionalBufferPackBufferUnpack {
10+
11+
@org.junit.Ignore
12+
public static class TestMessagePack extends TestSetOptional {
13+
public void testOptional0101() throws Exception {
14+
super.testOptional0101();
15+
}
16+
17+
public MyMessage01 testOptional0101(MyMessage01 src) throws Exception {
18+
MessagePack msgpack = new MessagePack();
19+
ByteArrayOutputStream out = new ByteArrayOutputStream();
20+
msgpack.write(out, src);
21+
byte[] bytes = out.toByteArray();
22+
return msgpack.read(bytes, MyMessage01.class);
23+
}
24+
25+
public void testOptional0102() throws Exception {
26+
super.testOptional0102();
27+
}
28+
29+
public MyMessage02 testOptional0102(MyMessage01 src) throws Exception {
30+
MessagePack msgpack = new MessagePack();
31+
ByteArrayOutputStream out = new ByteArrayOutputStream();
32+
msgpack.write(out, src);
33+
byte[] bytes = out.toByteArray();
34+
return msgpack.read(bytes, MyMessage02.class);
35+
}
36+
37+
public void testOptional0103() throws Exception {
38+
super.testOptional0103();
39+
}
40+
41+
public MyMessage03 testOptional0103(MyMessage01 src) throws Exception {
42+
MessagePack msgpack = new MessagePack();
43+
ByteArrayOutputStream out = new ByteArrayOutputStream();
44+
msgpack.write(out, src);
45+
byte[] bytes = out.toByteArray();
46+
return msgpack.read(bytes, MyMessage03.class);
47+
}
48+
49+
public void testOptional0203() throws Exception {
50+
super.testOptional0203();
51+
}
52+
53+
public MyMessage03 testOptional0202(MyMessage02 src) throws Exception {
54+
MessagePack msgpack = new MessagePack();
55+
ByteArrayOutputStream out = new ByteArrayOutputStream();
56+
msgpack.write(out, src);
57+
byte[] bytes = out.toByteArray();
58+
return msgpack.read(bytes, MyMessage03.class);
59+
}
60+
}
61+
62+
@Test
63+
public void test0101() throws Exception {
64+
new TestMessagePack().testOptional0101();
65+
}
66+
@Test
67+
public void test0102() throws Exception {
68+
new TestMessagePack().testOptional0102();
69+
}
70+
@Test
71+
public void test0103() throws Exception {
72+
new TestMessagePack().testOptional0103();
73+
}
74+
@Test
75+
public void test0203() throws Exception {
76+
new TestMessagePack().testOptional0203();
77+
}
78+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package org.msgpack.annotation;
2+
3+
import java.io.ByteArrayInputStream;
4+
5+
import org.junit.Test;
6+
import org.msgpack.MessagePack;
7+
8+
9+
public class TestOptionalBufferPackUnpack {
10+
11+
@org.junit.Ignore
12+
public static class TestMessagePack extends TestSetOptional {
13+
public void testOptional0101() throws Exception {
14+
super.testOptional0101();
15+
}
16+
17+
public MyMessage01 testOptional0101(MyMessage01 src) throws Exception {
18+
MessagePack msgpack = new MessagePack();
19+
byte[] bytes = msgpack.write(src);
20+
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
21+
return msgpack.read(in, MyMessage01.class);
22+
}
23+
24+
public void testOptional0102() throws Exception {
25+
super.testOptional0102();
26+
}
27+
28+
public MyMessage02 testOptional0102(MyMessage01 src) throws Exception {
29+
MessagePack msgpack = new MessagePack();
30+
byte[] bytes = msgpack.write(src);
31+
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
32+
return msgpack.read(in, MyMessage02.class);
33+
}
34+
35+
public void testOptional0103() throws Exception {
36+
super.testOptional0103();
37+
}
38+
39+
public MyMessage03 testOptional0103(MyMessage01 src) throws Exception {
40+
MessagePack msgpack = new MessagePack();
41+
byte[] bytes = msgpack.write(src);
42+
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
43+
return msgpack.read(in, MyMessage03.class);
44+
}
45+
46+
public void testOptional0203() throws Exception {
47+
super.testOptional0203();
48+
}
49+
50+
public MyMessage03 testOptional0202(MyMessage02 src) throws Exception {
51+
MessagePack msgpack = new MessagePack();
52+
byte[] bytes = msgpack.write(src);
53+
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
54+
return msgpack.read(in, MyMessage03.class);
55+
}
56+
}
57+
58+
@Test
59+
public void test0101() throws Exception {
60+
new TestMessagePack().testOptional0101();
61+
}
62+
@Test
63+
public void test0102() throws Exception {
64+
new TestMessagePack().testOptional0102();
65+
}
66+
@Test
67+
public void test0103() throws Exception {
68+
new TestMessagePack().testOptional0103();
69+
}
70+
@Test
71+
public void test0203() throws Exception {
72+
new TestMessagePack().testOptional0203();
73+
}
74+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
package org.msgpack.annotation;
2+
3+
import java.io.ByteArrayOutputStream;
4+
5+
import org.junit.Test;
6+
import org.msgpack.MessagePack;
7+
import org.msgpack.packer.Packer;
8+
import org.msgpack.template.Template;
9+
import org.msgpack.template.TemplateRegistry;
10+
import org.msgpack.template.builder.JavassistTemplateBuilder;
11+
import org.msgpack.unpacker.BufferUnpacker;
12+
13+
14+
public class TestOptionalJavassistBufferPackBufferUnpack {
15+
16+
@org.junit.Ignore
17+
public static class TestMessagePack extends TestSetOptional {
18+
public void testOptional0101() throws Exception {
19+
super.testOptional0101();
20+
}
21+
22+
public MyMessage01 testOptional0101(MyMessage01 src) throws Exception {
23+
MessagePack msgpack = new MessagePack();
24+
TemplateRegistry registry = new TemplateRegistry(null);
25+
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
26+
Template<MyMessage01> tmpl01 = builder.buildTemplate(MyMessage01.class);
27+
ByteArrayOutputStream out = new ByteArrayOutputStream();
28+
Packer packer = msgpack.createPacker(out);
29+
tmpl01.write(packer, src);
30+
byte[] bytes = out.toByteArray();
31+
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
32+
unpacker.wrap(bytes);
33+
return tmpl01.read(unpacker, null);
34+
}
35+
36+
public void testOptional0102() throws Exception {
37+
super.testOptional0102();
38+
}
39+
40+
public MyMessage02 testOptional0102(MyMessage01 src) throws Exception {
41+
MessagePack msgpack = new MessagePack();
42+
TemplateRegistry registry = new TemplateRegistry(null);
43+
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
44+
Template<MyMessage01> tmpl01 = builder.buildTemplate(MyMessage01.class);
45+
Template<MyMessage02> tmpl02 = builder.buildTemplate(MyMessage02.class);
46+
ByteArrayOutputStream out = new ByteArrayOutputStream();
47+
Packer packer = msgpack.createPacker(out);
48+
tmpl01.write(packer, src);
49+
byte[] bytes = out.toByteArray();
50+
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
51+
unpacker.wrap(bytes);
52+
return tmpl02.read(unpacker, null);
53+
}
54+
55+
public void testOptional0103() throws Exception {
56+
super.testOptional0103();
57+
}
58+
59+
public MyMessage03 testOptional0103(MyMessage01 src) throws Exception {
60+
MessagePack msgpack = new MessagePack();
61+
TemplateRegistry registry = new TemplateRegistry(null);
62+
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
63+
Template<MyMessage01> tmpl01 = builder.buildTemplate(MyMessage01.class);
64+
Template<MyMessage03> tmpl03 = builder.buildTemplate(MyMessage03.class);
65+
ByteArrayOutputStream out = new ByteArrayOutputStream();
66+
Packer packer = msgpack.createPacker(out);
67+
tmpl01.write(packer, src);
68+
byte[] bytes = out.toByteArray();
69+
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
70+
unpacker.wrap(bytes);
71+
return tmpl03.read(unpacker, null);
72+
}
73+
74+
public void testOptional0203() throws Exception {
75+
super.testOptional0203();
76+
}
77+
78+
public MyMessage03 testOptional0202(MyMessage02 src) throws Exception {
79+
MessagePack msgpack = new MessagePack();
80+
TemplateRegistry registry = new TemplateRegistry(null);
81+
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
82+
Template<MyMessage02> tmpl02 = builder.buildTemplate(MyMessage02.class);
83+
Template<MyMessage03> tmpl03 = builder.buildTemplate(MyMessage03.class);
84+
ByteArrayOutputStream out = new ByteArrayOutputStream();
85+
Packer packer = msgpack.createPacker(out);
86+
tmpl02.write(packer, src);
87+
byte[] bytes = out.toByteArray();
88+
BufferUnpacker unpacker = msgpack.createBufferUnpacker();
89+
unpacker.wrap(bytes);
90+
return tmpl03.read(unpacker, null);
91+
}
92+
}
93+
94+
@Test
95+
public void test0101() throws Exception {
96+
new TestMessagePack().testOptional0101();
97+
}
98+
@Test
99+
public void test0102() throws Exception {
100+
new TestMessagePack().testOptional0102();
101+
}
102+
@Test
103+
public void test0103() throws Exception {
104+
new TestMessagePack().testOptional0103();
105+
}
106+
@Test
107+
public void test0203() throws Exception {
108+
new TestMessagePack().testOptional0203();
109+
}
110+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
package org.msgpack.annotation;
2+
3+
import java.io.ByteArrayInputStream;
4+
5+
import org.junit.Test;
6+
import org.msgpack.MessagePack;
7+
import org.msgpack.packer.BufferPacker;
8+
import org.msgpack.template.Template;
9+
import org.msgpack.template.TemplateRegistry;
10+
import org.msgpack.template.builder.JavassistTemplateBuilder;
11+
import org.msgpack.unpacker.Unpacker;
12+
13+
14+
public class TestOptionalJavassistBufferPackUnpack {
15+
16+
@org.junit.Ignore
17+
public static class TestMessagePack extends TestSetOptional {
18+
public void testOptional0101() throws Exception {
19+
super.testOptional0101();
20+
}
21+
22+
public MyMessage01 testOptional0101(MyMessage01 src) throws Exception {
23+
MessagePack msgpack = new MessagePack();
24+
TemplateRegistry registry = new TemplateRegistry(null);
25+
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
26+
Template<MyMessage01> tmpl01 = builder.buildTemplate(MyMessage01.class);
27+
BufferPacker packer = msgpack.createBufferPacker();
28+
tmpl01.write(packer, src);
29+
byte[] bytes = packer.toByteArray();
30+
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
31+
Unpacker unpacker = msgpack.createUnpacker(in);
32+
return tmpl01.read(unpacker, null);
33+
}
34+
35+
public void testOptional0102() throws Exception {
36+
super.testOptional0102();
37+
}
38+
39+
public MyMessage02 testOptional0102(MyMessage01 src) throws Exception {
40+
MessagePack msgpack = new MessagePack();
41+
TemplateRegistry registry = new TemplateRegistry(null);
42+
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
43+
Template<MyMessage01> tmpl01 = builder.buildTemplate(MyMessage01.class);
44+
Template<MyMessage02> tmpl02 = builder.buildTemplate(MyMessage02.class);
45+
BufferPacker packer = msgpack.createBufferPacker();
46+
tmpl01.write(packer, src);
47+
byte[] bytes = packer.toByteArray();
48+
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
49+
Unpacker unpacker = msgpack.createUnpacker(in);
50+
return tmpl02.read(unpacker, null);
51+
}
52+
53+
public void testOptional0103() throws Exception {
54+
super.testOptional0103();
55+
}
56+
57+
public MyMessage03 testOptional0103(MyMessage01 src) throws Exception {
58+
MessagePack msgpack = new MessagePack();
59+
TemplateRegistry registry = new TemplateRegistry(null);
60+
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
61+
Template<MyMessage01> tmpl01 = builder.buildTemplate(MyMessage01.class);
62+
Template<MyMessage03> tmpl03 = builder.buildTemplate(MyMessage03.class);
63+
BufferPacker packer = msgpack.createBufferPacker();
64+
tmpl01.write(packer, src);
65+
byte[] bytes = packer.toByteArray();
66+
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
67+
Unpacker unpacker = msgpack.createUnpacker(in);
68+
return tmpl03.read(unpacker, null);
69+
}
70+
71+
public void testOptional0203() throws Exception {
72+
super.testOptional0203();
73+
}
74+
75+
public MyMessage03 testOptional0202(MyMessage02 src) throws Exception {
76+
MessagePack msgpack = new MessagePack();
77+
TemplateRegistry registry = new TemplateRegistry(null);
78+
JavassistTemplateBuilder builder = new JavassistTemplateBuilder(registry);
79+
Template<MyMessage02> tmpl02 = builder.buildTemplate(MyMessage02.class);
80+
Template<MyMessage03> tmpl03 = builder.buildTemplate(MyMessage03.class);
81+
BufferPacker packer = msgpack.createBufferPacker();
82+
tmpl02.write(packer, src);
83+
byte[] bytes = packer.toByteArray();
84+
ByteArrayInputStream in = new ByteArrayInputStream(bytes);
85+
Unpacker unpacker = msgpack.createUnpacker(in);
86+
return tmpl03.read(unpacker, null);
87+
}
88+
}
89+
90+
@Test
91+
public void test0101() throws Exception {
92+
new TestMessagePack().testOptional0101();
93+
}
94+
@Test
95+
public void test0102() throws Exception {
96+
new TestMessagePack().testOptional0102();
97+
}
98+
@Test
99+
public void test0103() throws Exception {
100+
new TestMessagePack().testOptional0103();
101+
}
102+
@Test
103+
public void test0203() throws Exception {
104+
new TestMessagePack().testOptional0203();
105+
}
106+
}

0 commit comments

Comments
 (0)