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 2020/06/18 17:55:25 UTC

[GitHub] [geode] kirklund commented on a change in pull request #5257: GEODE-8251: make sure Configuration can be deserialized post 1.12.

kirklund commented on a change in pull request #5257:
URL: https://github.com/apache/geode/pull/5257#discussion_r442402889



##########
File path: geode-management/src/main/java/org/apache/geode/management/configuration/AbstractConfiguration.java
##########
@@ -47,7 +47,7 @@
 @Experimental
 public abstract class AbstractConfiguration<R extends RuntimeInfo>
     implements Identifiable<String>, JsonSerializable {
-
+  private static final long serialVersionUID = -6612840641128145954L;

Review comment:
       Optional: all JDK classes put serialVersionUID at the bottom of the class. I usually do this to try and be consistent but obviously doesn't matter much.

##########
File path: geode-core/src/upgradeTest/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgradeWithGfshDUnitTest.java
##########
@@ -0,0 +1,160 @@
+/*
+ * 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.rollingupgrade;
+
+/*
+ * 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.
+ */
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import org.apache.geode.internal.UniquePortSupplier;
+import org.apache.geode.test.compiler.ClassBuilder;
+import org.apache.geode.test.junit.categories.BackwardCompatibilityTest;
+import org.apache.geode.test.junit.rules.gfsh.GfshExecution;
+import org.apache.geode.test.junit.rules.gfsh.GfshRule;
+import org.apache.geode.test.junit.rules.gfsh.GfshScript;
+import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;
+import org.apache.geode.test.version.TestVersion;
+import org.apache.geode.test.version.VersionManager;
+
+/**
+ * This test iterates through the versions of Geode and executes client compatibility with
+ * the current version of Geode.
+ */
+@Category({BackwardCompatibilityTest.class})
+@RunWith(Parameterized.class)
+@Parameterized.UseParametersRunnerFactory(CategoryWithParameterizedRunnerFactory.class)
+public class RollingUpgradeWithGfshDUnitTest {
+  private final UniquePortSupplier portSupplier = new UniquePortSupplier();
+  private final String oldVersion;
+
+  @Parameterized.Parameters(name = "{0}")
+  public static Collection<String> data() {
+    List<String> result = VersionManager.getInstance().getVersionsWithoutCurrent();
+    result.removeIf(s -> TestVersion.compare(s, "1.10.0") < 0);
+    return result;
+  }
+
+  @Rule
+  public GfshRule oldGfsh;
+
+  @Rule
+  public GfshRule currentGfsh = new GfshRule();
+
+  @Rule
+  public TemporaryFolder tempFolder = new TemporaryFolder();
+
+  public RollingUpgradeWithGfshDUnitTest(String version) {
+    oldVersion = version;
+    oldGfsh = new GfshRule(oldVersion);
+  }
+
+  @Test
+  public void testRollingUpgradeWithDeployment() throws Exception {
+    int locatorPort = portSupplier.getAvailablePort();
+    int locatorJmxPort = portSupplier.getAvailablePort();
+    int locator2Port = portSupplier.getAvailablePort();
+    int locator2JmxPort = portSupplier.getAvailablePort();
+    int server1Port = portSupplier.getAvailablePort();
+    int server2Port = portSupplier.getAvailablePort();
+
+    GfshExecution startupExecution =
+        GfshScript.of(startLocatorCommand("loc1", locatorPort, locatorJmxPort, -1))
+            .and(startLocatorCommand("loc2", locator2Port, locator2JmxPort, locatorPort))
+            .and(startServerCommand("server1", server1Port, locatorPort))
+            .and(startServerCommand("server2", server2Port, locatorPort))
+            .and(deployDirCommand())
+            .execute(oldGfsh);
+
+    // doing rolling upgrades
+    oldGfsh.stopLocator(startupExecution, "loc1");
+    GfshScript.of(startLocatorCommand("loc1", locatorPort, locatorJmxPort, locator2Port))
+        .execute(currentGfsh);
+    verifyListDeployed(locatorPort);
+
+    oldGfsh.stopLocator(startupExecution, "loc2");
+    GfshScript.of(startLocatorCommand("loc2", locator2Port, locator2JmxPort, locatorPort))
+        .execute(currentGfsh);
+    verifyListDeployed(locator2Port);
+
+    // make sure servers can do rolling upgrade too
+    oldGfsh.stopServer(startupExecution, "server1");
+    GfshScript.of(startServerCommand("server1", server1Port, locatorPort)).execute(currentGfsh);
+
+    oldGfsh.stopServer(startupExecution, "server2");
+    GfshScript.of(startServerCommand("server2", server2Port, locatorPort)).execute(currentGfsh);
+  }
+
+  private void verifyListDeployed(int locatorPort) {
+    GfshExecution list_deployed = GfshScript.of("connect --locator=localhost[" + locatorPort + "]")
+        .and("list deployed").execute(currentGfsh);
+    assertThat(list_deployed.getOutputText()).contains("DeployCommandsDUnit1.jar")
+        .contains("server1").contains("server2");
+    currentGfsh.execute("disconnect");
+  }
+
+  private String deployDirCommand() throws IOException {
+    ClassBuilder classBuilder = new ClassBuilder();
+    File jarsDir = tempFolder.newFolder();
+    String jarName1 = "DeployCommandsDUnit1.jar";
+    File jar1 = new File(jarsDir, jarName1);
+    String class1 = "DeployCommandsDUnitA";
+    classBuilder.writeJarFromName(class1, jar1);
+    return "deploy --dir=" + jarsDir.getAbsolutePath();
+  }
+
+  protected String startServerCommand(String name, int port, int connectedLocatorPort) {

Review comment:
       Is there a subclass? I'd like to see these `protected` methods be `private` if possible.

##########
File path: geode-core/src/upgradeTest/java/org/apache/geode/internal/cache/rollingupgrade/RollingUpgradeWithGfshDUnitTest.java
##########
@@ -0,0 +1,160 @@
+/*
+ * 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.rollingupgrade;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license

Review comment:
       You accidentally have the license header in this class twice.




----------------------------------------------------------------
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.

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