[jboss-cvs] JBossAS SVN: r114804 - branches/JBPAPP_5/testsuite/src/main/org/jboss/test/scripts/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 15 08:00:57 EDT 2014


Author: pjelinek
Date: 2014-04-15 08:00:56 -0400 (Tue, 15 Apr 2014)
New Revision: 114804

Modified:
   branches/JBPAPP_5/testsuite/src/main/org/jboss/test/scripts/test/RunTestCase.java
Log:
JBPAPP-11126 on behalf of pkremens at redhat.com

Modified: branches/JBPAPP_5/testsuite/src/main/org/jboss/test/scripts/test/RunTestCase.java
===================================================================
--- branches/JBPAPP_5/testsuite/src/main/org/jboss/test/scripts/test/RunTestCase.java	2014-04-14 13:53:59 UTC (rev 114803)
+++ branches/JBPAPP_5/testsuite/src/main/org/jboss/test/scripts/test/RunTestCase.java	2014-04-15 12:00:56 UTC (rev 114804)
@@ -27,9 +27,9 @@
 import java.io.FileReader;
 import javax.management.ObjectName ;
 import javax.management.MalformedObjectNameException ;
+import java.util.Map;
+import java.util.Arrays;
 
-
-
 /**
  * Unit tests of run.sh and run.bat.
  *
@@ -228,7 +228,7 @@
       // TODO Solaris machines tend to fail if ANY environment variables are given this way. Why?
 
       // set the environment
-      String[] envp = new String[] { "LAUNCH_JBOSS_IN_BACKGROUND=true", "JBOSS_PIDFILE=" + pidFile.getAbsolutePath() };
+      String[] envp = updateEnvs("LAUNCH_JBOSS_IN_BACKGROUND=true", "JBOSS_PIDFILE=" + pidFile.getAbsolutePath());
       System.out.println("created pidFile: " + pidFile.getAbsolutePath());
 
       // set the working directory
@@ -284,6 +284,23 @@
       Thread.sleep(2000);
       assertFalse("pidfile should be deleted", pidFile.exists());
    } 
+
+    /**
+     * Update existing environment properties.
+     *
+     * @param extraEnv Extra environment properties.
+     * @return String array of updated environment properties.
+     */
+    private String[] updateEnvs(String... extraEnv) {
+        Map<String, String> envMap = System.getenv();
+        int index = extraEnv.length;
+        String[] envs = Arrays.copyOf(extraEnv, index + envMap.size());
+        for (Map.Entry<String, String> entry : envMap.entrySet()) {
+            envs[index++] = entry.getKey() + "=" + entry.getValue();
+        }
+        return envs;
+    }
+
    
    private void writeLogsToTestCase() {
 	   



More information about the jboss-cvs-commits mailing list