org.jboss.test
Class JBossTestSetup

java.lang.Object
  extended byTestSetup
      extended byorg.jboss.test.JBossTestSetup
Direct Known Subclasses:
AOPTestSetup (src) , JBossTestClusteredSetup (src) , Setup (src)

public class JBossTestSetup
extends TestSetup

This is a TestSetup class for jboss junit test cases that provides the jboss test services. It supplies access to log4j logging, the jboss jmx server, jndi, and a method for deploying ejb packages. You may supply the name of the machine the jboss server is on with the system property jbosstest.server.name (default getInetAddress().getLocalHost().getHostName()) and the directory for deployable packages with the system property jbosstest.deploy.dir (default ../lib). Should be sublassed to derive junit support for specific services integrated into JBoss.

See Also:
Serialized Form

Field Summary
protected  JBossTestServices (src) delegate
           
 
Constructor Summary
JBossTestSetup(Test test)
          Constructor for the JBossTestCase object
 
Method Summary
protected  JBossTestServices (src) createTestServices()
           
protected  void deploy(java.lang.String name)
          Deploy a package with the main deployer.
protected  void flushAuthCache()
           
protected  void flushAuthCache(java.lang.String domain)
           
protected  int getBeanCount()
           
protected  ObjectName (src) getDeployerName()
          Gets the DeployerName attribute of the JBossTestCase object
protected  java.lang.String getDeployURL(java.lang.String filename)
          Returns the deployment directory to use.
protected  javax.naming.InitialContext getInitialContext()
          Gets the InitialContext attribute of the JBossTestCase object
protected  int getIterationCount()
           
protected  java.lang.String getJndiInitFactory()
           
protected  java.lang.String getJndiURL()
           
protected  Category getLog()
          Gets the Log attribute of the JBossTestCase object
protected  java.lang.String getResourceURL(java.lang.String path)
           
protected  RMIAdaptor (src) getServer()
          Gets the Server attribute of the JBossTestCase object
 java.lang.String getServerHost()
          Get the JBoss server host from system property "jbosstest.host.name" This defaults to "localhost"
protected  int getThreadCount()
           
protected  java.lang.Object invoke(ObjectName (src)  name, java.lang.String method, java.lang.Object[] args, java.lang.String[] sig)
          invoke wraps an invoke call to the mbean server in a lot of exception unwrapping.
protected  void redeploy(java.lang.String name)
           
protected  void restartDBPool()
          Restart the connection pool associated with the DefaultDS
protected  void undeploy(java.lang.String name)
          Undeploy a package with the main deployer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

protected JBossTestServices (src)  delegate
Constructor Detail

JBossTestSetup

public JBossTestSetup(Test test)
               throws java.lang.Exception
Constructor for the JBossTestCase object

Method Detail

createTestServices

protected JBossTestServices (src)  createTestServices()

getInitialContext

protected javax.naming.InitialContext getInitialContext()
                                                 throws java.lang.Exception
Gets the InitialContext attribute of the JBossTestCase object

Returns:
The InitialContext value
Throws:
java.lang.Exception

getServer

protected RMIAdaptor (src)  getServer()
                        throws java.lang.Exception
Gets the Server attribute of the JBossTestCase object

Returns:
The Server value
Throws:
java.lang.Exception

getLog

protected Category getLog()
Gets the Log attribute of the JBossTestCase object

Returns:
The Log value

getDeployerName

protected ObjectName (src)  getDeployerName()
                              throws MalformedObjectNameException (src) 
Gets the DeployerName attribute of the JBossTestCase object

Returns:
The DeployerName value
Throws:
MalformedObjectNameException (src) - Description of Exception

getDeployURL

protected java.lang.String getDeployURL(java.lang.String filename)
                                 throws java.net.MalformedURLException
Returns the deployment directory to use. This does it's best to figure out where you are looking. If you supply a complete url, it returns it. Otherwise, it looks for jbosstest.deploy.dir or if missing ../lib. Then it tries to construct a file url or a url.

Parameters:
filename - name of the file/url you want
Returns:
A more or less canonical string for the url.
Throws:
java.net.MalformedURLException - Description of Exception

getResourceURL

protected java.lang.String getResourceURL(java.lang.String path)

invoke

protected java.lang.Object invoke(ObjectName (src)  name,
                                  java.lang.String method,
                                  java.lang.Object[] args,
                                  java.lang.String[] sig)
                           throws java.lang.Exception
invoke wraps an invoke call to the mbean server in a lot of exception unwrapping.

Parameters:
name - ObjectName of the mbean to be called
method - mbean method to be called
args - Object[] of arguments for the mbean method.
sig - String[] of types for the mbean methods parameters.
Returns:
Object returned by mbean method invocation.
Throws:
java.lang.Exception - Description of Exception

deploy

protected void deploy(java.lang.String name)
               throws java.lang.Exception
Deploy a package with the main deployer. The supplied name is interpreted as a url, or as a filename in jbosstest.deploy.lib or ../lib.

Parameters:
name - filename/url of package to deploy.
Throws:
java.lang.Exception - Description of Exception

redeploy

protected void redeploy(java.lang.String name)
                 throws java.lang.Exception
Throws:
java.lang.Exception

undeploy

protected void undeploy(java.lang.String name)
                 throws java.lang.Exception
Undeploy a package with the main deployer. The supplied name is interpreted as a url, or as a filename in jbosstest.deploy.lib or ../lib.

Parameters:
name - filename/url of package to undeploy.
Throws:
java.lang.Exception - Description of Exception

flushAuthCache

protected void flushAuthCache()
                       throws java.lang.Exception
Throws:
java.lang.Exception

flushAuthCache

protected void flushAuthCache(java.lang.String domain)
                       throws java.lang.Exception
Throws:
java.lang.Exception

restartDBPool

protected void restartDBPool()
                      throws java.lang.Exception
Restart the connection pool associated with the DefaultDS

Throws:
java.lang.Exception - on failure

getJndiURL

protected java.lang.String getJndiURL()

getJndiInitFactory

protected java.lang.String getJndiInitFactory()

getThreadCount

protected int getThreadCount()

getIterationCount

protected int getIterationCount()

getBeanCount

protected int getBeanCount()

getServerHost

public java.lang.String getServerHost()
Get the JBoss server host from system property "jbosstest.host.name" This defaults to "localhost"