flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [21/21] flink git commit: [hotfix] [avro] Add test that validates deserialization of Kryo Serializer in the absence of Avro
Date Fri, 03 Nov 2017 17:11:44 GMT
[hotfix] [avro] Add test that validates deserialization of Kryo Serializer in the absence of
Avro


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/87bf5781
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/87bf5781
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/87bf5781

Branch: refs/heads/master
Commit: 87bf578163facc272138141fbcfa35c3bedbe74d
Parents: c438e29
Author: Stephan Ewen <sewen@apache.org>
Authored: Thu Nov 2 22:38:54 2017 +0100
Committer: Stephan Ewen <sewen@apache.org>
Committed: Fri Nov 3 16:40:36 2017 +0100

----------------------------------------------------------------------
 .../TypeSerializerSerializationUtil.java        |   1 +
 .../kryo/KryoSerializerCompatibilityTest.java   |  21 ++++++++++++++++++-
 .../resources/serialized-kryo-serializer-1.3    | Bin 0 -> 1710 bytes
 3 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/87bf5781/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java
----------------------------------------------------------------------
diff --git a/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java
b/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java
index d03498a..c6291ad 100644
--- a/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java
+++ b/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java
@@ -30,6 +30,7 @@ import org.apache.flink.core.memory.DataOutputView;
 import org.apache.flink.core.memory.DataOutputViewStreamWrapper;
 import org.apache.flink.util.InstantiationUtil;
 import org.apache.flink.util.Preconditions;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/flink/blob/87bf5781/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializerCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializerCompatibilityTest.java
b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializerCompatibilityTest.java
index 11c95f1..89e9ec3 100644
--- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializerCompatibilityTest.java
+++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/kryo/KryoSerializerCompatibilityTest.java
@@ -20,6 +20,7 @@ package org.apache.flink.api.java.typeutils.runtime.kryo;
 
 import org.apache.flink.api.common.ExecutionConfig;
 import org.apache.flink.api.common.typeutils.CompatibilityResult;
+import org.apache.flink.api.common.typeutils.TypeSerializer;
 import org.apache.flink.api.common.typeutils.TypeSerializerConfigSnapshot;
 import org.apache.flink.api.common.typeutils.TypeSerializerSerializationUtil;
 import org.apache.flink.core.memory.DataInputViewStreamWrapper;
@@ -29,6 +30,7 @@ import com.esotericsoftware.kryo.Kryo;
 import com.esotericsoftware.kryo.Serializer;
 import com.esotericsoftware.kryo.io.Input;
 import com.esotericsoftware.kryo.io.Output;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
@@ -42,6 +44,7 @@ import java.util.List;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
@@ -67,6 +70,22 @@ public class KryoSerializerCompatibilityTest {
 		assertFalse(compatResult.isRequiresMigration());
 	}
 
+	@Test
+	public void testDeserializingKryoSerializerWithoutAvro() throws Exception {
+		final String resource = "serialized-kryo-serializer-1.3";
+
+		TypeSerializer<?> serializer;
+
+		try (InputStream in = getClass().getClassLoader().getResourceAsStream(resource)) {
+			DataInputViewStreamWrapper inView = new DataInputViewStreamWrapper(in);
+
+			serializer = TypeSerializerSerializationUtil.tryReadSerializer(inView, getClass().getClassLoader());
+		}
+
+		assertNotNull(serializer);
+		assertTrue(serializer instanceof KryoSerializer);
+	}
+
 	/**
 	 * Verifies that reconfiguration result is INCOMPATIBLE if data type has changed.
 	 */
@@ -150,7 +169,7 @@ public class KryoSerializerCompatibilityTest {
 				DataInputViewStreamWrapper inputView = new DataInputViewStreamWrapper(f)) {
 
 				thrown.expectMessage("Could not find required Avro dependency");
-				FakeAvroClass myTestClass = kryoSerializer.deserialize(inputView);
+				kryoSerializer.deserialize(inputView);
 			}
 		}
 	}

http://git-wip-us.apache.org/repos/asf/flink/blob/87bf5781/flink-core/src/test/resources/serialized-kryo-serializer-1.3
----------------------------------------------------------------------
diff --git a/flink-core/src/test/resources/serialized-kryo-serializer-1.3 b/flink-core/src/test/resources/serialized-kryo-serializer-1.3
new file mode 100644
index 0000000..d977c50
Binary files /dev/null and b/flink-core/src/test/resources/serialized-kryo-serializer-1.3
differ


Mime
View raw message