use of org.infinispan.protostream.RawProtoStreamWriter in project teiid by teiid.
the class TestTeiidTableMarsheller method testMarshallWithComplexNative.
// this is for sanity debugging while writing the protocol decoder.
@Test
public void testMarshallWithComplexNative() throws Exception {
SerializationContext ctx = ProtobufUtil.newSerializationContext(Configuration.builder().build());
ctx.registerProtoFiles(FileDescriptorSource.fromString("tables.proto", ObjectConverterUtil.convertFileToString(UnitTestUtil.getTestDataFile("tables.proto"))));
ctx.registerMarshaller(new G3Marshaller());
ctx.registerMarshaller(new G4Marshaller());
ctx.registerMarshaller(new G2Marshaller());
G2 g2 = buildG2();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
RawProtoStreamWriter out = RawProtoStreamWriterImpl.newInstance(baos);
WrappedMessage.writeMessage(ctx, out, g2);
out.flush();
baos.flush();
RawProtoStreamReader in = RawProtoStreamReaderImpl.newInstance(baos.toByteArray());
G2 result = WrappedMessage.readMessage(ctx, in);
// System.out.println(result);
assertNotNull(result);
assertEquals(g2, result);
}
Aggregations