public void testFooProtostuff() throws Exception { Foo fooCompare = foo; byte[] computed = toByteArrayComputedProtostuff(fooCompare, fooCompare.cachedSchema()); byte[] buffered = toByteArrayBufferedProtostuff(fooCompare, fooCompare.cachedSchema()); byte[] streamed = toByteArrayStreamedProtostuff(fooCompare, fooCompare.cachedSchema()); assertTrue(computed.length == buffered.length); assertTrue(computed.length == streamed.length); String strComputed = new String(computed, "UTF-8"); assertEquals(strComputed, new String(buffered, "UTF-8")); assertEquals(strComputed, new String(streamed, "UTF-8")); }
public void testFooProtobuf() throws Exception { Foo fooCompare = foo; byte[] computed = toByteArrayComputedProtobuf(fooCompare, fooCompare.cachedSchema()); byte[] buffered = toByteArrayBufferedProtobuf(fooCompare, fooCompare.cachedSchema()); byte[] streamed = toByteArrayStreamedProtobuf(fooCompare, fooCompare.cachedSchema()); assertTrue(computed.length == buffered.length); assertTrue(computed.length == streamed.length); String strComputed = new String(computed, "UTF-8"); assertEquals(strComputed, new String(buffered, "UTF-8")); assertEquals(strComputed, new String(streamed, "UTF-8")); }
public void testFoo() throws Exception { Foo fooCompare = foo; Foo dfoo = new Foo(); byte[] data = JsonIOUtil.toByteArray(fooCompare, fooCompare.cachedSchema(), true); JsonIOUtil.mergeFrom(data, dfoo, dfoo.cachedSchema(), true); SerializableObjects.assertEquals(fooCompare, dfoo); }
public void testFoo() throws Exception { Foo fooCompare = foo; Foo dfoo = new Foo(); byte[] data = JsonIOUtil.toByteArray(fooCompare, fooCompare.cachedSchema(), false); JsonIOUtil.mergeFrom(data, dfoo, dfoo.cachedSchema(), false); SerializableObjects.assertEquals(fooCompare, dfoo); }
public void testFooDelimited() throws Exception { Foo fooCompare = SerializableObjects.foo; ByteArrayOutputStream out = new ByteArrayOutputStream(); writeDelimitedTo(out, fooCompare); byte[] data = out.toByteArray(); ByteArrayInputStream in = new ByteArrayInputStream(data); Foo foo = new Foo(); mergeDelimitedFrom(in, foo, foo.cachedSchema()); SerializableObjects.assertEquals(foo, fooCompare); }
@Test public void testFoo() throws Exception { Foo fooCompare = foo; Foo dfoo = new Foo(); byte[] data = XmlIOUtil.toByteArray(fooCompare, fooCompare.cachedSchema()); XmlIOUtil.mergeFrom(data, dfoo, dfoo.cachedSchema()); SerializableObjects.assertEquals(fooCompare, dfoo); }
public void testEmptyFooDelimited() throws Exception { Foo fooCompare = new Foo(); ByteArrayOutputStream out = new ByteArrayOutputStream(); writeDelimitedTo(out, fooCompare); byte[] data = out.toByteArray(); ByteArrayInputStream in = new ByteArrayInputStream(data); Foo foo = new Foo(); mergeDelimitedFrom(in, foo, foo.cachedSchema()); SerializableObjects.assertEquals(foo, fooCompare); }
public void testEmptyFoo() throws Exception { Foo foo = new Foo(); byte[] data = JsonIOUtil.toByteArray(foo, foo.cachedSchema(), false); assertEquals(new String(data, "UTF-8"), "{}"); Foo parsedFoo = new Foo(); JsonIOUtil.mergeFrom(data, parsedFoo, parsedFoo.cachedSchema(), false); SerializableObjects.assertEquals(foo, parsedFoo); }
public void testEmptyFooInner() throws Exception { Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); bars.add(new Bar()); foo.setSomeBar(bars); byte[] data = JsonIOUtil.toByteArray(foo, foo.cachedSchema(), false); assertEquals(new String(data, "UTF-8"), "{\"someBar\":[{}]}"); Foo parsedFoo = new Foo(); JsonIOUtil.mergeFrom(data, parsedFoo, parsedFoo.cachedSchema(), false); SerializableObjects.assertEquals(foo, parsedFoo); }
@Test public void testEmptyFoo() throws Exception { Foo foo = new Foo(); byte[] data = XmlIOUtil.toByteArray(foo, foo.cachedSchema()); /* * assertEquals(new String(data, "UTF-8"), "<?xml version='1.0' encoding='UTF-8'?>" + "<Foo/>"); */ Foo parsedFoo = new Foo(); XmlIOUtil.mergeFrom(data, parsedFoo, parsedFoo.cachedSchema()); SerializableObjects.assertEquals(foo, parsedFoo); }
public void testEmptyFooInner() throws Exception { Bar bar = new Bar(); Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); bars.add(bar); foo.setSomeBar(bars); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testFoo() throws Exception { Foo fooCompare = foo; Foo dfoo = new Foo(); byte[] output = toByteArray(fooCompare); mergeFrom(output, 0, output.length, dfoo, dfoo.cachedSchema()); SerializableObjects.assertEquals(fooCompare, dfoo); }
public void testEmptyFoo() throws Exception { Foo foo = new Foo(); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testFoo() throws Exception { Foo fooCompare = foo; Foo dfoo = new Foo(); byte[] output = toByteArray(fooCompare); mergeFrom(output, 0, output.length, dfoo, dfoo.cachedSchema()); SerializableObjects.assertEquals(fooCompare, dfoo); }
public void testEmptyFoo() throws Exception { Foo foo = new Foo(); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testPartialEmptyFooInner() throws Exception { Baz baz = new Baz(); Bar bar = new Bar(); bar.setSomeBaz(baz); Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); foo.setSomeBar(bars); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testPartialEmptyFooInner() throws Exception { Baz baz = new Baz(); Bar bar = new Bar(); bar.setSomeBaz(baz); Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); foo.setSomeBar(bars); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testPartialEmptyFooInnerWithEmptyString() throws Exception { Baz baz = new Baz(); baz.setName(""); Bar bar = new Bar(); bar.setSomeBaz(baz); Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); foo.setSomeBar(bars); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testPartialEmptyFooInnerWithString() throws Exception { Baz baz = new Baz(); baz.setName("asdfsf"); Bar bar = new Bar(); bar.setSomeBaz(baz); Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); foo.setSomeBar(bars); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }
public void testPartialEmptyFooInnerWithEmptyString() throws Exception { Baz baz = new Baz(); baz.setName(""); Bar bar = new Bar(); bar.setSomeBaz(baz); Foo foo = new Foo(); ArrayList<Bar> bars = new ArrayList<Bar>(); foo.setSomeBar(bars); byte[] output = toByteArray(foo); Foo parsedFoo = new Foo(); mergeFrom(output, 0, output.length, parsedFoo, parsedFoo.cachedSchema()); }