Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util.unittest.server
Class ServerLifecycle

java.lang.Object
  extended by org.hyperic.util.unittest.server.ServerLifecycle

public class ServerLifecycle
extends java.lang.Object

This class manages the Hyperic Server lifecycle in a unit testing environment. It is assumed that the local jboss deployment has already been prepared using the Ant target unittest-prepare-jboss. In addition we are assuming that this is a clean instance of jboss that does not include an HQ EAR deployment and there is no other instance of the Hyperic server currently running on the host.


Constructor Summary
ServerLifecycle(java.io.File jbossHomeDir)
          Create an instance using the "default" configuration in the jboss home dir.
ServerLifecycle(java.io.File jbossHomeDir, java.lang.String configuration)
          Create an instance using the specified configuration in the jboss home dir.
 
Method Summary
 LocalInterfaceRegistry deploy(java.net.URL url)
          Deploy the package represented by the URL.
 boolean isStarted()
           
 void startServer()
          Start the server.
 void stopServer()
          Stop the server iff it is already started.
 void undeploy(java.net.URL url)
          Undeploy the package represented by the URL iff the server is started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerLifecycle

public ServerLifecycle(java.io.File jbossHomeDir)
                throws java.io.IOException
Create an instance using the "default" configuration in the jboss home dir.

Parameters:
jbossHomeDir - The path to the local jboss deployment.
Throws:
java.lang.NullPointerException - if the jboss home dir is null.
java.lang.IllegalArgumentException - if the jboss home dir does not exist.
java.io.IOException - if the jboss home dir path cannot be resolved.

ServerLifecycle

public ServerLifecycle(java.io.File jbossHomeDir,
                       java.lang.String configuration)
                throws java.io.IOException
Create an instance using the specified configuration in the jboss home dir.

Parameters:
jbossHomeDir - The path to the local jboss deployment.
configuration - The configuration name.
Throws:
java.lang.NullPointerException - if the jboss home dir or configuration name is null.
java.lang.IllegalArgumentException - if the jboss home dir does not exist.
java.io.IOException - if the jboss home dir path cannot be resolved.
Method Detail

isStarted

public boolean isStarted()
Returns:
true if the server is started; false otherwise.

startServer

public void startServer()
                 throws java.lang.Exception
Start the server. This is a blocking operation.

Throws:
java.lang.Exception - if the server fails to start.

stopServer

public void stopServer()
Stop the server iff it is already started.


deploy

public LocalInterfaceRegistry deploy(java.net.URL url)
                              throws java.lang.Exception
Deploy the package represented by the URL.

Parameters:
url - The URL representing the package to deploy.
Returns:
The local interface registry.
Throws:
java.lang.IllegalStateException - if the server is not started.
java.lang.Exception - if the package cannot be deployed.

undeploy

public void undeploy(java.net.URL url)
              throws java.lang.Exception
Undeploy the package represented by the URL iff the server is started.

Parameters:
url - The URL representing the package to undeploy.
Throws:
java.lang.Exception - if the package cannot be undeployed.

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.