flink-instrumentation/workspace/flink-1.4.1-instrumented/flink-1.4.1/flink-core/src/test/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtilTest.java
/**
	 * Verifies that reading and writing configuration snapshots work correctly.
	 */
Verifies that reading and writing configuration snapshots work correctly.
Verifies that reading and writing configuration snapshots work correctly .
@Test
	public void testSerializeConfigurationSnapshots() throws Exception {
		TypeSerializerSerializationUtilTest.TestConfigSnapshot configSnapshot1 =
			new TypeSerializerSerializationUtilTest.TestConfigSnapshot(1, "foo");
		TypeSerializerSerializationUtilTest.TestConfigSnapshot configSnapshot2 =
			new TypeSerializerSerializationUtilTest.TestConfigSnapshot(2, "bar");
		byte[] serializedConfig;
		try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
			TypeSerializerSerializationUtil.writeSerializerConfigSnapshots(
				new DataOutputViewStreamWrapper(out),
				configSnapshot1,
				configSnapshot2);
			serializedConfig = out.toByteArray();
		}
		TypeSerializerConfigSnapshot[] restoredConfigs;
		try (ByteArrayInputStream in = new ByteArrayInputStream(serializedConfig)) {
			restoredConfigs = TypeSerializerSerializationUtil.readSerializerConfigSnapshots(
				new DataInputViewStreamWrapper(in), Thread.currentThread().getContextClassLoader());
		}
		assertEquals(2, restoredConfigs.length);
		assertEquals(configSnapshot1, restoredConfigs[0]);
		assertEquals(configSnapshot2, restoredConfigs[1]);
	}
@ Test public void testSerializeConfigurationSnapshots ( ) throws Exception { TypeSerializerSerializationUtilTest . TestConfigSnapshot configSnapshot1 = new TypeSerializerSerializationUtilTest . TestConfigSnapshot ( 1 , "foo" ) ; TypeSerializerSerializationUtilTest . TestConfigSnapshot configSnapshot2 = new TypeSerializerSerializationUtilTest . TestConfigSnapshot ( 2 , "bar" ) ; byte [ ] serializedConfig ; try ( ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ) { TypeSerializerSerializationUtil . writeSerializerConfigSnapshots ( new DataOutputViewStreamWrapper ( out ) , configSnapshot1 , configSnapshot2 ) ; serializedConfig = out . toByteArray ( ) ; } TypeSerializerConfigSnapshot [ ] restoredConfigs ; try ( ByteArrayInputStream in = new ByteArrayInputStream ( serializedConfig ) ) { restoredConfigs = TypeSerializerSerializationUtil . readSerializerConfigSnapshots ( new DataInputViewStreamWrapper ( in ) , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; } assertEquals ( 2 , restoredConfigs . length ) ; assertEquals ( configSnapshot1 , restoredConfigs [ 0 ] ) ; assertEquals ( configSnapshot2 , restoredConfigs [ 1 ] ) ; }
Verifies that reading and writing configuration snapshots work correctly.
Verifies that reading and writing configuration snapshots work correctly .