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.");
}
btw I'm going to do for branch 4.0, 4.2 and trunc