geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aging...@apache.org
Subject [09/50] [abbrv] incubator-geode git commit: GEODE-1360: Enabling to specify log4j2.xml for test in gradle
Date Tue, 17 May 2016 00:38:18 GMT
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/48ceecef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/48ceecef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/48ceecef

Branch: refs/heads/feature/GEODE-1209
Commit: 48ceecef0a528ae77114b348c67dfbc8ee6d6c4e
Parents: 6ed3986
Author: zhouxh <gzhou@pivotal.io>
Authored: Mon May 9 17:03:15 2016 -0700
Committer: Anil <agingade@pivotal.io>
Committed: Mon May 16 17:31:53 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/48ceecef/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/48ceecef/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/48ceecef/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