db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r152681 [1/5] - in incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests: harness/ master/DerbyNetClient/ suites/ tests/derbynet/ tests/jdbcapi/ util/
Date Tue, 08 Feb 2005 18:04:13 GMT
Author: kmarsden
Date: Tue Feb  8 10:04:07 2005
New Revision: 152681

URL: http://svn.apache.org/viewcvs?view=rev&rev=152681
Log:
Add more tests and test support for network
client.  There is no change to the actual function of the tests but
direct references to the IBM Driver have been taken out of the tests
themselves.  With this patch, there are methods in TestUtil which will
perform the desired action based on the framework.

public static void loadDriver() throws Exception
public static String getJdbcUrlPrefix()
public static javax.sql.DataSource getDataSource(Properties attrs)
public static javax.sql.XADataSource getXADatasource(Properties attrs)
public static javax.sql.ConnectionPoolDataSource
getConnectionPoolDataSource(Properties attrs)

This change also adds a new property to RunTest to determine whether the
test will start newtork server.

startServer={true|false}

Defaults to true for DerbyNet and DerbyNetClient. Not relevant for the
embedded framework.

This property is useful for tests which require the framework in order
to load the right driver but start their own server.


Added:
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/LobTest.out
  (with props)
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/parameterMapping.out
  (with props)
Modified:
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/sysinfo.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/noDerbyNetClient.runall
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NSinSameJVM_app.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dataSourcePermissions_net.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dataSourcePermissions_net_app.properties
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/dataSourcePermissions.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/TestUtil.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/build.xml

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java?view=diff&r1=152680&r2=152681
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
Tue Feb  8 10:04:07 2005
@@ -47,6 +47,7 @@
     BackgroundStreamSaver outSaver, errSaver;
     FileOutputStream fosOut, fosErr;
     private String java;
+	private boolean startServer;  // whether test will start it's own server
 
 	//  Variables for test connection
     Object networkServer;   // Server needs to be created with reflection
@@ -112,7 +113,7 @@
     }
 
     public NetServer(File homeDir, String jvmName, String clPath, String
-		     javaCmd, String jvmflags, String framework) 
+		     javaCmd, String jvmflags, String framework, boolean startServer) 
 	throws Exception
     {
 	this.homeDir = homeDir;
@@ -124,12 +125,18 @@
 	frameworkInfo =  (Object[]) m.get(framework);
 	
 	this.port = Integer.parseInt((String) frameworkInfo[PORT_POS]);
-	
+	this.startServer = startServer;
 	// System.out.println("framework: " + this.framework + "port: " + this.port);
 	
     }
     public void start() throws Exception
     {
+	  if (! startServer)
+	  {
+		System.out.println("startServer = false. Bypass server startup");
+		return;
+	  }
+
 	// Create the Server directory under the    server dir
 	(new File(homeDir, framework + "Server")).mkdir();
 	String[] startcmd = (String[]) frameworkInfo[START_CMD_POS];
@@ -232,6 +239,12 @@
     
 	public boolean  testNetworkServerConnection() throws Exception
 	{ 	
+		if (! startServer)
+		{
+			System.out.println("startServer = false. Bypass server check");
+			return true;
+		}
+		
 	    Object[] testConnectionArg  = null;
 		if (networkServer == null)
 		{
@@ -249,6 +262,13 @@
     // stop the Server
 	public void stop() throws Exception
     {
+	  if (! startServer)
+	  {
+		return;
+	  }
+
+	System.out.println("Attempt to shutdown framework: " 
+						 + framework);
 	jvm jvm = null; // to quiet the compiler
 	jvm = jvm.getJvm(jvmName);
 	Vector jvmCmd = jvm.getCommandLine();

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java?view=diff&r1=152680&r2=152681
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
(original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
Tue Feb  8 10:04:07 2005
@@ -119,6 +119,7 @@
 	static String commonDBHome = "testCSHome";
 	static boolean dbIsNew = true;
 	static String runwithjvm="true";
+	static boolean startServer=true; // should test harness start the server
 
 	// Other test variables for directories, files, output
 	static String scriptName = ""; // testname as passed in
@@ -255,7 +256,7 @@
 	    if ((driverName != null) && (!skiptest) )
 	    {
             System.out.println("Initialize for framework: "+ framework );
-            if (jvmnet && (framework.equals("DB2jNet")  || framework.startsWith("DerbyNet")))
+            if (jvmnet && framework.startsWith("DerbyNet"))
             {
                 // first check to see if properties were set to use a different jvm for server/client
                 String jvmnetjvm = System.getProperty("serverJvmName");
@@ -265,10 +266,12 @@
                     jvmnetjvm = "j9_22";
                 }
 			
-                ns = new NetServer(baseDir, jvmnetjvm, classpathServer, null, jvmflags,framework);
+                ns = new NetServer(baseDir, jvmnetjvm, classpathServer, null,
+								   jvmflags,framework, startServer);
             }
             else
-			    ns = new NetServer(baseDir, jvmName, classpathServer, javaCmd, jvmflags,framework);
+			    ns = new NetServer(baseDir, jvmName, classpathServer, 
+								   javaCmd, jvmflags,framework, startServer);
 		    ns.start();
 		    frameworkInitialized = true;
 	    }
@@ -298,8 +301,6 @@
         // Stop the Network server if necessary
 		if (frameworkInitialized)
 		{
-		    System.out.println("Attempt to shutdown framework: " 
-				       + framework);
 		    ns.stop();
 		}
 
@@ -1461,7 +1462,13 @@
 				addSkiptestReason("Test skipped: test cannot run with jvm: " +
 								  jvmName + ".  " + scriptFileName);
 			}
-
+			// startServer will determine whether the server will be started 
+			// for network server tests or that will be left to the test.
+			String startServerProp = ap.getProperty("startServer");
+			if (startServerProp != null &&
+				startServerProp.equalsIgnoreCase("false"))
+				startServer =false;
+			
 	        // Check for jvmflags (like "-nojit -ms32M -mx32M")
 	        // These may have been set as a system property already
 	        if (jvmflags == null)



Mime
View raw message