use of org.apache.beam.sdk.io.thrift.payloads.TestThriftMessage in project beam by apache.
the class BeamKafkaTableThriftTest method generateEncodedPayload.
@Override
protected byte[] generateEncodedPayload(int i) {
final TestThriftMessage message = new TestThriftMessage().setFLong(i).setFInt(i).setFDouble(i).setFString("thrift_value" + i);
message.addToFDoubleArray(i);
try {
return new TSerializer(protocolFactory).serialize(message);
} catch (TException e) {
throw new RuntimeException(e);
}
}
use of org.apache.beam.sdk.io.thrift.payloads.TestThriftMessage in project beam by apache.
the class ThriftPayloadSerializerProviderTest method serialize.
@Test
public void serialize() throws Exception {
byte[] bytes = provider.getSerializer(SHUFFLED_SCHEMA, ImmutableMap.of("thriftClass", TestThriftMessage.class.getName(), "thriftProtocolFactoryClass", TCompactProtocol.Factory.class.getName())).serialize(ROW);
TestThriftMessage result = new TestThriftMessage();
new TDeserializer(new TCompactProtocol.Factory()).deserialize(result, bytes);
assertEquals(MESSAGE, result);
}
Aggregations