geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject geode git commit: GEODE-3139 remove current artifacts from classpath of backward-compatibility tests
Date Fri, 30 Jun 2017 15:59:42 GMT
Repository: geode
Updated Branches:
  refs/heads/develop a1583458e -> cc66a1e49


GEODE-3139 remove current artifacts from classpath of backward-compatibility tests

This removes the geode-core product artifacts from old-version JVM classpaths
for backward-compatibility testing.  I had to change the distributed test
framework to not refer to InternalClientCache but surprisingly that caused
no compilation failures.


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/cc66a1e4
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/cc66a1e4
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/cc66a1e4

Branch: refs/heads/develop
Commit: cc66a1e4925860f7d13af987b5656d6baf2d6ff4
Parents: a158345
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Fri Jun 30 08:49:05 2017 -0700
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Fri Jun 30 08:59:34 2017 -0700

----------------------------------------------------------------------
 .../cache/internal/JUnit3CacheTestCase.java     |  2 +-
 .../cache/internal/JUnit4CacheTestCase.java     |  2 +-
 .../geode/test/dunit/standalone/ChildVM.java    |  4 ++-
 .../test/dunit/standalone/ProcessManager.java   | 37 ++++++++++++++++----
 4 files changed, 35 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/cc66a1e4/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit3CacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit3CacheTestCase.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit3CacheTestCase.java
index 917361f..73d4042 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit3CacheTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit3CacheTestCase.java
@@ -101,7 +101,7 @@ public abstract class JUnit3CacheTestCase extends JUnit3DistributedTestCase
    *
    * @since GemFire 6.5
    */
-  public final InternalClientCache getClientCache(final ClientCacheFactory factory) {
+  public final ClientCache getClientCache(final ClientCacheFactory factory) {
     return delegate.getClientCache(factory);
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/cc66a1e4/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
index 8629749..bf77be3 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java
@@ -290,7 +290,7 @@ public abstract class JUnit4CacheTestCase extends JUnit4DistributedTestCase
    *
    * @since GemFire 6.5
    */
-  public final InternalClientCache getClientCache(final ClientCacheFactory factory) {
+  public final ClientCache getClientCache(final ClientCacheFactory factory) {
     synchronized (JUnit4CacheTestCase.class) {
       final GemFireCacheImpl gemFireCache = GemFireCacheImpl.getInstance();
       if (gemFireCache != null && !gemFireCache.isClosed()

http://git-wip-us.apache.org/repos/asf/geode/blob/cc66a1e4/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ChildVM.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ChildVM.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ChildVM.java
index 634e09f..d54f3d0 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ChildVM.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ChildVM.java
@@ -17,6 +17,7 @@ package org.apache.geode.test.dunit.standalone;
 import java.rmi.Naming;
 
 import org.apache.geode.internal.OSProcess;
+import org.apache.geode.internal.Version;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
@@ -48,7 +49,8 @@ public class ChildVM {
       int pid = OSProcess.getId();
       logger.info("VM" + vmNum + " is launching" + (pid > 0 ? " with PID " + pid : ""));
       if (!VersionManager.isCurrentVersion(geodeVersion)) {
-        logger.info("This VM is using Geode version {}", geodeVersion);
+        logger.info("This VM is using Geode version {}. Version.CURRENT is {}", geodeVersion,
+            Version.CURRENT);
       }
       MasterRemote holder = (MasterRemote) Naming
           .lookup("//localhost:" + namingPort + "/" + DUnitLauncher.MASTER_PARAM);

http://git-wip-us.apache.org/repos/asf/geode/blob/cc66a1e4/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
index 21b79e8..9e62484 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/ProcessManager.java
@@ -172,11 +172,32 @@ public class ProcessManager {
   private String[] buildJavaCommand(int vmNum, int namingPort, String version) {
     String cmd = System.getProperty("java.home") + File.separator + "bin" + File.separator
+ "java";
     String dunitClasspath = System.getProperty("java.class.path");
+    String separator = File.separator;
     String classPath;
-    if (!VersionManager.isCurrentVersion(version)) {
-      classPath = versionManager.getClasspath(version) + File.pathSeparator + dunitClasspath;
-    } else {
+    if (VersionManager.isCurrentVersion(version)) {
       classPath = dunitClasspath;
+    } else {
+      // remove current-version product classes and resources from the classpath
+      String buildDir = separator + "geode-core" + separator + "build" + separator;
+
+      String mainClasses = buildDir + "classes" + separator + "main";
+      dunitClasspath = removeFromPath(dunitClasspath, mainClasses);
+
+      String mainResources = buildDir + "resources" + separator + "main";
+      dunitClasspath = removeFromPath(dunitClasspath, mainResources);
+
+      String generatedResources = buildDir + "generated-resources" + separator + "main";
+      dunitClasspath = removeFromPath(dunitClasspath, generatedResources);
+
+      buildDir = separator + "geode-common" + separator + "build" + separator + "classes"
+          + separator + "main";
+      dunitClasspath = removeFromPath(dunitClasspath, buildDir);
+
+      buildDir = separator + "geode-json" + separator + "build" + separator + "classes" +
separator
+          + "main";
+      dunitClasspath = removeFromPath(dunitClasspath, buildDir);
+
+      classPath = versionManager.getClasspath(version) + File.pathSeparator + dunitClasspath;
     }
 
     // String tmpDir = System.getProperty("java.io.tmpdir");
@@ -192,7 +213,8 @@ public class ProcessManager {
     ArrayList<String> cmds = new ArrayList<String>();
     cmds.add(cmd);
     cmds.add("-classpath");
-    classPath = removeJREJars(classPath);
+    String jreLib = separator + "jre" + separator + "lib" + separator;
+    classPath = removeFromPath(classPath, jreLib);
     cmds.add(classPath);
     cmds.add("-D" + DUnitLauncher.RMI_PORT_PARAM + "=" + namingPort);
     cmds.add("-D" + DUnitLauncher.VM_NUM_PARAM + "=" + vmNum);
@@ -208,6 +230,8 @@ public class ProcessManager {
       // detection should create a separate locator that has it enabled
       cmds.add(
           "-D" + DistributionConfig.GEMFIRE_PREFIX + ENABLE_NETWORK_PARTITION_DETECTION +
"=false");
+      cmds.add(
+          "-D" + DistributionConfig.GEMFIRE_PREFIX + "allow_old_members_to_join_for_testing=true");
     }
     cmds.add("-D" + LOG_LEVEL + "=" + DUnitLauncher.logLevel);
     if (DUnitLauncher.LOG4J != null) {
@@ -233,13 +257,12 @@ public class ProcessManager {
     return rst;
   }
 
-  private String removeJREJars(String classpath) {
+  private String removeFromPath(String classpath, String partialPath) {
     String[] jars = classpath.split(File.pathSeparator);
     StringBuilder sb = new StringBuilder(classpath.length());
-    String jreLib = File.separator + "jre" + File.separator + "lib" + File.separator;
     Boolean firstjar = true;
     for (String jar : jars) {
-      if (!jar.contains(jreLib)) {
+      if (!jar.contains(partialPath)) {
         if (!firstjar) {
           sb.append(File.pathSeparator);
         }


Mime
View raw message