Package org.jboss.arquillian.container.weld.ee.embedded_1_1

Examples of org.jboss.arquillian.container.weld.ee.embedded_1_1.WeldEEMockContainer


public class InjectionTargetCreationTest {

    @Test
    public void test() {
        // Create the BDA in which we will deploy FooExtension. This BDA does not have access to bda2
        final BeanDeploymentArchive bda1 = new BeanDeploymentArchiveImpl("1", FooExtension.class);

        // Create the BDA in which we will deploy FooTarget and SimpleBean. This BDA does not have access to bda1
        final BeanDeploymentArchive bda2 = new BeanDeploymentArchiveImpl("2", SimpleBean.class, FooTarget.class);

        final FooExtension extension = new FooExtension();

        // Create a deployment, that we can use to mirror the structure of one Extension inside a BDA, and one outside
        Deployment deployment = new AbstractDeployment(ImmutableSet.of(bda1, bda2), transform(extension)) {
View Full Code Here


    * description = "WELD-233"
    */
    @Test
    public void test() {
        // Create the BDA in which we will deploy Observer1 and Foo. This is equivalent to a war or ejb jar
        final BeanDeploymentArchiveImpl bda1 = new BeanDeploymentArchiveImpl("1", Observer1.class, Foo.class);

        // Create the BDA to return from loadBeanDeploymentArchive for Observer2, this is probably a library, though could be another war or ejb jar
        // bda2 is accessible from bda1, but isn't added to it's accessibility graph by default. This similar to an archive which doesn't contain a beans.xml but does contain an extension
        final BeanDeploymentArchive bda2 = new BeanDeploymentArchiveImpl("2", Observer2.class);

        // Create a deployment, that we can use to mirror the structure of one Extension inside a BDA, and one outside
        Deployment deployment = new AbstractDeployment(bda1, new Observer1(), new Observer2(), new CountingObserver1(), new CountingObserver2()) {

            public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass) {
View Full Code Here

    * description = "WELD-258"
    */
    @Test
    public void testEventsSentOnceOnly() {
        // Create the BDA in which we will deploy Observer1 and Foo. This is equivalent to a war or ejb jar
        final BeanDeploymentArchiveImpl bda1 = new BeanDeploymentArchiveImpl("1", CountingObserver1.class, Foo.class);

        // Create the BDA to return from loadBeanDeploymentArchive for Observer2, this is probably a library, though could be another war or ejb jar
        // bda2 is accessible from bda1, but isn't added to it's accessibility graph by default. This similar to an archive which doesn't contain a beans.xml but does contain an extension
        final BeanDeploymentArchive bda2 = new BeanDeploymentArchiveImpl("2", CountingObserver2.class);

        // Create a deployment, that we can use to mirror the structure of one Extension inside a BDA, and one outside
        Deployment deployment = new AbstractDeployment(bda1, new Observer1(), new Observer2(), new CountingObserver1(), new CountingObserver2()) {

            public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass) {
View Full Code Here

    /*
    * description = "WELD-319"
    */
    @Test
    public void testBeansXmlIsolation() {
        BeanDeploymentArchiveImpl jar1 = new BeanDeploymentArchiveImpl("first-jar", new BeansXmlImpl(Arrays.asList(Alt.class.getName()), null, null, null), Alt.class);
        BeanDeploymentArchiveImpl jar2 = new BeanDeploymentArchiveImpl("second-jar", Alt2.class);
        BeanDeploymentArchiveImpl war = new BeanDeploymentArchiveImpl("war");
        war.getBeanDeploymentArchives().add(jar1);
        war.getBeanDeploymentArchives().add(jar2);

        Deployment deployment = new FlatDeployment(war);

        TestContainer container = null;
        try {
View Full Code Here

    /*
    * description = "WELD-319"
    */
    @Test
    public void testBeansXmlMultipleEnabling() {
        BeanDeploymentArchiveImpl jar1 = new BeanDeploymentArchiveImpl("first-jar", new BeansXmlImpl(Arrays.asList(Alt.class.getName()), null, null, null), Alt.class);
        BeanDeploymentArchiveImpl jar2 = new BeanDeploymentArchiveImpl("second-jar", new BeansXmlImpl(Arrays.asList(Alt2.class.getName()), Collections.<String>emptyList(), null, null), Alt2.class);
        BeanDeploymentArchiveImpl war = new BeanDeploymentArchiveImpl("war");
        war.getBeanDeploymentArchives().add(jar1);
        war.getBeanDeploymentArchives().add(jar2);

        Deployment deployment = new FlatDeployment(war);

        TestContainer container = null;
        try {
View Full Code Here

    @Test
    public void testTypicalEarStructure() {

        // Create the BDA in which we will deploy Foo. This is equivalent to a ejb
        // jar
        final BeanDeploymentArchiveImpl ejbJar = new BeanDeploymentArchiveImpl("ejb-jar", Foo.class);

        // Create the BDA in which we will deploy Bar. This is equivalent to a war
        final BeanDeploymentArchiveImpl war = new BeanDeploymentArchiveImpl("war", Bar.class);

        // The war can access the ejb jar
        war.getBeanDeploymentArchives().add(ejbJar);

        // Create a deployment, any other classes are put into the ejb-jar (not
        // relevant to test)
        Deployment deployment = new AbstractDeployment(war, ejbJar) {
View Full Code Here

    @Test
    public void testInterceptorEnabledInWarButPackagedInEjbJar() {

        // Create the BDA in which we will deploy Foo. This is equivalent to a ejb
        // jar
        final BeanDeploymentArchiveImpl ejbJar = new BeanDeploymentArchiveImpl("ejb-jar", Basic.class, BasicInterceptor.class, Simple.class);

        // Create the BDA in which we will deploy Bar. This is equivalent to a war
        BeansXml beansXml = new BeansXmlImpl(null, null, null, asList(BasicInterceptor.class.getName()));
        final BeanDeploymentArchiveImpl war = new BeanDeploymentArchiveImpl("war", beansXml, Complex.class);

        // The war can access the ejb jar
        war.getBeanDeploymentArchives().add(ejbJar);

        // Create a deployment, any other classes are put into the ejb-jar (not
        // relevant to test)
        Deployment deployment = new AbstractDeployment(ejbJar, war) {
View Full Code Here

    @Test
    public void testDecoratorEnabledInWarButPackagedInEjbJar() {

        // Create the BDA in which we will deploy Foo. This is equivalent to a ejb
        // jar
        final BeanDeploymentArchiveImpl ejbJar = new BeanDeploymentArchiveImpl("ejb-jar", Blah.class, BlahDecorator.class, BlahImpl.class);

        // Create the BDA in which we will deploy Bar. This is equivalent to a war
        BeansXml beansXml = new BeansXmlImpl(null, null, asList(BlahDecorator.class.getName()), null);
        final BeanDeploymentArchiveImpl war = new BeanDeploymentArchiveImpl("war", beansXml, BlahImpl2.class);

        // The war can access the ejb jar
        war.getBeanDeploymentArchives().add(ejbJar);

        // Create a deployment, any other classes are put into the ejb-jar (not
        // relevant to test)
        Deployment deployment = new AbstractDeployment(war, ejbJar) {
View Full Code Here

    public void prepareContainer() {
        final EjbDescriptor<Foo> fooDescriptor = new EjbDescriptorImpl<Foo>(Foo.class, Foo.class, EnhancedFoo.class, SessionBeanType.STATEFUL);
        final EjbDescriptor<Bar> barDescriptor = new EjbDescriptorImpl<Bar>(Bar.class, BarLocal.class, EnhancedBar.class, SessionBeanType.STATEFUL);
        final EjbDescriptor<Baz> bazDescriptor = new EjbDescriptorImpl<Baz>(Baz.class, Baz.class, EnhancedBaz.class, null);

        final BeanDeploymentArchive bda = new BeanDeploymentArchiveImpl("1",
                Foo.class,
                Bar.class,
                BarLocal.class,
                BarDecorator.class,
                BarInterceptor.class,
View Full Code Here

    protected TestContainer bootstrapContainer(int id, Collection<Class<?>> classes) {
        // Bootstrap container
        SwitchableSingletonProvider.use(id);

        TestContainer container = new TestContainer(new FlatDeployment(new BeanDeploymentArchiveImpl(classes)));
        container.getDeployment().getServices().add(ProxyServices.class, new SwitchableCLProxyServices());
        container.startContainer();
        container.ensureRequestActive();

        return container;
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.container.weld.ee.embedded_1_1.WeldEEMockContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.