Class TestContainer
- java.lang.Object
-
- org.jboss.arquillian.container.weld.embedded.mock.TestContainer
-
public class TestContainer extends Object
Wrapper over Weld, exposing operations commonly required for executing tests with Weld.
TestContainerexposes a "Mock Java EE 6" view of Weld, allowing Weld to discover EE components, but not to invoke them.In general, we recommend using Arquillian to test CDI/Weld applications, however sometimes it useful to have greater control over the test, and in that case you may wish to use
TestContainer.Note that we can easily mix fine-grained calls to bootstrap, and coarse grained calls to
TestContainer.- Author:
- Pete Muir
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTestContainer.RunnerA further wrapper over TestContainer, allowing a test to be run.
-
Constructor Summary
Constructors Constructor Description TestContainer(Class<?>... classes)TestContainer(String beanArchiveId, org.jboss.weld.bootstrap.spi.BeansXml beansXml, Collection<Class<?>> classes)TestContainer(String beanArchiveId, org.jboss.weld.bootstrap.spi.BeansXml beansXml, Collection<Class<?>> classes, org.jboss.weld.bootstrap.api.Environment environment, boolean merge)TestContainer(Collection<URL> beansXml, Collection<Class<?>> classes)TestContainer(org.jboss.weld.bootstrap.spi.BeansXml beansXml, Class<?>... classes)Create a container, specifying the classes and beans.xml to deployTestContainer(org.jboss.weld.bootstrap.spi.BeansXml beansXml, Collection<Class<?>> classes)Create a container, specifying the classes and beans.xml to deployTestContainer(org.jboss.weld.bootstrap.spi.Deployment deployment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestContainerensureRequestActive()org.jboss.weld.manager.api.WeldManagergetBeanManager(org.jboss.weld.bootstrap.spi.BeanDeploymentArchive beanDeploymentArchive)org.jboss.weld.bootstrap.api.BootstrapgetBootstrap()org.jboss.weld.bootstrap.spi.DeploymentgetDeployment()Map<String,Object>getSessionStore()jakarta.enterprise.inject.Instance<jakarta.enterprise.context.spi.Context>instance()TestContainerstartContainer()TestContainerstartContainer(org.jboss.weld.bootstrap.api.Environment environment)Starts the container and begins the applicationTestContainerstopContainer()Clean up the container, ending any active contexts
-
-
-
Constructor Detail
-
TestContainer
public TestContainer(org.jboss.weld.bootstrap.spi.BeansXml beansXml, Collection<Class<?>> classes)Create a container, specifying the classes and beans.xml to deploy- Parameters:
lifecycle-classes-beansXml-
-
TestContainer
public TestContainer(Collection<URL> beansXml, Collection<Class<?>> classes)
-
TestContainer
public TestContainer(String beanArchiveId, org.jboss.weld.bootstrap.spi.BeansXml beansXml, Collection<Class<?>> classes)
-
TestContainer
public TestContainer(String beanArchiveId, org.jboss.weld.bootstrap.spi.BeansXml beansXml, Collection<Class<?>> classes, org.jboss.weld.bootstrap.api.Environment environment, boolean merge)
-
TestContainer
public TestContainer(org.jboss.weld.bootstrap.spi.BeansXml beansXml, Class<?>... classes)Create a container, specifying the classes and beans.xml to deploy- Parameters:
lifecycle-classes-beansXml-
-
TestContainer
public TestContainer(Class<?>... classes)
-
TestContainer
public TestContainer(org.jboss.weld.bootstrap.spi.Deployment deployment)
-
-
Method Detail
-
ensureRequestActive
public TestContainer ensureRequestActive()
-
startContainer
public TestContainer startContainer()
-
startContainer
public TestContainer startContainer(org.jboss.weld.bootstrap.api.Environment environment)
Starts the container and begins the application
-
getBeanManager
public org.jboss.weld.manager.api.WeldManager getBeanManager(org.jboss.weld.bootstrap.spi.BeanDeploymentArchive beanDeploymentArchive)
-
getDeployment
public org.jboss.weld.bootstrap.spi.Deployment getDeployment()
-
stopContainer
public TestContainer stopContainer()
Clean up the container, ending any active contexts
-
instance
public jakarta.enterprise.inject.Instance<jakarta.enterprise.context.spi.Context> instance()
-
getBootstrap
public org.jboss.weld.bootstrap.api.Bootstrap getBootstrap()
-
-