Java Code Examples for org.apache.flink.testutils.migration.SchemaCompatibilityTestingSerializer.SchemaCompatibilityTestingSnapshot

The following examples show how to use org.apache.flink.testutils.migration.SchemaCompatibilityTestingSerializer.SchemaCompatibilityTestingSnapshot. These examples are extracted from open source projects. 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 Project: Flink-CEPplus   Source File: PojoSerializerSnapshotTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testResolveSchemaCompatibilityWithIncompatibleFieldSerializers() {
	final PojoSerializerSnapshot<TestPojo> testSnapshot = buildTestSnapshot(Arrays.asList(
		ID_FIELD,
		mockFieldSerializerSnapshot(
			NAME_FIELD,
			SchemaCompatibilityTestingSnapshot.thatIsIncompatibleWithTheNextSerializer()),
		HEIGHT_FIELD
	));

	final PojoSerializer<TestPojo> newPojoSerializer = buildTestNewPojoSerializer(Arrays.asList(
		ID_FIELD,
		mockFieldSerializer(NAME_FIELD, new SchemaCompatibilityTestingSerializer()),
		HEIGHT_FIELD
	));

	final TypeSerializerSchemaCompatibility<TestPojo> resultCompatibility =
		testSnapshot.resolveSchemaCompatibility(newPojoSerializer);

	assertTrue(resultCompatibility.isIncompatible());
}
 
Example 2
Source Project: Flink-CEPplus   Source File: PojoSerializerSnapshotTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testResolveSchemaCompatibilityWithCompatibleAfterMigrationFieldSerializers() {
	final PojoSerializerSnapshot<TestPojo> testSnapshot = buildTestSnapshot(Arrays.asList(
		ID_FIELD,
		NAME_FIELD,
		mockFieldSerializerSnapshot(
			HEIGHT_FIELD,
			SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterMigration())));

	final PojoSerializer<TestPojo> newPojoSerializer = buildTestNewPojoSerializer(Arrays.asList(
		ID_FIELD,
		NAME_FIELD,
		mockFieldSerializer(HEIGHT_FIELD, new SchemaCompatibilityTestingSerializer())
	));

	final TypeSerializerSchemaCompatibility<TestPojo> resultCompatibility =
		testSnapshot.resolveSchemaCompatibility(newPojoSerializer);

	assertTrue(resultCompatibility.isCompatibleAfterMigration());
}
 
Example 3
@Test
public void testCompatibleAsIsIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("first serializer"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("second serializer"),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("first serializer"),
		new SchemaCompatibilityTestingSerializer("second serializer"),
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	assertTrue(intermediateCompatibilityResult.isCompatibleAsIs());
	assertTrue(intermediateCompatibilityResult.getFinalResult().isCompatibleAsIs());
	assertArrayEquals(testNewSerializers, intermediateCompatibilityResult.getNestedSerializers());
}
 
Example 4
@Test
public void testCompatibleWithReconfiguredSerializerIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("a"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration("b"),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("a"),
		new SchemaCompatibilityTestingSerializer("b"),
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	final TypeSerializer<?>[] expectedReconfiguredNestedSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("a"),
		new SchemaCompatibilityTestingSerializer("b"),
	};

	assertTrue(intermediateCompatibilityResult.isCompatibleWithReconfiguredSerializer());
	assertArrayEquals(expectedReconfiguredNestedSerializers, intermediateCompatibilityResult.getNestedSerializers());
}
 
Example 5
@Test
public void testCompatibleAfterMigrationIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration("a"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterMigration("b"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("c"),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("a"),
		new SchemaCompatibilityTestingSerializer("b"),
		new SchemaCompatibilityTestingSerializer("c")
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	assertTrue(intermediateCompatibilityResult.isCompatibleAfterMigration());
	assertTrue(intermediateCompatibilityResult.getFinalResult().isCompatibleAfterMigration());
}
 
Example 6
@Test
public void testIncompatibleIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer(),
		SchemaCompatibilityTestingSnapshot.thatIsIncompatibleWithTheNextSerializer(),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration(),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterMigration(),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer(),
		new SchemaCompatibilityTestingSerializer(),
		new SchemaCompatibilityTestingSerializer(),
		new SchemaCompatibilityTestingSerializer()
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	assertTrue(intermediateCompatibilityResult.isIncompatible());
	assertTrue(intermediateCompatibilityResult.getFinalResult().isIncompatible());
}
 
