public class TestContainer extends Object
Wrapper over Weld, exposing operations commonly required for executing tests
with Weld. TestContainer
exposes 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
.
Modifier and Type | Class and Description |
---|---|
static class |
TestContainer.Runner
A further wrapper over TestContainer, allowing a test to be run.
|
Constructor and Description |
---|
TestContainer(org.jboss.weld.bootstrap.spi.BeansXml beansXml,
Class<?>... classes)
Create a container, specifying the classes and beans.xml to deploy
|
TestContainer(org.jboss.weld.bootstrap.spi.BeansXml beansXml,
Collection<Class<?>> classes)
Create a container, specifying the classes and beans.xml to deploy
|
TestContainer(Class<?>... classes) |
TestContainer(Collection<URL> beansXml,
Collection<Class<?>> classes) |
TestContainer(org.jboss.weld.bootstrap.spi.Deployment deployment) |
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) |
Modifier and Type | Method and Description |
---|---|
TestContainer |
ensureRequestActive() |
org.jboss.weld.manager.api.WeldManager |
getBeanManager(org.jboss.weld.bootstrap.spi.BeanDeploymentArchive beanDeploymentArchive) |
org.jboss.weld.bootstrap.api.Bootstrap |
getBootstrap() |
org.jboss.weld.bootstrap.spi.Deployment |
getDeployment() |
Map<String,Object> |
getSessionStore() |
javax.enterprise.inject.Instance<javax.enterprise.context.spi.Context> |
instance() |
TestContainer |
startContainer() |
TestContainer |
startContainer(org.jboss.weld.bootstrap.api.Environment environment)
Starts the container and begins the application
|
TestContainer |
stopContainer()
Clean up the container, ending any active contexts
|
public TestContainer(org.jboss.weld.bootstrap.spi.BeansXml beansXml, Collection<Class<?>> classes)
lifecycle
- classes
- beansXml
- public TestContainer(Collection<URL> beansXml, Collection<Class<?>> classes)
public TestContainer(String beanArchiveId, org.jboss.weld.bootstrap.spi.BeansXml beansXml, Collection<Class<?>> classes)
public TestContainer(String beanArchiveId, org.jboss.weld.bootstrap.spi.BeansXml beansXml, Collection<Class<?>> classes, org.jboss.weld.bootstrap.api.Environment environment, boolean merge)
public TestContainer(org.jboss.weld.bootstrap.spi.BeansXml beansXml, Class<?>... classes)
lifecycle
- classes
- beansXml
- public TestContainer(Class<?>... classes)
public TestContainer(org.jboss.weld.bootstrap.spi.Deployment deployment)
public TestContainer ensureRequestActive()
public TestContainer startContainer()
public TestContainer startContainer(org.jboss.weld.bootstrap.api.Environment environment)
public org.jboss.weld.manager.api.WeldManager getBeanManager(org.jboss.weld.bootstrap.spi.BeanDeploymentArchive beanDeploymentArchive)
public org.jboss.weld.bootstrap.spi.Deployment getDeployment()
public TestContainer stopContainer()
public javax.enterprise.inject.Instance<javax.enterprise.context.spi.Context> instance()
public org.jboss.weld.bootstrap.api.Bootstrap getBootstrap()
Copyright © 2017 JBoss by Red Hat. All rights reserved.