geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [1/6] incubator-geode git commit: GEODE-1360: Enabling to specify log4j2.xml for test in gradle
Date Wed, 11 May 2016 17:19:56 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-1376 b9b0757fa -> c3906859a


GEODE-1360: Enabling to specify log4j2.xml for test in gradle

Product code has built in log4j's trace log. However there's no command line
parameter to turn on it. This fix let gradlew to transfer the system property
to unit test framework, and let unit test framework to set it in run-time jvm.


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

Branch: refs/heads/feature/GEODE-1376
Commit: 036c931705fab5122a81a446d67e4ab5bc6620b7
Parents: 9a77054
Author: zhouxh <gzhou@pivotal.io>
Authored: Mon May 9 17:03:15 2016 -0700
Committer: zhouxh <gzhou@pivotal.io>
Committed: Tue May 10 14:21:39 2016 -0700

----------------------------------------------------------------------
 .../test/dunit/standalone/DUnitLauncher.java    |  2 +
 .../test/dunit/standalone/ProcessManager.java   | 45 ++++++++++++--------
 gradle/test.gradle                              |  4 ++
 3 files changed, 34 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/036c9317/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/DUnitLauncher.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/DUnitLauncher.java
b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/DUnitLauncher.java
index 0c294ec..4e7095c 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/DUnitLauncher.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/DUnitLauncher.java
@@ -76,6 +76,8 @@ public class DUnitLauncher {
   /** change this to use a different log level in unit tests */
   public static final String LOG_LEVEL = System.getProperty("logLevel", "info");
   
+  public static final String LOG4J = System.getProperty("log4j.configurationFile");
+  
   static int locatorPort;
 
   private static final int NUM_VMS = 4;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/036c9317/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/ProcessManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/ProcessManager.java
b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/ProcessManager.java
index dd532c4..5dbdfd6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/ProcessManager.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/standalone/ProcessManager.java
@@ -28,6 +28,7 @@ import java.rmi.AccessException;
 import java.rmi.NotBoundException;
 import java.rmi.RemoteException;
 import java.rmi.registry.Registry;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
@@ -161,23 +162,33 @@ public class ProcessManager {
     }
 
     String jdkSuspend = vmNum == suspendVM ? "y" : "n";
-
-    return new String[] {
-      cmd, "-classpath", classPath,
-      "-D" + DUnitLauncher.RMI_PORT_PARAM + "=" + namingPort,
-      "-D" + DUnitLauncher.VM_NUM_PARAM + "=" + vmNum,
-      "-D" + DUnitLauncher.WORKSPACE_DIR_PARAM + "=" + new File(".").getAbsolutePath(),
-      "-DlogLevel=" + DUnitLauncher.LOG_LEVEL,
-      "-Djava.library.path=" + System.getProperty("java.library.path"),
-      "-Xrunjdwp:transport=dt_socket,server=y,suspend=" + jdkSuspend + jdkDebug,
-      "-XX:+HeapDumpOnOutOfMemoryError",
-      "-Xmx512m",
-      "-Dgemfire.DEFAULT_MAX_OPLOG_SIZE=10",
-      "-Dgemfire.disallowMcastDefaults=true",
-      "-ea", "-XX:+PrintGC", "-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps",
-      agent,
-      ChildVM.class.getName()
-    };
+    ArrayList<String> cmds = new ArrayList<String>();
+    cmds.add(cmd);
+    cmds.add("-classpath"); 
+    cmds.add(classPath);
+    cmds.add("-D" + DUnitLauncher.RMI_PORT_PARAM + "=" + namingPort);
+    cmds.add("-D" + DUnitLauncher.VM_NUM_PARAM + "=" + vmNum);
+    cmds.add("-D" + DUnitLauncher.WORKSPACE_DIR_PARAM + "=" + new File(".").getAbsolutePath());
+    cmds.add("-DlogLevel=" + DUnitLauncher.LOG_LEVEL);
+    if (DUnitLauncher.LOG4J!=null) {
+      cmds.add("-Dlog4j.configurationFile="+DUnitLauncher.LOG4J);
+    }
+    cmds.add("-Djava.library.path=" + System.getProperty("java.library.path"));
+    cmds.add("-Xrunjdwp:transport=dt_socket,server=y,suspend=" + jdkSuspend + jdkDebug);
+    cmds.add("-XX:+HeapDumpOnOutOfMemoryError");
+    cmds.add("-Xmx512m");
+    cmds.add("-Dgemfire.DEFAULT_MAX_OPLOG_SIZE=10");
+    cmds.add("-Dgemfire.disallowMcastDefaults=true");
+    cmds.add("-ea");
+    cmds.add("-XX:+PrintGC");
+    cmds.add("-XX:+PrintGCDetails");
+    cmds.add("-XX:+PrintGCTimeStamps");
+    cmds.add(agent);
+    cmds.add(ChildVM.class.getName());
+    String[] rst = new String[cmds.size()];
+    cmds.toArray(rst);
+    
+    return rst;
   }
   
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/036c9317/gradle/test.gradle
----------------------------------------------------------------------
diff --git a/gradle/test.gradle b/gradle/test.gradle
index 2dd7521..96fbfc5 100644
--- a/gradle/test.gradle
+++ b/gradle/test.gradle
@@ -211,6 +211,10 @@ subprojects {
         if (logLevel != null) {
           systemProperty 'logLevel', logLevel
         }
+        def log4jLocation = System.getProperty('log4j.configurationFile')
+        if (log4jLocation != null) {
+          systemProperty 'log4j.configurationFile', log4jLocation
+        }
 
         def eol = System.getProperty('line.separator')
         def progress = new File(resultsDir, "$test.name-progress.txt")


Mime
View raw message