Example 7
Source Project: flink   Source File: PojoSerializerSnapshotTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testResolveSchemaCompatibilityWithIncompatibleFieldSerializers() {
	final PojoSerializerSnapshot<TestPojo> testSnapshot = buildTestSnapshot(Arrays.asList(
		ID_FIELD,
		mockFieldSerializerSnapshot(
			NAME_FIELD,
			SchemaCompatibilityTestingSnapshot.thatIsIncompatibleWithTheNextSerializer()),
		HEIGHT_FIELD
	));

	final PojoSerializer<TestPojo> newPojoSerializer = buildTestNewPojoSerializer(Arrays.asList(
		ID_FIELD,
		mockFieldSerializer(NAME_FIELD, new SchemaCompatibilityTestingSerializer()),
		HEIGHT_FIELD
	));

	final TypeSerializerSchemaCompatibility<TestPojo> resultCompatibility =
		testSnapshot.resolveSchemaCompatibility(newPojoSerializer);

	assertTrue(resultCompatibility.isIncompatible());
}
 
Example 8
Source Project: flink   Source File: PojoSerializerSnapshotTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testResolveSchemaCompatibilityWithCompatibleAfterMigrationFieldSerializers() {
	final PojoSerializerSnapshot<TestPojo> testSnapshot = buildTestSnapshot(Arrays.asList(
		ID_FIELD,
		NAME_FIELD,
		mockFieldSerializerSnapshot(
			HEIGHT_FIELD,
			SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterMigration())));

	final PojoSerializer<TestPojo> newPojoSerializer = buildTestNewPojoSerializer(Arrays.asList(
		ID_FIELD,
		NAME_FIELD,
		mockFieldSerializer(HEIGHT_FIELD, new SchemaCompatibilityTestingSerializer())
	));

	final TypeSerializerSchemaCompatibility<TestPojo> resultCompatibility =
		testSnapshot.resolveSchemaCompatibility(newPojoSerializer);

	assertTrue(resultCompatibility.isCompatibleAfterMigration());
}
 
Example 9
Source Project: flink   Source File: CompositeTypeSerializerUtilTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testCompatibleAsIsIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("first serializer"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("second serializer"),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("first serializer"),
		new SchemaCompatibilityTestingSerializer("second serializer"),
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	assertTrue(intermediateCompatibilityResult.isCompatibleAsIs());
	assertTrue(intermediateCompatibilityResult.getFinalResult().isCompatibleAsIs());
	assertArrayEquals(testNewSerializers, intermediateCompatibilityResult.getNestedSerializers());
}
 
Example 10
Source Project: flink   Source File: CompositeTypeSerializerUtilTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testCompatibleWithReconfiguredSerializerIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("a"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration("b"),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("a"),
		new SchemaCompatibilityTestingSerializer("b"),
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	final TypeSerializer<?>[] expectedReconfiguredNestedSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("a"),
		new SchemaCompatibilityTestingSerializer("b"),
	};

	assertTrue(intermediateCompatibilityResult.isCompatibleWithReconfiguredSerializer());
	assertArrayEquals(expectedReconfiguredNestedSerializers, intermediateCompatibilityResult.getNestedSerializers());
}
 
Example 11
Source Project: flink   Source File: CompositeTypeSerializerUtilTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testCompatibleAfterMigrationIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration("a"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterMigration("b"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("c"),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("a"),
		new SchemaCompatibilityTestingSerializer("b"),
		new SchemaCompatibilityTestingSerializer("c")
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	assertTrue(intermediateCompatibilityResult.isCompatibleAfterMigration());
	assertTrue(intermediateCompatibilityResult.getFinalResult().isCompatibleAfterMigration());
}
 
Example 12
Source Project: flink   Source File: CompositeTypeSerializerUtilTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testIncompatibleIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer(),
		SchemaCompatibilityTestingSnapshot.thatIsIncompatibleWithTheNextSerializer(),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration(),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterMigration(),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer(),
		new SchemaCompatibilityTestingSerializer(),
		new SchemaCompatibilityTestingSerializer(),
		new SchemaCompatibilityTestingSerializer()
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	assertTrue(intermediateCompatibilityResult.isIncompatible());
	assertTrue(intermediateCompatibilityResult.getFinalResult().isIncompatible());
}
 
Example 13
Source Project: flink   Source File: PojoSerializerSnapshotTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testResolveSchemaCompatibilityWithIncompatibleFieldSerializers() {
	final PojoSerializerSnapshot<TestPojo> testSnapshot = buildTestSnapshot(Arrays.asList(
		ID_FIELD,
		mockFieldSerializerSnapshot(
			NAME_FIELD,
			SchemaCompatibilityTestingSnapshot.thatIsIncompatibleWithTheNextSerializer()),
		HEIGHT_FIELD
	));

	final PojoSerializer<TestPojo> newPojoSerializer = buildTestNewPojoSerializer(Arrays.asList(
		ID_FIELD,
		mockFieldSerializer(NAME_FIELD, new SchemaCompatibilityTestingSerializer()),
		HEIGHT_FIELD
	));

	final TypeSerializerSchemaCompatibility<TestPojo> resultCompatibility =
		testSnapshot.resolveSchemaCompatibility(newPojoSerializer);

	assertTrue(resultCompatibility.isIncompatible());
}
 
