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 fa340478aeb72f97a1c0ac20c05002f0c64c5d66
Author: klion26 <[email protected]>
AuthorDate: Sat Feb 15 09:07:51 2020 +0800

    [FLINK-13632] Port WindowSerializer upgrade test to 
TypeSerializerUpgradeTestBase
---
 .../WindowSerializerSnapshotsMigrationTest.java    |  60 ---------
 .../windowing/WindowSerializerUpgradeTest.java     | 144 +++++++++++++++++++++
 .../flink-1.6-global-window-serializer-data        | Bin 10 -> 0 bytes
 .../flink-1.6-global-window-serializer-snapshot    | Bin 420 -> 0 bytes
 .../flink-1.6-time-window-serializer-data          | Bin 160 -> 0 bytes
 .../flink-1.6-time-window-serializer-snapshot      | Bin 416 -> 0 bytes
 .../flink-1.7-global-window-serializer-data        | Bin 10 -> 0 bytes
 .../flink-1.7-global-window-serializer-snapshot    | Bin 408 -> 0 bytes
 .../flink-1.7-time-window-serializer-data          | Bin 160 -> 0 bytes
 .../flink-1.7-time-window-serializer-snapshot      | Bin 404 -> 0 bytes
 10 files changed, 144 insertions(+), 60 deletions(-)

diff --git 
a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowSerializerSnapshotsMigrationTest.java
 
b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowSerializerSnapshotsMigrationTest.java
deleted file mode 100644
index 94dd4fb..0000000
--- 
a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowSerializerSnapshotsMigrationTest.java
+++ /dev/null
@@ -1,60 +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.streaming.runtime.operators.windowing;
-
-import 
org.apache.flink.api.common.typeutils.TypeSerializerSnapshotMigrationTestBase;
-import org.apache.flink.streaming.api.windowing.windows.GlobalWindow;
-import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
-import org.apache.flink.testutils.migration.MigrationVersion;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.util.Collection;
-
-/**
- * Migration tests for the {@link TimeWindow.Serializer} and {@link 
GlobalWindow.Serializer}.
- */
-@RunWith(Parameterized.class)
-public class WindowSerializerSnapshotsMigrationTest extends 
TypeSerializerSnapshotMigrationTestBase<Object> {
-
-       public WindowSerializerSnapshotsMigrationTest(TestSpecification<Object> 
testSpecification) {
-               super(testSpecification);
-       }
-
-       @SuppressWarnings("unchecked")
-       @Parameterized.Parameters(name = "Test Specification = {0}")
-       public static Collection<TestSpecification<?>> testSpecifications() {
-
-               final TestSpecifications testSpecifications = new 
TestSpecifications(MigrationVersion.v1_6, MigrationVersion.v1_7);
-
-               testSpecifications.add(
-                       "time-window-serializer",
-                       TimeWindow.Serializer.class,
-                       
TimeWindow.Serializer.TimeWindowSerializerSnapshot.class,
-                       TimeWindow.Serializer::new);
-               testSpecifications.add(
-                       "global-window-serializer",
-                       GlobalWindow.Serializer.class,
-                       
GlobalWindow.Serializer.GlobalWindowSerializerSnapshot.class,
-                       GlobalWindow.Serializer::new);
-
-               return testSpecifications.get();
-       }
-}
diff --git 
a/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowSerializerUpgradeTest.java
 
