org.jboss.ejb3.testremote.server
Class MockServerController

java.lang.Object
  extended by org.jboss.ejb3.testremote.server.MockServerController

public class MockServerController
extends Object

MockServerController Controls the startup/shutdown of the MockServer

Version:
$Revision: $
Author:
Jaikiran Pai

Constructor Summary
MockServerController(String host, int port)
          Constructor
Creates a Client to send requests to the remote MockServer
 
Method Summary
 int getServerStartupTimeout()
          Returns the timeout set for the server startup.
 int getServerStopTimeout()
          Returns the timeout set for server to stop
protected  void sendStartRequestToServer()
          Sends a MockServer.MockServerRequest.START to the server
protected  void sendStopRequestToServer()
          Sends a MockServer.MockServerRequest.STOP to the server
 void setServerStartupTimeout(int timeout)
          Sets the timeout for the server startup.
 void setServerStopTimeout(int timeout)
          Sets the timeout for the server to stop.
 void startServer(Class<? extends MockServer> serverClass)
          Creates a remote process (JVM) to launch the MockServer and then sends a MockServer.MockServerRequest.START request to start the server
 void startServer(Class<? extends MockServer> serverClass, String[] arguments)
          Creates a remote process (JVM) to launch the MockServer and then sends a MockServer.MockServerRequest.START request to start the server
 void startServer(String envVarJavaHome, Class<? extends MockServer> serverClass)
           
 void startServer(String envVarJavaHome, Class<? extends MockServer> serverClass, String[] arguments)
          Creates a remote process (JVM) to launch the MockServer and then sends a MockServer.MockServerRequest.START request to start the server
 void stopServer()
          Sends a MockServer.MockServerRequest.STOP request to the server and also kills the process in whic the server was running
 void stopServer(boolean killProcess)
          Sends a MockServer.MockServerRequest.STOP request to the server and if the killProcess is true then it also kills the process in which the server was running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockServerController

public MockServerController(String host,
                            int port)
Constructor
Creates a Client to send requests to the remote MockServer

Parameters:
host - The host on which the MockServer is available
port - The port on which the MockServer is listening
Method Detail

startServer

public void startServer(Class<? extends MockServer> serverClass)
                 throws Throwable
Creates a remote process (JVM) to launch the MockServer and then sends a MockServer.MockServerRequest.START request to start the server

Parameters:
serverClass - The class of the server to be used
Throws:
Throwable

startServer

public void startServer(Class<? extends MockServer> serverClass,
                        String[] arguments)
                 throws Throwable
Creates a remote process (JVM) to launch the MockServer and then sends a MockServer.MockServerRequest.START request to start the server

Parameters:
envJarJavaHome - Name of the Environment Variable pointing to the JVM to be used in starting the server
serverClass - The class of the server to be used
Throws:
Throwable

startServer

public void startServer(String envVarJavaHome,
                        Class<? extends MockServer> serverClass)
                 throws Throwable
Throws:
Throwable

startServer

public void startServer(String envVarJavaHome,
                        Class<? extends MockServer> serverClass,
                        String[] arguments)
                 throws Throwable
Creates a remote process (JVM) to launch the MockServer and then sends a MockServer.MockServerRequest.START request to start the server

Parameters:
envJarJavaHome - Name of the Environment Variable pointing to the JVM to be used in starting the server
serverClass - The class of the server to be used
arguments - The arguments that will be passed to the MockServer as JVM program arguments
Throws:
Throwable

stopServer

public void stopServer()
                throws Throwable
Sends a MockServer.MockServerRequest.STOP request to the server and also kills the process in whic the server was running

Throws:
Throwable
See Also:
stopServer(boolean)

stopServer

public void stopServer(boolean killProcess)
                throws Throwable
Sends a MockServer.MockServerRequest.STOP request to the server and if the killProcess is true then it also kills the process in which the server was running.

Parameters:
killProcess - If true, kills the process in which the MockServer was running. Else, just sends a MockServer.MockServerRequest.STOP request to the server.
Throws:
Throwable

setServerStartupTimeout

public void setServerStartupTimeout(int timeout)
Sets the timeout for the server startup.
This method has to be called before calling the #startServer(String[]) method, for the timeout to be considered.

Parameters:
timeout - The timeout value in milli seconds.

getServerStartupTimeout

public int getServerStartupTimeout()
Returns the timeout set for the server startup.

Returns:

getServerStopTimeout

public int getServerStopTimeout()
Returns the timeout set for server to stop

Returns:

setServerStopTimeout

public void setServerStopTimeout(int timeout)
Sets the timeout for the server to stop.
This method has to be called before calling the stopServer() method, for the timeout to be considered.

Parameters:
timeout - The timeout value in milli seconds.

sendStopRequestToServer

protected void sendStopRequestToServer()
                                throws Throwable
Sends a MockServer.MockServerRequest.STOP to the server

Throws:
Throwable

sendStartRequestToServer

protected void sendStartRequestToServer()
                                 throws Throwable
Sends a MockServer.MockServerRequest.START to the server

Throws:
Throwable


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.