[jboss-cvs] JBossAS SVN: r86053 - projects/ejb3/trunk/test-remote/src/main/java/org/jboss/ejb3/testremote/server.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 18 11:02:23 EDT 2009
Author: ALRubinger
Date: 2009-03-18 11:02:23 -0400 (Wed, 18 Mar 2009)
New Revision: 86053
Modified:
projects/ejb3/trunk/test-remote/src/main/java/org/jboss/ejb3/testremote/server/MockServerController.java
Log:
[EJBTHREE-1775] Do not require CLI arguments to MockServerController.startServer
Modified: projects/ejb3/trunk/test-remote/src/main/java/org/jboss/ejb3/testremote/server/MockServerController.java
===================================================================
--- projects/ejb3/trunk/test-remote/src/main/java/org/jboss/ejb3/testremote/server/MockServerController.java 2009-03-18 14:52:47 UTC (rev 86052)
+++ projects/ejb3/trunk/test-remote/src/main/java/org/jboss/ejb3/testremote/server/MockServerController.java 2009-03-18 15:02:23 UTC (rev 86053)
@@ -144,21 +144,42 @@
* server
*
* @param serverClass The class of the server to be used
- * @param arguments The arguments that will be passed to the {@link MockServer}
- * as JVM program arguments
*
* @throws Throwable
*/
+ public void startServer(Class<? extends MockServer> serverClass) throws Throwable
+ {
+ this.startServer(null, serverClass, null);
+ }
+
+ /**
+ * Creates a remote process (JVM) to launch the {@link MockServer}
+ * and then sends a {@link MockServerRequest#START} request to start the
+ * server
+ *
+ * @param envJarJavaHome Name of the Environment Variable pointing to the JVM to be used
+ * in starting the server
+ * @param serverClass The class of the server to be used
+ *
+ * @throws Throwable
+ */
public void startServer(Class<? extends MockServer> serverClass, String[] arguments) throws Throwable
{
this.startServer(null, serverClass, arguments);
}
+ public void startServer(String envVarJavaHome, Class<? extends MockServer> serverClass) throws Throwable
+ {
+ this.startServer(envVarJavaHome, serverClass, null);
+ }
+
/**
* Creates a remote process (JVM) to launch the {@link MockServer}
* and then sends a {@link MockServerRequest#START} request to start the
* server
*
+ * @param envJarJavaHome Name of the Environment Variable pointing to the JVM to be used
+ * in starting the server
* @param serverClass The class of the server to be used
* @param arguments The arguments that will be passed to the {@link MockServer}
* as JVM program arguments
@@ -171,9 +192,18 @@
// Along with the arguments that the client passes to the server,
// append the the serverHost and port number on which the mockserver is
// expected to listen
- int numberOfArgs = arguments.length;
- String[] processArgs = new String[numberOfArgs + 3];
- System.arraycopy(arguments, 0, processArgs, 3, numberOfArgs);
+ String processArgs[] = null;
+ int requiredArgs = 3;
+ if (arguments != null)
+ {
+ int numberOfArgs = arguments.length;
+ processArgs = new String[numberOfArgs + requiredArgs];
+ System.arraycopy(arguments, 0, processArgs, requiredArgs, numberOfArgs);
+ }
+ else
+ {
+ processArgs = new String[requiredArgs];
+ }
// now prepend the server host and port
processArgs[0] = serverClass.getName();
processArgs[1] = this.serverHost;
@@ -416,9 +446,12 @@
// The class to run
command.add(serverClass.getName());
// The arguments to the main class
- for (int i = 0; i < arguments.length; i++)
+ if (arguments != null)
{
- command.add(arguments[i]);
+ for (int i = 0; i < arguments.length; i++)
+ {
+ command.add(arguments[i]);
+ }
}
// Create a Remote Launcher
More information about the jboss-cvs-commits
mailing list