This is an automated email from the ASF dual-hosted git repository.

aljoscha pushed a commit to branch release-1.11
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 690f9350e39b2fd3d46b4a82760fb7b452ae9d3f
Author: Aljoscha Krettek <[email protected]>
AuthorDate: Tue Jan 21 17:00:09 2020 +0100

    [FLINK-13632] Port TupleSerializer upgrade test to 
TypeSerializerUpgradeTestBase
---
 .../runtime/TupleSerializerMigrationTest.java      |  59 -----------
 .../runtime/TupleSerializerUpgradeTest.java        | 115 +++++++++++++++++++++
 .../test/resources/flink-1.6-tuple-serializer-data | Bin 392 -> 0 bytes
 .../resources/flink-1.6-tuple-serializer-snapshot  | Bin 2256 -> 0 bytes
 .../test/resources/flink-1.7-tuple-serializer-data | Bin 392 -> 0 bytes
 .../resources/flink-1.7-tuple-serializer-snapshot  | Bin 2277 -> 0 bytes
 6 files changed, 115 insertions(+), 59 deletions(-)

diff --git 
a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/TupleSerializerMigrationTest.java
 
b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/TupleSerializerMigrationTest.java
deleted file mode 100644
index 4025985..0000000
--- 
a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/TupleSerializerMigrationTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.api.java.typeutils.runtime;
-
-import org.apache.flink.api.common.typeutils.TypeSerializer;
-import 
org.apache.flink.api.common.typeutils.TypeSerializerSnapshotMigrationTestBase;
-import org.apache.flink.api.common.typeutils.base.IntSerializer;
-import org.apache.flink.api.common.typeutils.base.StringSerializer;
-import org.apache.flink.api.java.tuple.Tuple3;
-import org.apache.flink.testutils.migration.MigrationVersion;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.util.Collection;
-
-/**
- * {@link TupleSerializer} migration test.
- */
-@RunWith(Parameterized.class)
-public class TupleSerializerMigrationTest extends 
TypeSerializerSnapshotMigrationTestBase<Tuple3> {
-
-       public TupleSerializerMigrationTest(TestSpecification<Tuple3> 
testSpecification) {
-               super(testSpecification);
-       }
-
-       @Parameterized.Parameters(name = "Test Specification = {0}")
-       public static Collection<TestSpecification<?>> testSpecifications() {
-
-               final TestSpecifications testSpecifications = new 
TestSpecifications(MigrationVersion.v1_6, MigrationVersion.v1_7);
-
-               testSpecifications.add(
-                       "tuple-serializer",
-                       TupleSerializer.class,
-                       TupleSerializerSnapshot.class,
-                       () -> new TupleSerializer<>(
-                               Tuple3.class,
-                               new TypeSerializer[]{StringSerializer.INSTANCE, 
StringSerializer.INSTANCE, IntSerializer.INSTANCE})
-               );
-
-               return testSpecifications.get();
-       }
-}
diff --git 
a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/TupleSerializerUpgradeTest.java
 
