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 c6c34c11bda8b9d854e275e776e29c3f0ac5e490
Author: klion26 <[email protected]>
AuthorDate: Thu Apr 2 23:44:44 2020 +0800

    [FLINK-13632] Port LockableTypeSerializer upgrade test to 
TypeSerializerUpgradeTestBase
---
 .../flink/cep/nfa/sharedbuffer/Lockable.java       |   2 +-
 ...ockableTypeSerializerSnapshotMigrationTest.java |  56 -----------
 .../LockableTypeSerializerUpgradeTest.java         | 102 +++++++++++++++++++++
 .../flink-1.6-lockable-type-serializer-data        | Bin 160 -> 0 bytes
 .../flink-1.6-lockable-type-serializer-snapshot    | Bin 561 -> 0 bytes
 .../flink-1.7-lockable-type-serializer-data        | Bin 160 -> 0 bytes
 .../flink-1.7-lockable-type-serializer-snapshot    | Bin 241 -> 0 bytes
 7 files changed, 103 insertions(+), 57 deletions(-)

diff --git 
a/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/Lockable.java
 
b/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/Lockable.java
index 4dc6a27..8dd5d70 100644
--- 
a/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/Lockable.java
+++ 
b/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/Lockable.java
@@ -100,7 +100,7 @@ public final class Lockable<T> {
                private static final long serialVersionUID = 
3298801058463337340L;
                private final TypeSerializer<E> elementSerializer;
 
-               LockableTypeSerializer(TypeSerializer<E> elementSerializer) {
+               public LockableTypeSerializer(TypeSerializer<E> 
elementSerializer) {
                        this.elementSerializer = elementSerializer;
                }
 
diff --git 
a/flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/sharedbuffer/LockableTypeSerializerSnapshotMigrationTest.java
 
b/flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/sharedbuffer/LockableTypeSerializerSnapshotMigrationTest.java
deleted file mode 100644
index 4682617..0000000
--- 
a/flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/sharedbuffer/LockableTypeSerializerSnapshotMigrationTest.java
+++ /dev/null
@@ -1,56 +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.cep.nfa.sharedbuffer;
-
-import 
org.apache.flink.api.common.typeutils.TypeSerializerSnapshotMigrationTestBase;
-import org.apache.flink.api.common.typeutils.base.StringSerializer;
-import org.apache.flink.testutils.migration.MigrationVersion;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.util.Collection;
-
-/**
- * Migration test for the {@link LockableTypeSerializerSnapshot}.
- */
-@RunWith(Parameterized.class)
-public class LockableTypeSerializerSnapshotMigrationTest extends 
TypeSerializerSnapshotMigrationTestBase<Lockable<String>> {
-
-       private static final String SPEC_NAME = "lockable-type-serializer";
-
-       public 
LockableTypeSerializerSnapshotMigrationTest(TestSpecification<Lockable<String>> 
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(
-                       SPEC_NAME,
-                       Lockable.LockableTypeSerializer.class,
-                       LockableTypeSerializerSnapshot.class,
-                       () -> new 
Lockable.LockableTypeSerializer<>(StringSerializer.INSTANCE));
-
-               return testSpecifications.get();
-       }
-}
diff --git 
a/flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/sharedbuffer/LockableTypeSerializerUpgradeTest.java
 
b/flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/sharedbuffer/LockableTypeSerializerUpgradeTest.java
new file mode 100644
index 0000000..1c7f9c7
--- /dev/null
+++ 
b/flink-libraries/flink-cep/src/test/java/org/apache/flink/cep/nfa/sharedbuffer/LockableTypeSerializerUpgradeTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.cep.nfa.sharedbuffer;
+
+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.StringSerializer;
+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 
Lockable.LockableTypeSerializer}.
+ */
+@RunWith(Parameterized.class)
+public class LockableTypeSerializerUpgradeTest extends 
TypeSerializerUpgradeTestBase<Lockable<String>, Lockable<String>> {
+
+       private static final String SPEC_NAME = "lockable-type-serializer";
+
+       public 
LockableTypeSerializerUpgradeTest(TestSpecification<Lockable<String>, 
Lockable<String>> 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<>(
+                                       SPEC_NAME,
+                                       migrationVersion,
+                                       LockableTypeSerializerSetup.class,
+                                       LockableTypeSerializerVerifier.class));
+               }
+               return testSpecifications;
+       }
+
+       // 
----------------------------------------------------------------------------------------------
+       //  Specification for "lockabletype-serializer"
+       // 
----------------------------------------------------------------------------------------------
+
+       /**
+        * This class is only public to work with {@link 
org.apache.flink.api.common.typeutils.ClassRelocator}.
+        */
+       public static final class LockableTypeSerializerSetup implements 
TypeSerializerUpgradeTestBase.PreUpgradeSetup<Lockable<String>> {
+               @Override
+               public TypeSerializer<Lockable<String>> createPriorSerializer() 
{
+                       return new 
Lockable.LockableTypeSerializer<>(StringSerializer.INSTANCE);
+               }
+
+               @Override
+               public Lockable<String> createTestData() {
+                       return new Lockable<>("flink", 10);
+               }
+       }
+
+       /**
+        * This class is only public to work with {@link 
org.apache.flink.api.common.typeutils.ClassRelocator}.
+        */
+       public static final class LockableTypeSerializerVerifier implements 
TypeSerializerUpgradeTestBase.UpgradeVerifier<Lockable<String>> {
+               @Override
+               public TypeSerializer<Lockable<String>> 
createUpgradedSerializer() {
+                       return new 
Lockable.LockableTypeSerializer<>(StringSerializer.INSTANCE);
+               }
+
+               @Override
+               public Matcher<Lockable<String>> testDataMatcher() {
+                       return is(new Lockable<>("flink", 10));
+               }
+
+               @Override
+               public 
Matcher<TypeSerializerSchemaCompatibility<Lockable<String>>> 
schemaCompatibilityMatcher(MigrationVersion version) {
+                       return TypeSerializerMatchers.isCompatibleAsIs();
+               }
+       }
+}
diff --git 
a/flink-libraries/flink-cep/src/test/resources/flink-1.6-lockable-type-serializer-data
 
