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 054572b31d5a472450a04f21b6d9e25db9820eff Author: klion26 <[email protected]> AuthorDate: Sat Feb 15 21:25:12 2020 +0800 [FLINK-13632] Port LongValueWithProperHashCodeSerializer upgrade test to TypeSerializerUpgradeTestBase --- ...perHashCodeSerializerSnapshotMigrationTest.java | 55 ----------- ...lueWithProperHashCodeSerializerUpgradeTest.java | 101 +++++++++++++++++++++ ...ong-value-with-proper-hash-code-serializer-data | Bin 80 -> 0 bytes ...value-with-proper-hash-code-serializer-snapshot | Bin 488 -> 0 bytes ...ong-value-with-proper-hash-code-serializer-data | Bin 80 -> 0 bytes ...value-with-proper-hash-code-serializer-snapshot | Bin 476 -> 0 bytes 6 files changed, 101 insertions(+), 55 deletions(-) diff --git a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/drivers/transform/LongValueWithProperHashCodeSerializerSnapshotMigrationTest.java b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/drivers/transform/LongValueWithProperHashCodeSerializerSnapshotMigrationTest.java deleted file mode 100644 index d996f22..0000000 --- a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/drivers/transform/LongValueWithProperHashCodeSerializerSnapshotMigrationTest.java +++ /dev/null @@ -1,55 +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.graph.drivers.transform; - -import org.apache.flink.api.common.typeutils.TypeSerializerSnapshotMigrationTestBase; -import org.apache.flink.testutils.migration.MigrationVersion; - -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.util.Collection; - -/** - * Migration tests for {@link LongValueWithProperHashCode.LongValueWithProperHashCodeSerializer}. - */ -@RunWith(Parameterized.class) -public class LongValueWithProperHashCodeSerializerSnapshotMigrationTest - extends TypeSerializerSnapshotMigrationTestBase<LongValueWithProperHashCode> { - - public LongValueWithProperHashCodeSerializerSnapshotMigrationTest( - TestSpecification<LongValueWithProperHashCode> 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( - "long-value-with-proper-hash-code-serializer", - LongValueWithProperHashCode.LongValueWithProperHashCodeSerializer.class, - LongValueWithProperHashCode.LongValueWithProperHashCodeSerializer.LongValueWithProperHashCodeSerializerSnapshot.class, - LongValueWithProperHashCode.LongValueWithProperHashCodeSerializer::new); - - return testSpecifications.get(); - } -} diff --git a/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/drivers/transform/LongValueWithProperHashCodeSerializerUpgradeTest.java b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/drivers/transform/LongValueWithProperHashCodeSerializerUpgradeTest.java new file mode 100644 index 0000000..75bb817 --- /dev/null +++ b/flink-libraries/flink-gelly-examples/src/test/java/org/apache/flink/graph/drivers/transform/LongValueWithProperHashCodeSerializerUpgradeTest.java @@ -0,0 +1,101 @@ +/* + * 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.graph.drivers.transform; + +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.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 LongValueWithProperHashCode.LongValueWithProperHashCodeSerializer}. + */ +@RunWith(Parameterized.class) +public class LongValueWithProperHashCodeSerializerUpgradeTest + extends TypeSerializerUpgradeTestBase<LongValueWithProperHashCode, LongValueWithProperHashCode> { + + public LongValueWithProperHashCodeSerializerUpgradeTest( + TestSpecification<LongValueWithProperHashCode, LongValueWithProperHashCode> 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<>( + "long-value-with-proper-hash-code-serializer", + migrationVersion, + LongValueWithProperHashCodeSerializerSetup.class, + LongValueWithProperHashCodeSerializerVerifier.class)); + } + return testSpecifications; + } + + // ---------------------------------------------------------------------------------------------- + // Specification for "long-value-with-proper-hash-code-serializer" + // ---------------------------------------------------------------------------------------------- + + /** + * This class is only public to work with {@link org.apache.flink.api.common.typeutils.ClassRelocator}. + */ + public static final class LongValueWithProperHashCodeSerializerSetup implements TypeSerializerUpgradeTestBase.PreUpgradeSetup<LongValueWithProperHashCode> { + @Override + public TypeSerializer<LongValueWithProperHashCode> createPriorSerializer() { + return new LongValueWithProperHashCode.LongValueWithProperHashCodeSerializer(); + } + + @Override + public LongValueWithProperHashCode createTestData() { + return new LongValueWithProperHashCode(12345); + } + } + + /** + * This class is only public to work with {@link org.apache.flink.api.common.typeutils.ClassRelocator}. + */ + public static final class LongValueWithProperHashCodeSerializerVerifier implements TypeSerializerUpgradeTestBase.UpgradeVerifier<LongValueWithProperHashCode> { + @Override + public TypeSerializer<LongValueWithProperHashCode> createUpgradedSerializer() { + return new LongValueWithProperHashCode.LongValueWithProperHashCodeSerializer(); + } + + @Override + public Matcher<LongValueWithProperHashCode> testDataMatcher() { + return is(new LongValueWithProperHashCode(12345)); + } + + @Override + public Matcher<TypeSerializerSchemaCompatibility<LongValueWithProperHashCode>> schemaCompatibilityMatcher(MigrationVersion version) { + return TypeSerializerMatchers.isCompatibleAsIs(); + } + } +} diff --git a/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.6-long-value-with-proper-hash-code-serializer-data b/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.6-long-value-with-proper-hash-code-serializer-data deleted file mode 100644 index f3e06a4..0000000 Binary files a/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.6-long-value-with-proper-hash-code-serializer-data and /dev/null differ diff --git a/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.6-long-value-with-proper-hash-code-serializer-snapshot b/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.6-long-value-with-proper-hash-code-serializer-snapshot deleted file mode 100644 index 5aaf88b..0000000 Binary files a/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.6-long-value-with-proper-hash-code-serializer-snapshot and /dev/null differ diff --git a/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.7-long-value-with-proper-hash-code-serializer-data b/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.7-long-value-with-proper-hash-code-serializer-data deleted file mode 100644 index f3e06a4..0000000 Binary files a/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.7-long-value-with-proper-hash-code-serializer-data and /dev/null differ diff --git a/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.7-long-value-with-proper-hash-code-serializer-snapshot b/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.7-long-value-with-proper-hash-code-serializer-snapshot deleted file mode 100644 index 28104ca..0000000 Binary files a/flink-libraries/flink-gelly-examples/src/test/resources/flink-1.7-long-value-with-proper-hash-code-serializer-snapshot and /dev/null differ
