org.jboss.test.kernel.junit
Class MicrocontainerTestDelegate

java.lang.Object
  extended by org.jboss.test.AbstractTestDelegate
      extended by org.jboss.test.kernel.junit.MicrocontainerTestDelegate

public class MicrocontainerTestDelegate
extends org.jboss.test.AbstractTestDelegate

A MicrocontainerTestDelegate.

Version:
$Revision: 64256 $
Author:
Adrian Brock

Field Summary
protected  org.jboss.dependency.spi.ControllerMode defaultMode
          The default mode
protected  BasicXMLDeployer deployer
          The deployer
protected  Kernel kernel
          The kernel
 
Fields inherited from class org.jboss.test.AbstractTestDelegate
clazz, enableSecurity, log, logging, policy, securityPolicyName
 
Constructor Summary
MicrocontainerTestDelegate(Class clazz)
          Create a new MicrocontainerTestDelegate.
 
Method Summary
protected  org.jboss.dependency.spi.ControllerState change(KernelControllerContext context, org.jboss.dependency.spi.ControllerState required)
          Change the context to the given state
protected  BasicXMLDeployer createDeployer()
           
protected  void deploy()
          Deploy the beans
protected  KernelDeployment deploy(URL url)
          Deploy a url
protected  Object getBean(Object name, org.jboss.dependency.spi.ControllerState state)
          Get a bean
protected  AbstractBootstrap getBootstrap()
          Get the kernel bootstrap
protected  KernelControllerContext getControllerContext(Object name, org.jboss.dependency.spi.ControllerState state)
          Get a context
 org.jboss.dependency.spi.ControllerMode getDefaultMode()
          Get the defaultMode.
protected  KernelMetaDataRepository getMetaDataRepository()
          Get the metadata repository
protected  String getTestName()
           
protected  URL getTestResource(String testName)
           
protected  KernelControllerContext handleNotFoundContext(org.jboss.dependency.spi.Controller controller, Object name, org.jboss.dependency.spi.ControllerState state)
          Handle not found context.
 void setDefaultMode(org.jboss.dependency.spi.ControllerMode defaultMode)
          Set the defaultMode.
 void setUp()
           
protected  void shutdown()
           
 void tearDown()
           
protected  void undeploy()
          Undeploy all
protected  void undeploy(KernelDeployment deployment)
          Undeploy a deployment
protected  void undeploy(URL url)
          Undeploy a deployment
protected  void validate()
          Validate
 
Methods inherited from class org.jboss.test.AbstractTestDelegate
enableTrace, getDelegate, getLog, log, setUpLogging, setUpSecurity, tearDownLogging, tearDownSecurity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kernel

protected Kernel kernel
The kernel


deployer

protected BasicXMLDeployer deployer
The deployer


defaultMode

protected org.jboss.dependency.spi.ControllerMode defaultMode
The default mode

Constructor Detail

MicrocontainerTestDelegate

public MicrocontainerTestDelegate(Class clazz)
                           throws Exception
Create a new MicrocontainerTestDelegate.

Parameters:
clazz - the test class
Throws:
Exception - for any error
Method Detail

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class org.jboss.test.AbstractTestDelegate
Throws:
Exception

createDeployer

protected BasicXMLDeployer createDeployer()

tearDown

public void tearDown()
              throws Exception
Overrides:
tearDown in class org.jboss.test.AbstractTestDelegate
Throws:
Exception

getDefaultMode

public org.jboss.dependency.spi.ControllerMode getDefaultMode()
Get the defaultMode.

Returns:
the defaultMode.

setDefaultMode

public void setDefaultMode(org.jboss.dependency.spi.ControllerMode defaultMode)
Set the defaultMode.

Parameters:
defaultMode - the defaultMode.

getBootstrap

protected AbstractBootstrap getBootstrap()
                                  throws Exception
Get the kernel bootstrap

Returns:
the bootstrap
Throws:
Exception - for any error

getBean

protected Object getBean(Object name,
                         org.jboss.dependency.spi.ControllerState state)
Get a bean

Parameters:
name - the name of the bean
state - the state of the bean
Returns:
the bean
Throws:
IllegalStateException - when the bean does not exist at that state

getMetaDataRepository

protected KernelMetaDataRepository getMetaDataRepository()
Get the metadata repository

Returns:
the metadata repository
Throws:
IllegalStateException - when the bean does not exist at that state

getControllerContext

protected KernelControllerContext getControllerContext(Object name,
                                                       org.jboss.dependency.spi.ControllerState state)
Get a context

Parameters:
name - the name of the bean
state - the state of the bean
Returns:
the context
Throws:
IllegalStateException - when the context does not exist at that state

handleNotFoundContext

protected KernelControllerContext handleNotFoundContext(org.jboss.dependency.spi.Controller controller,
                                                        Object name,
                                                        org.jboss.dependency.spi.ControllerState state)
Handle not found context.

Parameters:
controller - the controller
name - the name of the bean
state - the state of the bean
Returns:
the context
Throws:
IllegalStateException - when the context does not exist at that state

change

protected org.jboss.dependency.spi.ControllerState change(KernelControllerContext context,
                                                          org.jboss.dependency.spi.ControllerState required)
                                                   throws Throwable
Change the context to the given state

Parameters:
context - the context
required - the required state
Returns:
the actual state
Throws:
Throwable - for any error

validate

protected void validate()
                 throws Exception
Validate

Throws:
Exception - for any error

deploy

protected KernelDeployment deploy(URL url)
                           throws Exception
Deploy a url

Parameters:
url - the deployment url
Returns:
the deployment
Throws:
Exception - for any error

undeploy

protected void undeploy(KernelDeployment deployment)
Undeploy a deployment

Parameters:
deployment - the deployment

undeploy

protected void undeploy(URL url)
Undeploy a deployment

Parameters:
url - the url

deploy

protected void deploy()
               throws Exception
Deploy the beans

Throws:
Exception - for any error

shutdown

protected void shutdown()

getTestName

protected String getTestName()

getTestResource

protected URL getTestResource(String testName)

undeploy

protected void undeploy()
Undeploy all



Copyright ? 2007 JBoss Inc.. All Rights Reserved.