b/flink-libraries/flink-cep/src/test/resources/flink-1.6-lockable-type-serializer-data
deleted file mode 100644
index b175040..0000000
Binary files 
a/flink-libraries/flink-cep/src/test/resources/flink-1.6-lockable-type-serializer-data
 and /dev/null differ
diff --git 
a/flink-libraries/flink-cep/src/test/resources/flink-1.6-lockable-type-serializer-snapshot
 
b/flink-libraries/flink-cep/src/test/resources/flink-1.6-lockable-type-serializer-snapshot
deleted file mode 100644
index 3d9fa0c..0000000
Binary files 
a/flink-libraries/flink-cep/src/test/resources/flink-1.6-lockable-type-serializer-snapshot
 and /dev/null differ
diff --git 
a/flink-libraries/flink-cep/src/test/resources/flink-1.7-lockable-type-serializer-data
 
b/flink-libraries/flink-cep/src/test/resources/flink-1.7-lockable-type-serializer-data
deleted file mode 100644
index b175040..0000000
Binary files 
a/flink-libraries/flink-cep/src/test/resources/flink-1.7-lockable-type-serializer-data
 and /dev/null differ
diff --git 
a/flink-libraries/flink-cep/src/test/resources/flink-1.7-lockable-type-serializer-snapshot
 
b/flink-libraries/flink-cep/src/test/resources/flink-1.7-lockable-type-serializer-snapshot
deleted file mode 100644
index 42b3d45..0000000
Binary files 
a/flink-libraries/flink-cep/src/test/resources/flink-1.7-lockable-type-serializer-snapshot
 and /dev/null differ

Reply via email to