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

The following examples show how to use org.apache.flink.testutils.migration.SchemaCompatibilityTestingSerializer.SchemaCompatibilityTestingSnapshot. 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: CompositeTypeSerializerUtilTest.java    From flink with 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 #2
Source File: CompositeTypeSerializerUtilTest.java    From flink with 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 #3
Source File: CompositeTypeSerializerUtilTest.java    From flink with 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 #4
Source File: CompositeTypeSerializerUtilTest.java    From flink with 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 #5
Source File: CompositeTypeSerializerUtilTest.java    From flink with 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 #6
Source File: PojoSerializerSnapshotTest.java    From flink with 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 #7
Source File: PojoSerializerSnapshotTest.java    From flink with 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 File: CompositeTypeSerializerUtilTest.java    From flink with 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 #9
Source File: CompositeTypeSerializerUtilTest.java    From flink with 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 #10
Source File: CompositeTypeSerializerUtilTest.java    From flink with 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 File: PojoSerializerSnapshotTest.java    From Flink-CEPplus with 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 #12
Source File: PojoSerializerSnapshotTest.java    From flink with 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 #13
Source File: PojoSerializerSnapshotTest.java    From flink with 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 File: CompositeTypeSerializerUtilTest.java    From Flink-CEPplus with 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 #15
Source File: CompositeTypeSerializerUtilTest.java    From Flink-CEPplus with 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 #16
Source File: CompositeTypeSerializerUtilTest.java    From Flink-CEPplus with 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 File: CompositeTypeSerializerUtilTest.java    From Flink-CEPplus with 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 #18
Source File: PojoSerializerSnapshotTest.java    From Flink-CEPplus with 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 #19
Source File: PojoSerializerSnapshotTest.java    From flink with 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 File: PojoSerializerSnapshotTest.java    From flink with 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 File: PojoSerializerSnapshotTest.java    From Flink-CEPplus with 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);
}