You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2017/02/03 01:43:12 UTC
geode git commit: GEODE-2386 Don't call System.setProperties(null)
when rule is used twice
Repository: geode
Updated Branches:
refs/heads/feature/GEODE-2386 [created] c0563650a
GEODE-2386 Don't call System.setProperties(null) when rule is used twice
Fixing DistributedRestoreSystemProperties rule so that if the rule is
included twice within a test, it does not end up calling
System.setProperties(null). That will prevent us from losing the value
of java.class.path set by gradle.
Reverting the workaround that didn't actually work.
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/c0563650
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/c0563650
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/c0563650
Branch: refs/heads/feature/GEODE-2386
Commit: c0563650a98b4208a4d0f53d72597170b5ef31d0
Parents: c6fa2b9
Author: Dan Smith <up...@apache.org>
Authored: Thu Feb 2 13:34:13 2017 -0800
Committer: Dan Smith <up...@apache.org>
Committed: Thu Feb 2 14:43:00 2017 -0800
----------------------------------------------------------------------
.../DistributedRestoreSystemProperties.java | 12 ++++++++----
.../test/dunit/standalone/ProcessManager.java | 20 +-------------------
2 files changed, 9 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/c0563650/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRestoreSystemProperties.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRestoreSystemProperties.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRestoreSystemProperties.java
index 7e6198e..9b4c8bd 100755
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRestoreSystemProperties.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRestoreSystemProperties.java
@@ -49,8 +49,10 @@ public class DistributedRestoreSystemProperties extends RestoreSystemProperties
this.invoker.invokeInEveryVM(new SerializableRunnable() {
@Override
public void run() {
- originalProperties = getProperties();
- setProperties(new Properties(originalProperties));
+ if(originalProperties == null) {
+ originalProperties = getProperties();
+ setProperties(new Properties(originalProperties));
+ }
}
});
}
@@ -61,8 +63,10 @@ public class DistributedRestoreSystemProperties extends RestoreSystemProperties
this.invoker.invokeInEveryVM(new SerializableRunnable() {
@Override
public void run() {
- setProperties(originalProperties);
- originalProperties = null;
+ if(originalProperties != null) {
+ setProperties(originalProperties);
+ originalProperties = null;
+ }
}
});
}
http://git-wip-us.apache.org/repos/asf/geode/blob/c0563650/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 3b02b4b..d7b15fc 100644
--- 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
@@ -16,8 +16,6 @@ package org.apache.geode.test.dunit.standalone;
import static org.apache.geode.distributed.ConfigurationProperties.*;
-import com.jayway.awaitility.Awaitility;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -34,7 +32,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
-import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
@@ -174,7 +171,7 @@ 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 = getClasspath();
+ String dunitClasspath = System.getProperty("java.class.path");
String classPath;
if (!VersionManager.isCurrentVersion(version)) {
classPath = versionManager.getClasspath(version) + File.pathSeparator + dunitClasspath;
@@ -236,21 +233,6 @@ public class ProcessManager {
return rst;
}
- private String getClasspath() {
- String classpath = System.getProperty("java.class.path");
- // Workaround for GEODE-2386
- long endTime = System.nanoTime() + TimeUnit.SECONDS.toNanos(30);
- while (classpath.contains("gradle-worker.jar") && System.nanoTime() < endTime) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // do nothing
- }
- classpath = System.getProperty("java.class.path");
- }
- return classpath;
- }
-
private String removeJREJars(String classpath) {
String[] jars = classpath.split(File.pathSeparator);
StringBuilder sb = new StringBuilder(classpath.length());