use of org.apache.avro.specific.SpecificRecord in project flink by apache.
the class AvroRowDeSerializationSchemaTest method testSpecificSerializeFromSchemaSeveralTimes.
@Test
public void testSpecificSerializeFromSchemaSeveralTimes() throws IOException {
final Tuple3<Class<? extends SpecificRecord>, SpecificRecord, Row> testData = AvroTestUtils.getSpecificTestData();
final String schemaString = testData.f1.getSchema().toString();
final AvroRowSerializationSchema serializationSchema = new AvroRowSerializationSchema(schemaString);
final AvroRowDeserializationSchema deserializationSchema = new AvroRowDeserializationSchema(schemaString);
serializationSchema.serialize(testData.f2);
serializationSchema.serialize(testData.f2);
final byte[] bytes = serializationSchema.serialize(testData.f2);
final Row actual = deserializationSchema.deserialize(bytes);
assertEquals(testData.f2, actual);
}
Aggregations