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

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


    @Test
    public void testStaticResourceInjectionWithInjectionServices() {

        // Create the BDA in which we will deploy FooExtension. This BDA does not have access to bda2
        final BeanDeploymentArchive bda = new BeanDeploymentArchiveImpl("1", InjectedClass.class) {
            @Override
            protected void configureServices() {
                getServices().add(InjectionServices.class, new TestInjectionServices());
            }
        };
View Full Code Here


public class EmptyBeanDeploymentArchive implements BeanDeploymentArchive {

    private final ServiceRegistry services = new SimpleServiceRegistry();

    public EmptyBeanDeploymentArchive() {
        this.services.add(EjbInjectionServices.class, new MockEjbInjectionServices());
        this.services.add(JpaInjectionServices.class, new MockJpaInjectionServices());
        this.services.add(ResourceInjectionServices.class, new MockResourceInjectionServices());
    }
View Full Code Here

               HttpSessionManager sessionManager = Utils.getBeanReference(manager, HttpSessionManager.class);

               HttpSession session = sessionStore.get(id.getId());
               if(session == null)
               {
                  session = new MockHttpSession(id.getId(), new MockServletContext("/"));
               }
               sessionManager.setSession(session);
               sessionStore.put(id.getId(), session);
            }
         }
View Full Code Here

    private final ServiceRegistry services = new SimpleServiceRegistry();

    public EmptyBeanDeploymentArchive() {
        this.services.add(EjbInjectionServices.class, new MockEjbInjectionServices());
        this.services.add(JpaInjectionServices.class, new MockJpaInjectionServices());
        this.services.add(ResourceInjectionServices.class, new MockResourceInjectionServices());
    }
View Full Code Here

    private final ServiceRegistry services = new SimpleServiceRegistry();

    public EmptyBeanDeploymentArchive() {
        this.services.add(EjbInjectionServices.class, new MockEjbInjectionServices());
        this.services.add(JpaInjectionServices.class, new MockJpaInjectionServices());
        this.services.add(ResourceInjectionServices.class, new MockResourceInjectionServices());
    }
View Full Code Here

               HttpSessionManager sessionManager = Utils.getBeanReference(manager, HttpSessionManager.class);

               HttpSession session = sessionStore.get(id.getId());
               if(session == null)
               {
                  session = new MockHttpSession(id.getId(), new MockServletContext("/"));
               }
               sessionManager.setSession(session);
               sessionStore.put(id.getId(), session);
            }
         }
View Full Code Here

     * @return
     */
    public static Test suite() {
        // Create and start the TestContainer, which takes care of starting the container, deploying the
        // classes, starting the contexts etc.
        TestContainer container = new TestContainer(

                // The classes to deploy as beans
                Convertible.class,
                Seat.class,
                V8Engine.class,
                Cupholder.class,
                FuelTank.class,
                Tire.class,
                // Producer Methods allowing to expose DriversSeat, SpareTire, @Named("spare") SpareTire, @Drivers Seat
                Producers.class
        );
        container.startContainer();

        // Our entry point is the single bean deployment archive
        BeanManager beanManager = container.getBeanManager(container.getDeployment().getBeanDeploymentArchives().iterator().next());

        // Obtain a reference to the Car and pass it to the TCK to generate the testsuite
        Bean<?> bean = beanManager.resolve(beanManager.getBeans(Car.class));
        Car instance = (Car) beanManager.getReference(bean, Car.class, beanManager.createCreationalContext(bean));

View Full Code Here

public class InjectionServicesTest {

    @Test
    public void testInjectionOfTarget() {
        TestContainer container = new TestContainer(Foo.class, Bar.class);
        CheckableInjectionServices ijs = new CheckableInjectionServices();
        for (BeanDeploymentArchive bda : container.getDeployment().getBeanDeploymentArchives()) {
            bda.getServices().add(InjectionServices.class, ijs);
        }
        container.startContainer();
        container.ensureRequestActive();

        BeanManager manager = getBeanManager(container);

        Bean<? extends Object> bean = manager.resolve(manager.getBeans(Foo.class));
        ijs.reset();
        Foo foo = (Foo) manager.getReference(bean, Foo.class, manager.createCreationalContext(bean));

        Assert.assertTrue(ijs.isBefore());
        Assert.assertTrue(ijs.isAfter());
        Assert.assertTrue(ijs.isInjectedAfter());
        Assert.assertTrue(ijs.isInjectionTargetCorrect());
        Assert.assertEquals(ijs.getAroundInjectForFooCalled(), 1);
        Assert.assertEquals(ijs.getAroundInjectForBarCalled(), 1);

        Assert.assertNotNull(foo.getBar());
        Assert.assertEquals("hi!", foo.getMessage());


        container.stopContainer();
    }
View Full Code Here

            public BeanDeploymentArchive getBeanDeploymentArchive(Class<?> beanClass) {
                return loadBeanDeploymentArchive(beanClass);
            }
        };

        TestContainer container = new TestContainer(deployment);
        // Cause the container to deploy the beans etc.
        container.startContainer();

        InjectionTarget<FooTarget> target = extension.getTarget();

        CreationalContext<FooTarget> ctx = container.getBeanManager(bda2).createCreationalContext(null);
        FooTarget instance = target.produce(ctx);
        target.postConstruct(instance);
        target.inject(instance, ctx);

        /*
 
View Full Code Here

public class ContainerStatusTest {

    @Test
    public void testStatus() {
        TestContainer container = new TestContainer();
        Assert.assertFalse(Container.available());
        container.getBootstrap().startContainer(Environments.SE, container.getDeployment());
        Assert.assertFalse(Container.available());
        Assert.assertEquals(ContainerState.STARTING, Container.instance().getState());
        container.getBootstrap().startInitialization();
        Assert.assertFalse(Container.available());
        Assert.assertEquals(ContainerState.STARTING, Container.instance().getState());
        container.getBootstrap().deployBeans();
        Assert.assertTrue(Container.available());
        Assert.assertEquals(ContainerState.DEPLOYED, Container.instance().getState());
        container.getBootstrap().validateBeans();
        Assert.assertEquals(ContainerState.VALIDATED, Container.instance().getState());
        Assert.assertTrue(Container.available());
        container.getBootstrap().endInitialization();
        Assert.assertTrue(Container.available());
        Assert.assertEquals(ContainerState.INITIALIZED, Container.instance().getState());
        container.stopContainer();
        Assert.assertFalse(Container.available());
    }
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.