Java Code Examples for org.apache.flink.testutils.migration.SchemaCompatibilityTestingSerializer.SchemaCompatibilityTestingSnapshot#thatIsCompatibleWithNextSerializer()

The following examples show how to use org.apache.flink.testutils.migration.SchemaCompatibilityTestingSerializer.SchemaCompatibilityTestingSnapshot#thatIsCompatibleWithNextSerializer() . 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-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 2
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 3
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 4
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 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: 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 7
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 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 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 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: 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 12
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());
}