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 serializers work correctly.
	 */
Verifies that reading and writing serializers work correctly.
Verifies that reading and writing serializers work correctly .
@Test
	public void testSerializerSerialization() throws Exception {
		TypeSerializer<?> serializer = IntSerializer.INSTANCE;
		byte[] serialized;
		try (ByteArrayOutputStreamWithPos out = new ByteArrayOutputStreamWithPos()) {
			TypeSerializerSerializationUtil.writeSerializer(new DataOutputViewStreamWrapper(out), serializer);
			serialized = out.toByteArray();
		}
		TypeSerializer<?> deserializedSerializer;
		try (ByteArrayInputStreamWithPos in = new ByteArrayInputStreamWithPos(serialized)) {
			deserializedSerializer = TypeSerializerSerializationUtil.tryReadSerializer(
				new DataInputViewStreamWrapper(in), Thread.currentThread().getContextClassLoader());
		}
		Assert.assertEquals(serializer, deserializedSerializer);
	}
@ Test public void testSerializerSerialization ( ) throws Exception { TypeSerializer < ? > serializer = IntSerializer . INSTANCE ; byte [ ] serialized ; try ( ByteArrayOutputStreamWithPos out = new ByteArrayOutputStreamWithPos ( ) ) { TypeSerializerSerializationUtil . writeSerializer ( new DataOutputViewStreamWrapper ( out ) , serializer ) ; serialized = out . toByteArray ( ) ; } TypeSerializer < ? > deserializedSerializer ; try ( ByteArrayInputStreamWithPos in = new ByteArrayInputStreamWithPos ( serialized ) ) { deserializedSerializer = TypeSerializerSerializationUtil . tryReadSerializer ( new DataInputViewStreamWrapper ( in ) , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; } Assert . assertEquals ( serializer , deserializedSerializer ) ; }
Verifies that reading and writing serializers work correctly.
Verifies that reading and writing serializers work correctly .