[jboss-dev-forums] [Design of JBoss internal QA (Test Suite)] - minor mod to testsuite server start/stop management

akostadinov do-not-reply at jboss.com
Tue Feb 20 04:50:36 EST 2007


Hi

I would like to make minor changes to the testsuite server management so one can specify server start/stop timeout + server to be killed if it's process is running but server is not up after the specified timeout. 

Now timeout is hardcoded to 120 sec. I change it to read a system property and use 120 if it is not set. Also after the loop where we wait server to get up I add process.destroy(). This means that the time allowed has expired but process exists - we don't need it any more so kill it before quit.

Now one could add "-Djbossas.startup.timeout=300" to ANT_OPTS and have the timeout changed.

See the diff output:
Index: test/src/main/org/jboss/test/util/server/ServerManager.java
===================================================================
--- test/src/main/org/jboss/test/util/server/ServerManager.java (revision 60496)
+++ test/src/main/org/jboss/test/util/server/ServerManager.java    (working copy)
@@ -215,7 +215,7 @@
     */
    public int getShutdownTimeout()
    {
-      return 120;
+      // set this property in env.ANT_OPTS
+      return Integer.parseInt(System.getProperty("jbossas.startup.timeout", "120"));
    }

    /**
@@ -224,7 +224,7 @@
     */
    public int getStartupTimeout()
    {
-      return 120;
+      return Integer.parseInt(System.getProperty("jbossas.startup.timeout", "120"));
    }

    /**
Index: test/src/main/org/jboss/test/util/server/ServerController.java
===================================================================
--- test/src/main/org/jboss/test/util/server/ServerController.java (revision 60496)
+++ test/src/main/org/jboss/test/util/server/ServerController.java (working copy)
@@ -186,6 +186,12 @@
             return;
          }
       }
+
+      Process process = server.getProcess();
+      System.err.println("Failed to start server \"" + server.getName()
+               + "\" before timeout. Destroying the process.");
+      process.destroy();
+
       throw new IOException("Server failed to start; see logs.");

    }



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019263#4019263

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019263



More information about the jboss-dev-forums mailing list