You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2018/09/25 13:06:08 UTC

svn commit: r1841933 - in /db/derby/code/trunk: build.xml java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/NetServer.java java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/jdk19.java

Author: rhillegas
Date: Tue Sep 25 13:06:08 2018
New Revision: 1841933

URL: http://svn.apache.org/viewvc?rev=1841933&view=rev
Log:
DERBY-6945: Add a build target for running the old harness tests with a module path; commit derby-6945-60-aa-antTargetToRunOldHarnessTestsWithModules.diff.

Modified:
    db/derby/code/trunk/build.xml
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/NetServer.java
    db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/jdk19.java

Modified: db/derby/code/trunk/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/build.xml?rev=1841933&r1=1841932&r2=1841933&view=diff
==============================================================================
--- db/derby/code/trunk/build.xml (original)
+++ db/derby/code/trunk/build.xml Tue Sep 25 13:06:08 2018
@@ -2626,6 +2626,34 @@
   </target>
 
 <!-- =================================================================== -->
+<!--                      Run tests with a module path                   -->
+<!-- =================================================================== -->
+
+  <target name="test-derbyall-with-modulepath"
+          depends="junit-init"
+          description="Old harness tests with module path"
+  >
+    <path id="derbyall.classpath">
+      <fileset dir="${derby.junit.test.jars}" includes="*.jar"/>
+   	  <pathelement path="${derby.junit.classpath}"/>
+      <pathelement location="${javatools.dir}/junit.jar"/>
+    </path>
+    <echo message="Modulepath used for derbyall: ${toString:derbyall.classpath}"/>
+    <mkdir dir="junit_${derby.junit.timestamp}/derbyall"/>
+    <java 
+          modulepath="${toString:derbyall.classpath}"
+          module="org.apache.derby.tests"
+          classname="org.apache.derbyTesting.functionTests.harness.RunSuite"
+          fork="yes"
+          dir="junit_${derby.junit.timestamp}/derbyall"
+    >
+      <jvmarg value="--add-modules"/>
+      <jvmarg value="org.apache.derby.tests,junit"/>
+      <arg value="derbyall"/>
+    </java>
+  </target>
+
+<!-- =================================================================== -->
 <!--                         EMMA utility targets                        -->
 <!-- =================================================================== -->
 

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/NetServer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/NetServer.java?rev=1841933&r1=1841932&r2=1841933&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/NetServer.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/NetServer.java Tue Sep 25 13:06:08 2018
@@ -23,12 +23,15 @@ package org.apache.derbyTesting.function
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.util.ArrayList;
 import java.util.Locale;
 import java.util.Vector;
 import java.util.Hashtable;
 import java.lang.reflect.Method;
 import java.lang.reflect.Constructor;
 import java.net.Socket;
+import org.apache.derby.shared.common.info.JVMInfo;
+import org.apache.derby.shared.common.reference.ModuleUtil;
 import org.apache.derbyTesting.functionTests.util.TestUtil;
 
 public class NetServer
@@ -80,10 +83,8 @@ public class NetServer
 	     "",                                            // suffix
 	     "com.ibm.db2.jcc.DB2Driver",                   //driver
 	     "1527",                                        // port
-	     new String[] {NETWORK_SERVER_CLASS_NAME,  //start
-			   "start"},                        
-	     new String[] {NETWORK_SERVER_CLASS_NAME,  //shutdown
-			   "shutdown"},
+	     serverArgs("start"),                        
+	     serverArgs("shutdown"),
 	     null});                                        //shutdown2
 
 	url = "jdbc:derby://" + hostName + ":1527/";  
@@ -93,10 +94,8 @@ public class NetServer
 	     "",                                            // suffix
 	     "org.apache.derby.jdbc.ClientDriver",           //driver
 	     "1527",                                        // port
-	     new String[] {NETWORK_SERVER_CLASS_NAME,  //start
-			   "start"},                        
-	     new String[] {NETWORK_SERVER_CLASS_NAME,  //shutdown
-			   "shutdown"},
+	     serverArgs("start"),                        
+	     serverArgs("shutdown"),
 	     null});                                        //shutdown2
 
 	url = "jdbc:db2://" + hostName + ":50000/";
@@ -119,6 +118,40 @@ public class NetServer
 	     null});
     }
 
+    /**
+     * Get server command args, depending on whether we are
+     * running with a module path.
+     *
+     * @param serverCommand start or shutdown
+     *
+     * @return an array of server command args
+     */
+    private static String[] serverArgs(String serverCommand)
+    {
+        ArrayList<String> argList = new ArrayList<String>();
+        boolean isModuleAware = JVMInfo.isModuleAware();
+
+        if (isModuleAware)
+        {
+            argList.add("-p");
+            argList.add(JVMInfo.getSystemModulePath());
+
+            argList.add("-m");
+            argList.add(ModuleUtil.SERVER_MODULE_NAME + "/" + NETWORK_SERVER_CLASS_NAME);
+        }
+        else
+        {
+            argList.add(NETWORK_SERVER_CLASS_NAME);
+        }
+
+        argList.add(serverCommand);
+
+        String[] retval = new String[argList.size()];
+        argList.toArray(retval);
+
+        return retval;
+    }
+
     public NetServer(File homeDir, String jvmName, String clPath,
 					 String javaCmd, String jvmflags, String framework,
 					 boolean startServer, String appsRequiredPassword)
@@ -167,7 +200,7 @@ public class NetServer
 	// if we are just connecting to DB2 we return
 	if (startcmd == null) 
 	    return;
-	
+
         // Build the command to run the WL server
 	String homeDirName = homeDir.getCanonicalPath();
 		jvm jvm = null; // to quiet the compiler
@@ -203,6 +236,7 @@ public class NetServer
 	    serverCmd[i] = (String)vCmd.elementAt(i);
 	    System.out.print(serverCmd[i] + " ");
 	}
+	
 	System.out.println("");
         // Start a process to run the Server
 	pr = Runtime.getRuntime().exec(serverCmd);

Modified: db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/jdk19.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/jdk19.java?rev=1841933&r1=1841932&r2=1841933&view=diff
==============================================================================
--- db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/jdk19.java (original)
+++ db/derby/code/trunk/java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/harness/jdk19.java Tue Sep 25 13:06:08 2018
@@ -24,6 +24,7 @@ package org.apache.derbyTesting.function
 import java.util.Vector;
 import java.util.StringTokenizer;
 
+import org.apache.derby.shared.common.info.JVMInfo;
 
 public class jdk19 extends jvm {
 
@@ -73,7 +74,15 @@ public class jdk19 extends jvm {
             sb.append(mx);
         }
         if (classpath!=null) {
-            sb.append(" -classpath ");
+            if (JVMInfo.isModuleAware())
+            {
+                 sb.append(" -p ");
+            }
+            else
+            {
+                sb.append(" -classpath ");
+            }
+            
             sb.append(classpath);
         }
         if (prof!=null) warn("jdk19 does not support prof");