db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1538692 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness: NetServer.java RunTest.java
Date Mon, 04 Nov 2013 17:44:11 GMT
Author: myrnavl
Date: Mon Nov  4 17:44:10 2013
New Revision: 1538692

URL: http://svn.apache.org/r1538692
Log:
DERBY-6400; harness.NetServer method waitFor() is not reflecting timeout values
   adding code to pass on a timeout value when specified on in the commandline

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java?rev=1538692&r1=1538691&r2=1538692&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/NetServer.java
Mon Nov  4 17:44:10 2013
@@ -41,6 +41,7 @@ public class NetServer
     String jvmflags;
     String framework;
 	String appsRequiredPassword;
+	int timeout=60;
     static String hostName;
     
     Object[] frameworkInfo;
@@ -129,6 +130,18 @@ public class NetServer
         this.javaCmd = javaCmd;
         this.jvmflags = jvmflags;
 	this.framework = framework;
+	
+    if (jvmflags != null && jvmflags.length() > 0)
+    {
+        int start=jvmflags.indexOf("-Dtimeout");
+        if (start >= 0) {
+            String timeoutStr = jvmflags.substring(start);
+            String[] tokens = timeoutStr.split(" ");
+            timeoutStr = tokens[0];
+            timeoutStr = timeoutStr.substring(10);
+            timeout = Integer.parseInt(timeoutStr.trim());
+        }
+    }
 
 	    // if authentication is required to shutdown server we need password
 	    // for user APP (the dbo).
@@ -316,7 +329,7 @@ public class NetServer
 		Process prconn = Runtime.getRuntime().exec(connCmd);
 		// Give the server sixty seconds to shutdown.
 		TimedProcess tp = new TimedProcess(prconn);
-		tp.waitFor(60);
+		tp.waitFor(timeout);
 		
 		String[] stopcmd2 = (String[]) frameworkInfo[STOP_CMD2_POS];
 		if (stopcmd2 != null)
@@ -337,7 +350,7 @@ public class NetServer
 		// Try a TimedProcess as Phil did for the WLServer
 		tp = new TimedProcess(pr);
 		// In case the Server didn't shut down, force it to ...
-		tp.waitFor(60);
+		tp.waitFor(timeout);
 		
 		// Finish and close the redirected out and err files
 		outSaver.finish();

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java?rev=1538692&r1=1538691&r2=1538692&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/harness/RunTest.java
Mon Nov  4 17:44:10 2013
@@ -292,6 +292,13 @@ public class RunTest
                 spacedJvmFlags = spaceJvmFlags(jvmflags);   
             }
             
+            if (!(timeoutStr.isEmpty()) && !(timeoutStr==null) && (timeout
>= 0)) {
+                if  (spacedJvmFlags != null)
+                    spacedJvmFlags = "-Dtimeout=" + timeoutStr + " " + spacedJvmFlags;
+                else
+                    spacedJvmFlags = "-Dtimeout=" + timeoutStr + " ";
+            }
+            
             System.out.println("Initialize for framework: "+ framework );
             if (jvmnet && framework.startsWith("DerbyNet"))
             {



Mime
View raw message