You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2022/04/05 19:38:46 UTC

[GitHub] [geode] jinmeiliao commented on a diff in pull request #7529: GEODE-10203: SerialVersionUID added.

jinmeiliao commented on code in PR #7529:
URL: https://github.com/apache/geode/pull/7529#discussion_r843194258


##########
geode-core/src/upgradeTest/java/org/apache/geode/internal/cache/GetClusterConfigurationFunctionCompatibilityTest.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.geode.internal.cache;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.AvailablePortHelper;
+import org.apache.geode.management.internal.configuration.functions.GetClusterConfigurationFunction;
+import org.apache.geode.test.dunit.rules.ClusterStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.categories.BackwardCompatibilityTest;
+import org.apache.geode.test.version.TestVersion;
+import org.apache.geode.test.version.VersionManager;
+
+@Category({BackwardCompatibilityTest.class})
+@RunWith(Parameterized.class)
+public class GetClusterConfigurationFunctionCompatibilityTest {
+
+  private final String oldVersion;
+
+  @Parameterized.Parameters(name = "Version: {0}")
+  public static Collection<String> data() {
+    List<String> result = VersionManager.getInstance().getVersionsWithoutCurrent();
+    result.removeIf(s -> TestVersion.compare(s, "1.12.0") < 0);
+    return result;
+  }
+
+  public GetClusterConfigurationFunctionCompatibilityTest(String oldVersion) {
+    this.oldVersion = oldVersion;
+  }
+
+  @Rule
+  public ClusterStartupRule clusterStartupRule = new ClusterStartupRule();
+
+  /*
+   * The goal of the test is that GetClusterConfigurationFunction can be
+   * deserialized in the old versions members
+   * Changes to the class can cause the serialVersionUUID to change which
+   * can cause the serialization to fail in old members.
+   */
+  @Test
+  public void newLocatorCanGetClusterConfigurationFromOldLocator() {
+    // Start locators in old version
+    MemberVM locator1 = clusterStartupRule.startLocatorVM(0, oldVersion);
+    int locator1Port = locator1.getPort();
+    MemberVM locator2 =
+        clusterStartupRule.startLocatorVM(1, AvailablePortHelper.getRandomAvailableTCPPort(),

Review Comment:
   the rule already uses random port, so no need for the 2nd param.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@geode.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org