[jboss-dev-forums] [Design of EJB 3.0] - Re: EJBTHREE-1396 MockServer must report startup / shutdown

jaikiran do-not-reply at jboss.com
Sun Nov 16 06:32:32 EST 2008


Based on these inputs, i have refactored a lot of the code including the RemoteAccessTestCase. Here's the details:

* I have introduced a MockServerController which has APIs to start and stop the MockServer

/**
  |     * Creates a remote process (JVM) to launch the {@link MockServer}
  |     * and then sends a {@link MockServerRequest#START} request to start the
  |     * server
  |     *   
  |     * @param arguments The arguments that will be passed to the {@link MockServer} 
  |     *       as JVM program arguments
  |     *       
  |     * @throws Throwable
  |     */
  |    public void startServer(String[] arguments) throws Throwable
  |    
  |    
  | /**
  |     * Sends a {@link MockServerRequest#STOP} request to the server
  |     * and also kills the process in whic the server was running
  |     * 
  |     * @see MockServerController#stopServer(boolean)
  |     * @throws Throwable
  |     */
  |    public void stopServer() throws Throwable
  | 
  | 
  | * The MockServerController is now responsible for creating the remote process and then issuing a MockServerRequest.START to start the server. This request will then be handled remotely by a MockServerInvocationHandler which inturn will invoke the start() API of the MockServer.

* MockServerController.startServer()/stopServer() is a blocking call (with a timeout). 

* Support to start multiple MockServer in their own JVM is now available. One MockServerController can control one MockServer. So if multiple MockServer needs to be created, there will n such MockServerController, each controlling the corresponding server

* Individual test case will no longer be responsible for creating the remote (JVM) process. Instead they will instantiate a MockServerController

/**
  |     * Constructor <br>
  |     * Creates a {@link Client} to send requests to the remote {@link MockServer}
  |     *   
  |     * @param host The host on which the {@link MockServer} is available
  |     * @param port The port on which the {@link MockServer} is listening
  |     */
  |    public MockServerController(String host, int port)
  |    
and then invoke the startServer API (and later stopServer)

* These new changes now use Remoting 2.x (current version being used in the project) framework.




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

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



More information about the jboss-dev-forums mailing list