Java Code Examples for org.apache.flink.runtime.testutils.statemigration.TestType#V1TestTypeSerializer
The following examples show how to use
org.apache.flink.runtime.testutils.statemigration.TestType#V1TestTypeSerializer .
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: StateSerializerProviderTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testLazilyRegisterIncompatibleSerializer() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); // register serializer that requires migration for state TypeSerializerSchemaCompatibility<TestType> schemaCompatibility = testProvider.registerNewSerializerForRestoredState(new TestType.IncompatibleTestTypeSerializer()); assertTrue(schemaCompatibility.isIncompatible()); try { // a serializer for the current schema will no longer be accessible testProvider.currentSchemaSerializer(); fail(); } catch (Exception excepted) { // success } }
Example 2
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testLazilyRegisterNewCompatibleAsIsSerializer() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); // register compatible serializer for state TypeSerializerSchemaCompatibility<TestType> schemaCompatibility = testProvider.registerNewSerializerForRestoredState(new TestType.V1TestTypeSerializer()); assertTrue(schemaCompatibility.isCompatibleAsIs()); assertTrue(testProvider.currentSchemaSerializer() instanceof TestType.V1TestTypeSerializer); assertTrue(testProvider.previousSchemaSerializer() instanceof TestType.V1TestTypeSerializer); }
Example 3
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = UnsupportedOperationException.class) public void testSetSerializerSnapshotTwiceWithEagerlyRegisteredSerializerProviderShouldFail() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromNewRegisteredSerializer(serializer); testProvider.setPreviousSerializerSnapshotForRestoredState(serializer.snapshotConfiguration()); // second registration should fail testProvider.setPreviousSerializerSnapshotForRestoredState(serializer.snapshotConfiguration()); }
Example 4
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = UnsupportedOperationException.class) public void testSetSerializerSnapshotWithLazilyRegisteredSerializerProviderShouldFail() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); testProvider.setPreviousSerializerSnapshotForRestoredState(serializer.snapshotConfiguration()); }
Example 5
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = UnsupportedOperationException.class) public void testSetSerializerSnapshotWithLazilyRegisteredSerializerProviderShouldFail() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); testProvider.setPreviousSerializerSnapshotForRestoredState(serializer.snapshotConfiguration()); }
Example 6
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testLazilyRegisterNewSerializerRequiringReconfiguration() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); // register serializer that requires reconfiguration, and verify that // the resulting current schema serializer is the reconfigured one TypeSerializerSchemaCompatibility<TestType> schemaCompatibility = testProvider.registerNewSerializerForRestoredState(new TestType.ReconfigurationRequiringTestTypeSerializer()); assertTrue(schemaCompatibility.isCompatibleWithReconfiguredSerializer()); assertTrue(testProvider.currentSchemaSerializer().getClass() == TestType.V1TestTypeSerializer.class); }
Example 7
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testLazilyRegisterNewCompatibleAfterMigrationSerializer() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); // register serializer that requires migration for state TypeSerializerSchemaCompatibility<TestType> schemaCompatibility = testProvider.registerNewSerializerForRestoredState(new TestType.V2TestTypeSerializer()); assertTrue(schemaCompatibility.isCompatibleAfterMigration()); assertTrue(testProvider.currentSchemaSerializer() instanceof TestType.V2TestTypeSerializer); assertTrue(testProvider.previousSchemaSerializer() instanceof TestType.V1TestTypeSerializer); }
Example 8
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = UnsupportedOperationException.class) public void testSetSerializerSnapshotTwiceWithEagerlyRegisteredSerializerProviderShouldFail() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromNewRegisteredSerializer(serializer); testProvider.setPreviousSerializerSnapshotForRestoredState(serializer.snapshotConfiguration()); // second registration should fail testProvider.setPreviousSerializerSnapshotForRestoredState(serializer.snapshotConfiguration()); }
Example 9
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 5 votes |
@Test(expected = UnsupportedOperationException.class) public void testRegisterNewSerializerTwiceWithLazilyRegisteredStateSerializerProviderShouldFail() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); testProvider.registerNewSerializerForRestoredState(new TestType.V2TestTypeSerializer()); // second registration should fail testProvider.registerNewSerializerForRestoredState(new TestType.V2TestTypeSerializer()); }
Example 10
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testLazilyRegisterNewCompatibleAfterMigrationSerializer() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); // register serializer that requires migration for state TypeSerializerSchemaCompatibility<TestType> schemaCompatibility = testProvider.registerNewSerializerForRestoredState(new TestType.V2TestTypeSerializer()); assertTrue(schemaCompatibility.isCompatibleAfterMigration()); assertTrue(testProvider.currentSchemaSerializer() instanceof TestType.V2TestTypeSerializer); assertTrue(testProvider.previousSchemaSerializer() instanceof TestType.V1TestTypeSerializer); }
Example 11
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testLazilyRegisterNewSerializerRequiringReconfiguration() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); // register serializer that requires reconfiguration, and verify that // the resulting current schema serializer is the reconfigured one TypeSerializerSchemaCompatibility<TestType> schemaCompatibility = testProvider.registerNewSerializerForRestoredState(new TestType.ReconfigurationRequiringTestTypeSerializer()); assertTrue(schemaCompatibility.isCompatibleWithReconfiguredSerializer()); assertTrue(testProvider.currentSchemaSerializer().getClass() == TestType.V1TestTypeSerializer.class); }
Example 12
Source File: StateSerializerProviderTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test(expected = UnsupportedOperationException.class) public void testSetSerializerSnapshotWithLazilyRegisteredSerializerProviderShouldFail() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); testProvider.setPreviousSerializerSnapshotForRestoredState(serializer.snapshotConfiguration()); }
Example 13
Source File: StateSerializerProviderTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testLazilyRegisterNewSerializerRequiringReconfiguration() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); // register serializer that requires reconfiguration, and verify that // the resulting current schema serializer is the reconfigured one TypeSerializerSchemaCompatibility<TestType> schemaCompatibility = testProvider.registerNewSerializerForRestoredState(new TestType.ReconfigurationRequiringTestTypeSerializer()); assertTrue(schemaCompatibility.isCompatibleWithReconfiguredSerializer()); assertTrue(testProvider.currentSchemaSerializer().getClass() == TestType.V1TestTypeSerializer.class); }
Example 14
Source File: StateSerializerProviderTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testLazilyRegisterNewCompatibleAfterMigrationSerializer() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); // register serializer that requires migration for state TypeSerializerSchemaCompatibility<TestType> schemaCompatibility = testProvider.registerNewSerializerForRestoredState(new TestType.V2TestTypeSerializer()); assertTrue(schemaCompatibility.isCompatibleAfterMigration()); assertTrue(testProvider.currentSchemaSerializer() instanceof TestType.V2TestTypeSerializer); assertTrue(testProvider.previousSchemaSerializer() instanceof TestType.V1TestTypeSerializer); }
Example 15
Source File: StateSerializerProviderTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testLazilyRegisterNewCompatibleAsIsSerializer() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); // register compatible serializer for state TypeSerializerSchemaCompatibility<TestType> schemaCompatibility = testProvider.registerNewSerializerForRestoredState(new TestType.V1TestTypeSerializer()); assertTrue(schemaCompatibility.isCompatibleAsIs()); assertTrue(testProvider.currentSchemaSerializer() instanceof TestType.V1TestTypeSerializer); assertTrue(testProvider.previousSchemaSerializer() instanceof TestType.V1TestTypeSerializer); }
Example 16
Source File: StateSerializerProviderTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test(expected = UnsupportedOperationException.class) public void testRegisterNewSerializerTwiceWithLazilyRegisteredStateSerializerProviderShouldFail() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); testProvider.registerNewSerializerForRestoredState(new TestType.V2TestTypeSerializer()); // second registration should fail testProvider.registerNewSerializerForRestoredState(new TestType.V2TestTypeSerializer()); }
Example 17
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testPreviousSchemaSerializerForLazilyRegisteredStateSerializerProvider() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); assertTrue(testProvider.previousSchemaSerializer() instanceof TestType.V1TestTypeSerializer); }
Example 18
Source File: StateSerializerProviderTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testPreviousSchemaSerializerForLazilyRegisteredStateSerializerProvider() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); assertTrue(testProvider.previousSchemaSerializer() instanceof TestType.V1TestTypeSerializer); }
Example 19
Source File: StateSerializerProviderTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testCurrentSchemaSerializerForLazilyRegisteredStateSerializerProvider() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); assertTrue(testProvider.currentSchemaSerializer() instanceof TestType.V1TestTypeSerializer); }
Example 20
Source File: StateSerializerProviderTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testPreviousSchemaSerializerForLazilyRegisteredStateSerializerProvider() { TestType.V1TestTypeSerializer serializer = new TestType.V1TestTypeSerializer(); StateSerializerProvider<TestType> testProvider = StateSerializerProvider.fromPreviousSerializerSnapshot(serializer.snapshotConfiguration()); assertTrue(testProvider.previousSchemaSerializer() instanceof TestType.V1TestTypeSerializer); }