db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r693522 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/tests/derbynet/SecureServerTest.java functionTests/tests/replicationTests/ReplicationRun.java junit/BaseTestCase.java junit/NetworkServerTestSetup.java
Date Tue, 09 Sep 2008 17:26:26 GMT
Author: kmarsden
Date: Tue Sep  9 10:26:26 2008
New Revision: 693522

URL: http://svn.apache.org/viewvc?rev=693522&view=rev
Log:
DERBY-3840 The test code executes java processes by just executing java instead of using a
full path. This may cause the wrong java to be picked up


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java?rev=693522&r1=693521&r2=693522&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/SecureServerTest.java
Tue Sep  9 10:26:26 2008
@@ -467,7 +467,7 @@
         StringBuffer    buffer = new StringBuffer();
         String          classpath = getSystemProperty( "java.class.path" );
 
-        buffer.append( "java -classpath " );
+        buffer.append( getJavaExecutableName() + " -classpath " );
         buffer.append( classpath );
         buffer.append( " -Demma.verbosity.level=silent");
         buffer.append( " org.apache.derby.drda.NetworkServerControl -p " + portNumber + "
" + commandSpecifics );

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun.java?rev=693522&r1=693521&r2=693522&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/replicationTests/ReplicationRun.java
Tue Sep  9 10:26:26 2008
@@ -103,7 +103,7 @@
     
     final static String FS = File.separator;
     final static String PS = File.pathSeparator;
-    final static String JVMloc = FS+".."+FS+"bin"+FS+"java"; // "/../bin/java"
+    final static String JVMloc = BaseTestCase.getJavaExecutableName();
     
     static boolean showSysinfo = false;
     static long SLEEP_TIME_MILLIS = 5000L;
@@ -316,7 +316,7 @@
                 // See TestConfiguration: startNetworkServer and stopNetworkServer
                 + PS + test_jars;
         
-        String clientJvm = clientVM+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         String command = null;
         
@@ -400,7 +400,7 @@
                 // See TestConfiguration: startNetworkServer and stopNetworkServer
                 + PS + test_jars;
         
-        String clientJvm = clientVM+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         String command = null;
         
@@ -498,7 +498,7 @@
                 // See TestConfiguration: startNetworkServer and stopNetworkServer
                 + PS + test_jars;
         
-        String clientJvm = clientVM+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         String command = null;
         
@@ -577,7 +577,7 @@
                 // See TestConfiguration: startNetworkServer and stopNetworkServer
                 + PS + test_jars;
         
-        String clientJvm = clientVM+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         String command = null;
         
@@ -642,7 +642,7 @@
         { // Use full classpath when running locally. Can not vary server versions!
             ijClassPath = classPath;
         }
-        String clientJvm = jvmVersion+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         String command = clientJvm 
                 + " -Dij.driver=" + DRIVER_CLASS_NAME
@@ -731,11 +731,10 @@
         }
         else
         {
-            startMaster_ij(jvmVersion,
-                    dbName,
-                    masterHost, masterServerPort,
-                    slaveReplInterface, slaveReplPort,
-                    testClientHost);
+            startMaster_ij(dbName,
+                    masterHost,
+                    masterServerPort, slaveReplInterface,
+                    slaveReplPort, testClientHost);
         }
         /* else if ...
         {
@@ -760,7 +759,7 @@
         
         String masterClassPath = derbyMasterVersion +FS+ "derbynet.jar";
         
-        String clientJvm = clientVM+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         if ( masterHost.equals("localhost") )
         { // Use full classpath when running locally. Can not vary server versions!
@@ -794,14 +793,12 @@
                 "startMaster_CLI ");
         
     }
-    private void startMaster_ij(String jvmVersion,
-            String dbName,
-            String masterHost,  // Where the master db is run.
-            int masterServerPort, // master server interface accepting client requests
-            
-            String slaveReplInterface, // slaveHost,
-            int slaveReplPort, // slavePort)
+    private void startMaster_ij(String dbName,
+            String masterHost,
+            int masterServerPort,  // Where the master db is run.
+            String slaveReplInterface, // master server interface accepting client requests
             
+            int slaveReplPort, // slaveHost,
             String testClientHost)
             throws Exception
     {
@@ -825,7 +822,7 @@
             ijClassPath = classPath;
         }
         
-        String clientJvm = jvmVersion+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         String command = clientJvm // "java"
                 + " -Dij.driver=" + DRIVER_CLASS_NAME
@@ -1002,7 +999,7 @@
             slaveClassPath = classPath;
         }
         
-        String clientJvm = clientVM+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         /*
          * java -classpath ${SLAVE_LIB}/derbynet.jar org.apache.derby.drda.NetworkServerControl
\
@@ -1059,7 +1056,7 @@
             ijClassPath = classPath;
         }
         
-        String clientJvm = jvmVersion+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         String command = clientJvm // "java"
                 + " -Dij.driver=" + DRIVER_CLASS_NAME
@@ -1190,7 +1187,7 @@
             ijClassPath = classPath;
         }
         
-        String clientJvm = jvmVersion+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         String command = clientJvm // "java"
                 + " -Dij.driver=" + DRIVER_CLASS_NAME
@@ -1250,7 +1247,7 @@
             ijClassPath = classPath;
         }
         
-        String clientJvm = jvmVersion+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         String command = clientJvm // "java"
                 + " -Dij.driver=" + DRIVER_CLASS_NAME
@@ -1330,7 +1327,7 @@
             ijClassPath = classPath;
         }
         
-        String clientJvm = jvmVersion+JVMloc;
+        String clientJvm = BaseTestCase.getJavaExecutableName();
         
         String command = clientJvm // "java"
                 + " -Dij.driver=" + DRIVER_CLASS_NAME
@@ -2170,8 +2167,7 @@
          
         final String debugId = "startServer@" + serverHost + ":" + serverPort + " ";
         util.DEBUG(debugId+"+++ StartServer " + serverVM + " / " + serverVersion);
-        
-        String serverJvm = serverVM+JVMloc;
+                
         String serverClassPath = serverVersion + FS+"derby.jar"
                 + PS + serverVersion + FS+"derbynet.jar";
         if ( serverHost.equals("localhost") )
@@ -2186,7 +2182,7 @@
         
         String workingDirName = userDir+FS+dbSubDirPath;// "system" for this server
         
-        final String[] commandElements = {serverJvm
+        final String[] commandElements = {BaseTestCase.getJavaExecutableName()
                 , " -Dderby.system.home=" + workingDirName
                 , " -Dderby.infolog.append=true"
                 // , " -Dderby.language.logStatementText=true" // Goes into derby.log: Gets
HUGE!
@@ -2378,7 +2374,7 @@
         util.DEBUG("+++ stopServer " + serverVM + " / " + serverVersion
                 + " " + debugId);
         
-        String serverJvm = serverVM+JVMloc;
+        String serverJvm = BaseTestCase.getJavaExecutableName();
         String serverClassPath = serverVersion + FS+"derby.jar"
                 + PS + serverVersion + FS+"derbynet.jar";
         if ( serverHost.equals("localhost") )
@@ -2695,7 +2691,7 @@
         { // Use full classpath when running locally. Can not vary server versions!
             ijClassPath = classPath;
         }
-            String clientJvm = jvmVersion+JVMloc;
+            String clientJvm = BaseTestCase.getJavaExecutableName();
             String command = "rm -rf /"+masterDatabasePath+FS+dbSubPath+FS+database+";" //
FIXME! for slave load!
                     + clientJvm // "java"
                     + " -Dij.driver=" + DRIVER_CLASS_NAME

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java?rev=693522&r1=693521&r2=693522&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/BaseTestCase.java Tue Sep
 9 10:26:26 2008
@@ -505,6 +505,20 @@
 	    }
 	    return pr;
 	}
+
+	/**
+         * Return the executable name for spawning java commands.
+         * This will be <path to j9>/j9  for j9 jvms.
+	 * @return full path to java executable.
+         */
+         public static final String getJavaExecutableName() {
+             String vmname = getSystemProperty("com.ibm.oti.vm.exe");
+             if (vmname == null)
+                 vmname = getSystemProperty("java.home") + File.separator + "bin" +
+                 File.separator +"java";
+             return vmname;
+         }
+          
    
    /**
     * Reads output from a process and returns it as a string.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=693522&r1=693521&r2=693522&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java
Tue Sep  9 10:26:26 2008
@@ -249,7 +249,7 @@
         String              classpath = BaseTestCase.getSystemProperty( "java.class.path"
);
         boolean         skipHostName = false;
 
-        al.add( "java" );
+        al.add( BaseTestCase.getJavaExecutableName() );
         al.add( "-classpath" );
         al.add( classpath );
         



Mime
View raw message