Java Code Examples for org.apache.flink.formats.avro.utils.AvroTestUtils#getGenericTestData()

The following examples show how to use org.apache.flink.formats.avro.utils.AvroTestUtils#getGenericTestData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AvroRowDeSerializationSchemaTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericSerializeDeserialize() throws IOException {
	final Tuple3<GenericRecord, Row, Schema> testData = AvroTestUtils.getGenericTestData();

	final AvroRowSerializationSchema serializationSchema = new AvroRowSerializationSchema(testData.f2.toString());
	final AvroRowDeserializationSchema deserializationSchema = new AvroRowDeserializationSchema(testData.f2.toString());

	final byte[] bytes = serializationSchema.serialize(testData.f1);
	final Row actual = deserializationSchema.deserialize(bytes);

	assertEquals(testData.f1, actual);
}
 
Example 2
Source File: AvroRowDeSerializationSchemaTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericSerializeSeveralTimes() throws IOException {
	final Tuple3<GenericRecord, Row, Schema> testData = AvroTestUtils.getGenericTestData();

	final AvroRowSerializationSchema serializationSchema = new AvroRowSerializationSchema(testData.f2.toString());
	final AvroRowDeserializationSchema deserializationSchema = new AvroRowDeserializationSchema(testData.f2.toString());

	serializationSchema.serialize(testData.f1);
	serializationSchema.serialize(testData.f1);
	final byte[] bytes = serializationSchema.serialize(testData.f1);
	final Row actual = deserializationSchema.deserialize(bytes);

	assertEquals(testData.f1, actual);
}
 
Example 3
Source File: AvroRowDeSerializationSchemaTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericDeserializeSeveralTimes() throws IOException {
	final Tuple3<GenericRecord, Row, Schema> testData = AvroTestUtils.getGenericTestData();

	final AvroRowSerializationSchema serializationSchema = new AvroRowSerializationSchema(testData.f2.toString());
	final AvroRowDeserializationSchema deserializationSchema = new AvroRowDeserializationSchema(testData.f2.toString());

	final byte[] bytes = serializationSchema.serialize(testData.f1);
	deserializationSchema.deserialize(bytes);
	deserializationSchema.deserialize(bytes);
	final Row actual = deserializationSchema.deserialize(bytes);

	assertEquals(testData.f1, actual);
}
 
Example 4
Source File: AvroRowDeSerializationSchemaTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericSerializeDeserialize() throws IOException {
	final Tuple3<GenericRecord, Row, Schema> testData = AvroTestUtils.getGenericTestData();

	final AvroRowSerializationSchema serializationSchema = new AvroRowSerializationSchema(testData.f2.toString());
	final AvroRowDeserializationSchema deserializationSchema = new AvroRowDeserializationSchema(testData.f2.toString());

	final byte[] bytes = serializationSchema.serialize(testData.f1);
	final Row actual = deserializationSchema.deserialize(bytes);

	assertEquals(testData.f1, actual);
}
 
Example 5
Source File: AvroRowDeSerializationSchemaTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericSerializeSeveralTimes() throws IOException {
	final Tuple3<GenericRecord, Row, Schema> testData = AvroTestUtils.getGenericTestData();

	final AvroRowSerializationSchema serializationSchema = new AvroRowSerializationSchema(testData.f2.toString());
	final AvroRowDeserializationSchema deserializationSchema = new AvroRowDeserializationSchema(testData.f2.toString());

	serializationSchema.serialize(testData.f1);
	serializationSchema.serialize(testData.f1);
	final byte[] bytes = serializationSchema.serialize(testData.f1);
	final Row actual = deserializationSchema.deserialize(bytes);

	assertEquals(testData.f1, actual);
}
 
Example 6
Source File: AvroRowDeSerializationSchemaTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericDeserializeSeveralTimes() throws IOException {
	final Tuple3<GenericRecord, Row, Schema> testData = AvroTestUtils.getGenericTestData();

	final AvroRowSerializationSchema serializationSchema = new AvroRowSerializationSchema(testData.f2.toString());
	final AvroRowDeserializationSchema deserializationSchema = new AvroRowDeserializationSchema(testData.f2.toString());

	final byte[] bytes = serializationSchema.serialize(testData.f1);
	deserializationSchema.deserialize(bytes);
	deserializationSchema.deserialize(bytes);
	final Row actual = deserializationSchema.deserialize(bytes);

	assertEquals(testData.f1, actual);
}
 
Example 7
Source File: AvroRowDeSerializationSchemaTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericSerializeDeserialize() throws IOException {
	final Tuple3<GenericRecord, Row, Schema> testData = AvroTestUtils.getGenericTestData();

	final AvroRowSerializationSchema serializationSchema = new AvroRowSerializationSchema(testData.f2.toString());
	final AvroRowDeserializationSchema deserializationSchema = new AvroRowDeserializationSchema(testData.f2.toString());

	final byte[] bytes = serializationSchema.serialize(testData.f1);
	final Row actual = deserializationSchema.deserialize(bytes);

	assertEquals(testData.f1, actual);
}
 
Example 8
Source File: AvroRowDeSerializationSchemaTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericSerializeSeveralTimes() throws IOException {
	final Tuple3<GenericRecord, Row, Schema> testData = AvroTestUtils.getGenericTestData();

	final AvroRowSerializationSchema serializationSchema = new AvroRowSerializationSchema(testData.f2.toString());
	final AvroRowDeserializationSchema deserializationSchema = new AvroRowDeserializationSchema(testData.f2.toString());

	serializationSchema.serialize(testData.f1);
	serializationSchema.serialize(testData.f1);
	final byte[] bytes = serializationSchema.serialize(testData.f1);
	final Row actual = deserializationSchema.deserialize(bytes);

	assertEquals(testData.f1, actual);
}
 
Example 9
Source File: AvroRowDeSerializationSchemaTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testGenericDeserializeSeveralTimes() throws IOException {
	final Tuple3<GenericRecord, Row, Schema> testData = AvroTestUtils.getGenericTestData();

	final AvroRowSerializationSchema serializationSchema = new AvroRowSerializationSchema(testData.f2.toString());
	final AvroRowDeserializationSchema deserializationSchema = new AvroRowDeserializationSchema(testData.f2.toString());

	final byte[] bytes = serializationSchema.serialize(testData.f1);
	deserializationSchema.deserialize(bytes);
	deserializationSchema.deserialize(bytes);
	final Row actual = deserializationSchema.deserialize(bytes);

	assertEquals(testData.f1, actual);
}