Java源码示例:org.apache.flink.api.common.typeutils.ComparatorTestBase

示例1
private void testWriteAndReadConfigSnapshot(Coder<String> coder) throws IOException {
  CoderTypeSerializer<String> serializer = new CoderTypeSerializer<>(coder);

  TypeSerializerSnapshot writtenSnapshot = serializer.snapshotConfiguration();
  ComparatorTestBase.TestOutputView outView = new ComparatorTestBase.TestOutputView();
  writtenSnapshot.writeSnapshot(outView);

  TypeSerializerSnapshot readSnapshot = new CoderTypeSerializer.LegacySnapshot();
  readSnapshot.readSnapshot(
      writtenSnapshot.getCurrentVersion(), outView.getInputView(), getClass().getClassLoader());

  assertThat(readSnapshot.restoreSerializer(), is(serializer));
}