@Test public void testCompatibleWithReconfiguredSerializerPrecedence() throws IOException { final String OUTER_CONFIG = "outer-config"; TypeSerializer<?>[] testNestedSerializers = { new NestedSerializer(TargetCompatibility.COMPATIBLE_AS_IS), new NestedSerializer(TargetCompatibility.COMPATIBLE_WITH_RECONFIGURED_SERIALIZER), new NestedSerializer(TargetCompatibility.COMPATIBLE_AS_IS), }; TypeSerializerSchemaCompatibility<String> compatibility = snapshotCompositeSerializerAndGetSchemaCompatibilityAfterRestore( testNestedSerializers, testNestedSerializers, OUTER_CONFIG, OUTER_CONFIG); Assert.assertTrue(compatibility.isCompatibleWithReconfiguredSerializer()); TestCompositeTypeSerializer reconfiguredSerializer = (TestCompositeTypeSerializer) compatibility.getReconfiguredSerializer(); TypeSerializer<?>[] reconfiguredNestedSerializers = reconfiguredSerializer.getNestedSerializers(); Assert.assertTrue(reconfiguredNestedSerializers[0].getClass() == NestedSerializer.class); Assert.assertTrue(reconfiguredNestedSerializers[1].getClass() == ReconfiguredNestedSerializer.class); Assert.assertTrue(reconfiguredNestedSerializers[2].getClass() == NestedSerializer.class); }
protected abstract TypeSerializer<?>[] getNestedSerializers(S outerSerializer);
CompositeTypeSerializerSnapshot implements TypeSerializerSnapshot<T> { protected abstract TypeSerializer<?>[] getNestedSerializers(S outerSerializer); }
CompositeTypeSerializerSnapshot implements TypeSerializerSnapshot<T> { protected abstract TypeSerializer<?>[] getNestedSerializers(S outerSerializer); @SuppressWarnings("unchecked")  CompositeTypeSerializerSnapshot(Class<? extends TypeSerializer> correspondingSerializerClass); @SuppressWarnings("unchecked")  CompositeTypeSerializerSnapshot(S serializerInstance); }
CompositeTypeSerializerSnapshot implements TypeSerializerSnapshot<T> { protected abstract TypeSerializer<?>[] getNestedSerializers(S outerSerializer); @SuppressWarnings("unchecked")  CompositeTypeSerializerSnapshot(Class<? extends TypeSerializer> correspondingSerializerClass); @SuppressWarnings("unchecked")  CompositeTypeSerializerSnapshot(S serializerInstance); @Override final int getCurrentVersion(); @Override final void writeSnapshot(DataOutputView out); @Override final void readSnapshot(int readVersion, DataInputView in, ClassLoader userCodeClassLoader); @Override final TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibility(TypeSerializer<T> newSerializer); @Override final TypeSerializer<T> restoreSerializer(); }
CompositeTypeSerializerSnapshot implements TypeSerializerSnapshot<T> { protected abstract TypeSerializer<?>[] getNestedSerializers(S outerSerializer); @SuppressWarnings("unchecked")  CompositeTypeSerializerSnapshot(Class<? extends TypeSerializer> correspondingSerializerClass); @SuppressWarnings("unchecked")  CompositeTypeSerializerSnapshot(S serializerInstance); @Override final int getCurrentVersion(); @Override final void writeSnapshot(DataOutputView out); @Override final void readSnapshot(int readVersion, DataInputView in, ClassLoader userCodeClassLoader); @Override final TypeSerializerSchemaCompatibility<T> resolveSchemaCompatibility(TypeSerializer<T> newSerializer); @Override final TypeSerializer<T> restoreSerializer();  }