b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowSerializerUpgradeTest.java
new file mode 100644
index 0000000..1d314e6
--- /dev/null
+++ 
b/flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowSerializerUpgradeTest.java
@@ -0,0 +1,144 @@
+/*
+ * 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.streaming.runtime.operators.windowing;
+
+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.streaming.api.windowing.windows.GlobalWindow;
+import org.apache.flink.streaming.api.windowing.windows.TimeWindow;
+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;
+
+/**
+ * A {@link TypeSerializerUpgradeTestBase} for {@link TimeWindow.Serializer} 
and {@link GlobalWindow.Serializer}.
+ */
+@RunWith(Parameterized.class)
+public class WindowSerializerUpgradeTest extends 
TypeSerializerUpgradeTestBase<Object, Object> {
+
+       public WindowSerializerUpgradeTest(TestSpecification<Object, Object> 
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<>(
+                                       "time-window-serializer",
+                                       migrationVersion,
+                                       TimeWindowSerializerSetup.class,
+                                       TimeWindowSerializerVerifier.class));
+                       testSpecifications.add(
+                               new TestSpecification<>(
+                                       "global-window-serializer",
+                                       migrationVersion,
+                                       GlobalWindowSerializerSetup.class,
+                                       GlobalWindowSerializerVerifier.class));
+               }
+               return testSpecifications;
+       }
+
+       // 
----------------------------------------------------------------------------------------------
+       //  Specification for "time-window-serializer"
+       // 
----------------------------------------------------------------------------------------------
+       /**
+        * This class is only public to work with {@link 
org.apache.flink.api.common.typeutils.ClassRelocator}.
+        */
+       public static final class TimeWindowSerializerSetup implements 
TypeSerializerUpgradeTestBase.PreUpgradeSetup<TimeWindow> {
+               @Override
+               public TypeSerializer<TimeWindow> createPriorSerializer() {
+                       return new TimeWindow.Serializer();
+               }
+
+               @Override
+               public TimeWindow createTestData() {
+                       return new TimeWindow(12345, 67890);
+               }
+       }
+
+       /**
+        * This class is only public to work with {@link 
org.apache.flink.api.common.typeutils.ClassRelocator}.
+        */
+       public static final class TimeWindowSerializerVerifier implements 
TypeSerializerUpgradeTestBase.UpgradeVerifier<TimeWindow> {
+               @Override
+               public TypeSerializer<TimeWindow> createUpgradedSerializer() {
+                       return new TimeWindow.Serializer();
+               }
+
+               @Override
+               public Matcher<TimeWindow> testDataMatcher() {
+                       return is(new TimeWindow(12345, 67890));
+               }
+
+               @Override
+               public Matcher<TypeSerializerSchemaCompatibility<TimeWindow>> 
schemaCompatibilityMatcher(MigrationVersion version) {
+                       return TypeSerializerMatchers.isCompatibleAsIs();
+               }
+       }
+
+       // 
----------------------------------------------------------------------------------------------
+       //  Specification for "global-window-serializer"
+       // 
----------------------------------------------------------------------------------------------
+       /**
+        * This class is only public to work with {@link 
org.apache.flink.api.common.typeutils.ClassRelocator}.
+        */
+       public static final class GlobalWindowSerializerSetup implements 
TypeSerializerUpgradeTestBase.PreUpgradeSetup<GlobalWindow> {
+               @Override
+               public TypeSerializer<GlobalWindow> createPriorSerializer() {
+                       return new GlobalWindow.Serializer();
+               }
+
+               @Override
+               public GlobalWindow createTestData() {
+                       return GlobalWindow.get();
+               }
+       }
+
+       /**
+        * This class is only public to work with {@link 
org.apache.flink.api.common.typeutils.ClassRelocator}.
+        */
+       public static final class GlobalWindowSerializerVerifier implements 
TypeSerializerUpgradeTestBase.UpgradeVerifier<GlobalWindow> {
+               @Override
+               public TypeSerializer<GlobalWindow> createUpgradedSerializer() {
+                       return new GlobalWindow.Serializer();
+               }
+
+               @Override
+               public Matcher<GlobalWindow> testDataMatcher() {
+                       return is(GlobalWindow.get());
+               }
+
+               @Override
+               public Matcher<TypeSerializerSchemaCompatibility<GlobalWindow>> 
schemaCompatibilityMatcher(MigrationVersion version) {
+                       return TypeSerializerMatchers.isCompatibleAsIs();
+               }
+       }
+}
diff --git 
a/flink-streaming-java/src/test/resources/flink-1.6-global-window-serializer-data
 
b/flink-streaming-java/src/test/resources/flink-1.6-global-window-serializer-data
deleted file mode 100644
index cb43b5c..0000000
Binary files 
a/flink-streaming-java/src/test/resources/flink-1.6-global-window-serializer-data
 and /dev/null differ
diff --git 
a/flink-streaming-java/src/test/resources/flink-1.6-global-window-serializer-snapshot
 
b/flink-streaming-java/src/test/resources/flink-1.6-global-window-serializer-snapshot
deleted file mode 100644
index bb83337..0000000
Binary files 
a/flink-streaming-java/src/test/resources/flink-1.6-global-window-serializer-snapshot
 and /dev/null differ
diff --git 
a/flink-streaming-java/src/test/resources/flink-1.6-time-window-serializer-data 
b/flink-streaming-java/src/test/resources/flink-1.6-time-window-serializer-data
deleted file mode 100644
index 5ee28f7..0000000
Binary files 
a/flink-streaming-java/src/test/resources/flink-1.6-time-window-serializer-data 
and /dev/null differ
diff --git 
a/flink-streaming-java/src/test/resources/flink-1.6-time-window-serializer-snapshot
 
b/flink-streaming-java/src/test/resources/flink-1.6-time-window-serializer-snapshot
deleted file mode 100644
index 2f2f17b..0000000
Binary files 
a/flink-streaming-java/src/test/resources/flink-1.6-time-window-serializer-snapshot
 and /dev/null differ
diff --git 
a/flink-streaming-java/src/test/resources/flink-1.7-global-window-serializer-data
 
b/flink-streaming-java/src/test/resources/flink-1.7-global-window-serializer-data
deleted file mode 100644
index cb43b5c..0000000
Binary files 
a/flink-streaming-java/src/test/resources/flink-1.7-global-window-serializer-data
 and /dev/null differ
diff --git 
a/flink-streaming-java/src/test/resources/flink-1.7-global-window-serializer-snapshot
 
b/flink-streaming-java/src/test/resources/flink-1.7-global-window-serializer-snapshot
deleted file mode 100644
index 82a2fc0..0000000
Binary files 
a/flink-streaming-java/src/test/resources/flink-1.7-global-window-serializer-snapshot
 and /dev/null differ
diff --git 
a/flink-streaming-java/src/test/resources/flink-1.7-time-window-serializer-data 
b/flink-streaming-java/src/test/resources/flink-1.7-time-window-serializer-data
deleted file mode 100644
index 2d241e0..0000000
Binary files 
a/flink-streaming-java/src/test/resources/flink-1.7-time-window-serializer-data 
and /dev/null differ
diff --git 
a/flink-streaming-java/src/test/resources/flink-1.7-time-window-serializer-snapshot
 
b/flink-streaming-java/src/test/resources/flink-1.7-time-window-serializer-snapshot
deleted file mode 100644
index bed39b8..0000000
Binary files 
a/flink-streaming-java/src/test/resources/flink-1.7-time-window-serializer-snapshot
 and /dev/null differ

Reply via email to