Example 14
Source Project: flink   Source File: PojoSerializerSnapshotTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testResolveSchemaCompatibilityWithCompatibleAfterMigrationFieldSerializers() {
	final PojoSerializerSnapshot<TestPojo> testSnapshot = buildTestSnapshot(Arrays.asList(
		ID_FIELD,
		NAME_FIELD,
		mockFieldSerializerSnapshot(
			HEIGHT_FIELD,
			SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterMigration())));

	final PojoSerializer<TestPojo> newPojoSerializer = buildTestNewPojoSerializer(Arrays.asList(
		ID_FIELD,
		NAME_FIELD,
		mockFieldSerializer(HEIGHT_FIELD, new SchemaCompatibilityTestingSerializer())
	));

	final TypeSerializerSchemaCompatibility<TestPojo> resultCompatibility =
		testSnapshot.resolveSchemaCompatibility(newPojoSerializer);

	assertTrue(resultCompatibility.isCompatibleAfterMigration());
}
 
Example 15
Source Project: flink   Source File: CompositeTypeSerializerUtilTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testCompatibleAsIsIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("first serializer"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("second serializer"),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("first serializer"),
		new SchemaCompatibilityTestingSerializer("second serializer"),
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	assertTrue(intermediateCompatibilityResult.isCompatibleAsIs());
	assertTrue(intermediateCompatibilityResult.getFinalResult().isCompatibleAsIs());
	assertArrayEquals(testNewSerializers, intermediateCompatibilityResult.getNestedSerializers());
}
 
Example 16
Source Project: flink   Source File: CompositeTypeSerializerUtilTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testCompatibleWithReconfiguredSerializerIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("a"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration("b"),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("a"),
		new SchemaCompatibilityTestingSerializer("b"),
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	final TypeSerializer<?>[] expectedReconfiguredNestedSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("a"),
		new SchemaCompatibilityTestingSerializer("b"),
	};

	assertTrue(intermediateCompatibilityResult.isCompatibleWithReconfiguredSerializer());
	assertArrayEquals(expectedReconfiguredNestedSerializers, intermediateCompatibilityResult.getNestedSerializers());
}
 
Example 17
Source Project: flink   Source File: CompositeTypeSerializerUtilTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testCompatibleAfterMigrationIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration("a"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterMigration("b"),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer("c"),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer("a"),
		new SchemaCompatibilityTestingSerializer("b"),
		new SchemaCompatibilityTestingSerializer("c")
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	assertTrue(intermediateCompatibilityResult.isCompatibleAfterMigration());
	assertTrue(intermediateCompatibilityResult.getFinalResult().isCompatibleAfterMigration());
}
 
Example 18
Source Project: flink   Source File: CompositeTypeSerializerUtilTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testIncompatibleIntermediateCompatibilityResult() {
	final TypeSerializerSnapshot<?>[] testSerializerSnapshots = new TypeSerializerSnapshot<?>[] {
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializer(),
		SchemaCompatibilityTestingSnapshot.thatIsIncompatibleWithTheNextSerializer(),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration(),
		SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterMigration(),
	};

	final TypeSerializer<?>[] testNewSerializers = new TypeSerializer<?>[] {
		new SchemaCompatibilityTestingSerializer(),
		new SchemaCompatibilityTestingSerializer(),
		new SchemaCompatibilityTestingSerializer(),
		new SchemaCompatibilityTestingSerializer()
	};

	IntermediateCompatibilityResult<?> intermediateCompatibilityResult =
		CompositeTypeSerializerUtil.constructIntermediateCompatibilityResult(testNewSerializers, testSerializerSnapshots);

	assertTrue(intermediateCompatibilityResult.isIncompatible());
	assertTrue(intermediateCompatibilityResult.getFinalResult().isIncompatible());
}
 