b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/TupleSerializerUpgradeTest.java
new file mode 100644
index 0000000..eeb0287
--- /dev/null
+++ 
b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/runtime/TupleSerializerUpgradeTest.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.api.java.typeutils.runtime;
+
+import org.apache.flink.api.common.typeutils.TypeSerializer;
+import org.apache.flink.api.common.typeutils.TypeSerializerMatchers;
+import org.apache.flink.api.common.typeutils.TypeSerializerSchemaCompatibility;
+import org.apache.flink.api.common.typeutils.TypeSerializerUpgradeTestBase;
+import org.apache.flink.api.common.typeutils.base.IntSerializer;
+import org.apache.flink.api.common.typeutils.base.StringSerializer;
+import org.apache.flink.api.java.tuple.Tuple3;
+import org.apache.flink.testutils.migration.MigrationVersion;
+
+import org.hamcrest.Matcher;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import static org.hamcrest.Matchers.is;
+
+/**
+ * {@link TupleSerializer} upgrade test.
+ */
+@RunWith(Parameterized.class)
+public class TupleSerializerUpgradeTest
+               extends TypeSerializerUpgradeTestBase<Tuple3<String, String, 
Integer>, Tuple3<String, String, Integer>> {
+
+       public TupleSerializerUpgradeTest(
+                       TestSpecification<Tuple3<String, String, Integer>, 
Tuple3<String, String, Integer>> testSpecification) {
+               super(testSpecification);
+       }
+
+       @Parameterized.Parameters(name = "Test Specification = {0}")
+       public static Collection<TestSpecification<?, ?>> testSpecifications() 
throws Exception {
+
+               ArrayList<TestSpecification<?, ?>> testSpecifications = new 
ArrayList<>();
+               for (MigrationVersion migrationVersion : MIGRATION_VERSIONS) {
+                       testSpecifications.add(
+                                       new TestSpecification<>(
+                                                       "tuple-serializer",
+                                                       migrationVersion,
+                                                       
TupleSerializerSetup.class,
+                                                       
TupleSerializerVerifier.class));
+               }
+
+               return testSpecifications;
+       }
+
+       // 
----------------------------------------------------------------------------------------------
+       //  Specification for "tuple-serializer"
+       // 
----------------------------------------------------------------------------------------------
+
+       public static final class TupleSerializerSetup
+                       implements 
TypeSerializerUpgradeTestBase.PreUpgradeSetup<Tuple3<String, String, Integer>> {
+
+               @SuppressWarnings({"unchecked", "rawtypes"})
+               @Override
+               public TypeSerializer<Tuple3<String, String, Integer>> 
createPriorSerializer() {
+                       return new TupleSerializer(
+                                       Tuple3.class,
+                                       new TypeSerializer[]{
+                                                       
StringSerializer.INSTANCE,
+                                                       
StringSerializer.INSTANCE,
+                                                       
IntSerializer.INSTANCE});
+               }
+
+               @Override
+               public Tuple3<String, String, Integer> createTestData() {
+                       return new Tuple3<>("hello Gordon", "ciao", 14);
+               }
+       }
+
+       public static final class TupleSerializerVerifier
+                       implements 
TypeSerializerUpgradeTestBase.UpgradeVerifier<Tuple3<String, String, Integer>> {
+
+               @SuppressWarnings({"unchecked", "rawtypes"})
+               @Override
+               public TypeSerializer<Tuple3<String, String, Integer>> 
createUpgradedSerializer() {
+                       return new TupleSerializer(
+                                       Tuple3.class,
+                                       new TypeSerializer[]{
+                                                       
StringSerializer.INSTANCE,
+                                                       
StringSerializer.INSTANCE,
+                                                       
IntSerializer.INSTANCE});
+               }
+
+               @Override
+               public Matcher<Tuple3<String, String, Integer>> 
testDataMatcher() {
+                       return is(new Tuple3<>("hello Gordon", "ciao", 14));
+               }
+
+               @Override
+               public Matcher<TypeSerializerSchemaCompatibility<Tuple3<String, 
String, Integer>>> schemaCompatibilityMatcher(MigrationVersion version) {
+                       return TypeSerializerMatchers.isCompatibleAsIs();
+               }
+       }
+}
diff --git a/flink-core/src/test/resources/flink-1.6-tuple-serializer-data 
b/flink-core/src/test/resources/flink-1.6-tuple-serializer-data
deleted file mode 100644
index 079bfd7..0000000
Binary files a/flink-core/src/test/resources/flink-1.6-tuple-serializer-data 
and /dev/null differ
diff --git a/flink-core/src/test/resources/flink-1.6-tuple-serializer-snapshot 
b/flink-core/src/test/resources/flink-1.6-tuple-serializer-snapshot
deleted file mode 100644
index 6560097..0000000
Binary files 
a/flink-core/src/test/resources/flink-1.6-tuple-serializer-snapshot and 
/dev/null differ
diff --git a/flink-core/src/test/resources/flink-1.7-tuple-serializer-data 
b/flink-core/src/test/resources/flink-1.7-tuple-serializer-data
deleted file mode 100644
index 70d0853..0000000
Binary files a/flink-core/src/test/resources/flink-1.7-tuple-serializer-data 
and /dev/null differ
diff --git a/flink-core/src/test/resources/flink-1.7-tuple-serializer-snapshot 
b/flink-core/src/test/resources/flink-1.7-tuple-serializer-snapshot
deleted file mode 100644
index 4f509b4..0000000
Binary files 
a/flink-core/src/test/resources/flink-1.7-tuple-serializer-snapshot and 
/dev/null differ

Reply via email to