Example 19
Source Project: Flink-CEPplus   Source File: PojoSerializerSnapshotTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testResolveSchemaCompatibilityWithCompatibleWithReconfigurationFieldSerializers() {
	final PojoSerializerSnapshot<TestPojo> testSnapshot = buildTestSnapshot(Arrays.asList(
		mockFieldSerializerSnapshot(
			ID_FIELD,
			SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration()),
		NAME_FIELD,
		HEIGHT_FIELD
	));

	final PojoSerializer<TestPojo> newPojoSerializer = buildTestNewPojoSerializer(Arrays.asList(
		mockFieldSerializer(ID_FIELD, new SchemaCompatibilityTestingSerializer()),
		NAME_FIELD,
		HEIGHT_FIELD
	));

	final TypeSerializerSchemaCompatibility<TestPojo> resultCompatibility =
		testSnapshot.resolveSchemaCompatibility(newPojoSerializer);

	assertTrue(resultCompatibility.isCompatibleWithReconfiguredSerializer());

	final TypeSerializer<TestPojo> reconfiguredSerializer = resultCompatibility.getReconfiguredSerializer();
	assertSame(reconfiguredSerializer.getClass(), PojoSerializer.class);
	final PojoSerializer<TestPojo> reconfiguredPojoSerializer = (PojoSerializer<TestPojo>) reconfiguredSerializer;

	final TypeSerializer<?>[] reconfiguredFieldSerializers = reconfiguredPojoSerializer.getFieldSerializers();
	assertArrayEquals(
		new TypeSerializer[] {
			new SchemaCompatibilityTestingSerializer(),
			StringSerializer.INSTANCE,
			DoubleSerializer.INSTANCE },
		reconfiguredFieldSerializers);
}
 
Example 20
Source Project: flink   Source File: PojoSerializerSnapshotTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testResolveSchemaCompatibilityWithCompatibleWithReconfigurationFieldSerializers() {
	final PojoSerializerSnapshot<TestPojo> testSnapshot = buildTestSnapshot(Arrays.asList(
		mockFieldSerializerSnapshot(
			ID_FIELD,
			SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration()),
		NAME_FIELD,
		HEIGHT_FIELD
	));

	final PojoSerializer<TestPojo> newPojoSerializer = buildTestNewPojoSerializer(Arrays.asList(
		mockFieldSerializer(ID_FIELD, new SchemaCompatibilityTestingSerializer()),
		NAME_FIELD,
		HEIGHT_FIELD
	));

	final TypeSerializerSchemaCompatibility<TestPojo> resultCompatibility =
		testSnapshot.resolveSchemaCompatibility(newPojoSerializer);

	assertTrue(resultCompatibility.isCompatibleWithReconfiguredSerializer());

	final TypeSerializer<TestPojo> reconfiguredSerializer = resultCompatibility.getReconfiguredSerializer();
	assertSame(reconfiguredSerializer.getClass(), PojoSerializer.class);
	final PojoSerializer<TestPojo> reconfiguredPojoSerializer = (PojoSerializer<TestPojo>) reconfiguredSerializer;

	final TypeSerializer<?>[] reconfiguredFieldSerializers = reconfiguredPojoSerializer.getFieldSerializers();
	assertArrayEquals(
		new TypeSerializer[] {
			new SchemaCompatibilityTestingSerializer(),
			StringSerializer.INSTANCE,
			DoubleSerializer.INSTANCE },
		reconfiguredFieldSerializers);
}
 
Example 21
Source Project: flink   Source File: PojoSerializerSnapshotTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testResolveSchemaCompatibilityWithCompatibleWithReconfigurationFieldSerializers() {
	final PojoSerializerSnapshot<TestPojo> testSnapshot = buildTestSnapshot(Arrays.asList(
		mockFieldSerializerSnapshot(
			ID_FIELD,
			SchemaCompatibilityTestingSnapshot.thatIsCompatibleWithNextSerializerAfterReconfiguration()),
		NAME_FIELD,
		HEIGHT_FIELD
	));

	final PojoSerializer<TestPojo> newPojoSerializer = buildTestNewPojoSerializer(Arrays.asList(
		mockFieldSerializer(ID_FIELD, new SchemaCompatibilityTestingSerializer()),
		NAME_FIELD,
		HEIGHT_FIELD
	));

	final TypeSerializerSchemaCompatibility<TestPojo> resultCompatibility =
		testSnapshot.resolveSchemaCompatibility(newPojoSerializer);

	assertTrue(resultCompatibility.isCompatibleWithReconfiguredSerializer());

	final TypeSerializer<TestPojo> reconfiguredSerializer = resultCompatibility.getReconfiguredSerializer();
	assertSame(reconfiguredSerializer.getClass(), PojoSerializer.class);
	final PojoSerializer<TestPojo> reconfiguredPojoSerializer = (PojoSerializer<TestPojo>) reconfiguredSerializer;

	final TypeSerializer<?>[] reconfiguredFieldSerializers = reconfiguredPojoSerializer.getFieldSerializers();
	assertArrayEquals(
		new TypeSerializer[] {
			new SchemaCompatibilityTestingSerializer(),
			StringSerializer.INSTANCE,
			DoubleSerializer.INSTANCE },
		reconfiguredFieldSerializers);
}