Package org.jboss.weld.manager

Examples of org.jboss.weld.manager.BeanManagerImpl.resolve()


            //it does not matter if this happens twice
            //we just look up the service rather than using a dependency
            //the component itself has a dependency on this service, which means that it has to be up
            final WeldContainer weldContainer = (WeldContainer) CurrentServiceContainer.getServiceContainer().getRequiredService(weldContainerServiceName).getValue();
            final BeanManagerImpl beanManager = (BeanManagerImpl) weldContainer.getBeanManager();
            final Bean<?> bean = beanManager.resolve(beanManager.getBeans(EjbRequestContext.class, EjbLiteral.INSTANCE));
            final CreationalContext<?> ctx = beanManager.createCreationalContext(bean);
            requestContext = (EjbRequestContext) beanManager.getReference(bean, EjbRequestContext.class, ctx);
        }
        try {
            requestContext.associate(context.getInvocationContext());
View Full Code Here


            //it does not matter if this happens twice
            //we just look up the service rather than using a dependency
            //the component itself has a dependency on this service, which means that it has to be up
            final WeldContainer weldContainer = (WeldContainer) CurrentServiceContainer.getServiceContainer().getRequiredService(weldContainerServiceName).getValue();
            final BeanManagerImpl beanManager = (BeanManagerImpl) weldContainer.getBeanManager();
            final Bean<?> bean = beanManager.resolve(beanManager.getBeans(EjbRequestContext.class, EjbLiteral.INSTANCE));
            final CreationalContext<?> ctx = beanManager.createCreationalContext(bean);
            requestContext = (EjbRequestContext) beanManager.getReference(bean, EjbRequestContext.class, ctx);
        }
        try {
            requestContext.associate(context.getInvocationContext());
View Full Code Here

        TestContainer container1 = new TestContainer(Foo.class);
        container1.startContainer();
        container1.ensureRequestActive();

        BeanManagerImpl beanManager1 = getBeanManager(container1);
        Bean<?> fooBean1 = beanManager1.resolve(beanManager1.getBeans(Foo.class));
        Foo foo1 = (Foo) beanManager1.getReference(fooBean1, Foo.class, beanManager1.createCreationalContext(fooBean1));
        foo1.setName("container 1");

        // Bootstrap container 2
        SwitchableSingletonProvider.use(2);
View Full Code Here

        TestContainer container2 = new TestContainer(Foo.class);
        container2.startContainer();
        container2.ensureRequestActive();

        BeanManagerImpl beanManager2 = getBeanManager(container2);
        Bean<?> fooBean2 = beanManager2.resolve(beanManager2.getBeans(Foo.class));
        Foo foo2 = (Foo) beanManager2.getReference(fooBean2, Foo.class, beanManager2.createCreationalContext(fooBean2));
        foo2.setName("container 2");

        // Switch to container 1 and check value
        SwitchableSingletonProvider.use(1);
View Full Code Here

    @Test(description = "A simple test to check session replication, doesn't carefully check if a bean ids are correct")
    public void testSimpleSessionReplication() throws Exception {

        TestContainer container1 = bootstrapContainer(1, Arrays.<Class<?>>asList(Foo.class));
        BeanManagerImpl beanManager1 = getBeanManager(container1);
        Bean<?> fooBean1 = beanManager1.resolve(beanManager1.getBeans(Foo.class));

        TestContainer container2 = bootstrapContainer(2, Arrays.<Class<?>>asList(Foo.class));
        BeanManagerImpl beanManager2 = getBeanManager(container2);
        Bean<?> fooBean2 = beanManager2.resolve(beanManager2.getBeans(Foo.class));
View Full Code Here

        BeanManagerImpl beanManager1 = getBeanManager(container1);
        Bean<?> fooBean1 = beanManager1.resolve(beanManager1.getBeans(Foo.class));

        TestContainer container2 = bootstrapContainer(2, Arrays.<Class<?>>asList(Foo.class));
        BeanManagerImpl beanManager2 = getBeanManager(container2);
        Bean<?> fooBean2 = beanManager2.resolve(beanManager2.getBeans(Foo.class));

        use(1);
        // Set a value into Foo1
        Foo foo1 = (Foo) beanManager1.getReference(fooBean1, Foo.class, beanManager1.createCreationalContext(fooBean1));
        foo1.setName("container 1");
View Full Code Here

    @Test
    public void testMultipleDependentObjectsSessionReplication() throws Exception {
        Collection<Class<?>> classes = Arrays.<Class<?>>asList(Stable.class, Horse.class, Fodder.class);
        TestContainer container1 = bootstrapContainer(1, classes);
        BeanManagerImpl beanManager1 = getBeanManager(container1);
        Bean<?> stableBean1 = beanManager1.resolve(beanManager1.getBeans(Stable.class));

        TestContainer container2 = bootstrapContainer(2, classes);
        BeanManagerImpl beanManager2 = getBeanManager(container2);
        Bean<?> stableBean2 = beanManager2.resolve(beanManager2.getBeans(Stable.class));
View Full Code Here

        BeanManagerImpl beanManager1 = getBeanManager(container1);
        Bean<?> stableBean1 = beanManager1.resolve(beanManager1.getBeans(Stable.class));

        TestContainer container2 = bootstrapContainer(2, classes);
        BeanManagerImpl beanManager2 = getBeanManager(container2);
        Bean<?> stableBean2 = beanManager2.resolve(beanManager2.getBeans(Stable.class));

        use(1);
        // Set a value into Foo1
        Stable stable1 = (Stable) beanManager1.getReference(stableBean1, Stable.class, beanManager1.createCreationalContext(stableBean1));
        stable1.getFodder().setAmount(10);
View Full Code Here

        // NB This is not a valid deployment scenario for a cluster, but it does allow us to test bean ids neatly!
        Collection<Class<?>> classes1 = Arrays.<Class<?>>asList(Stable.class, Horse.class, Fodder.class);
        Collection<Class<?>> classes2 = Arrays.<Class<?>>asList(Stable.class, Horse.class, Fodder.class, Foo.class);
        TestContainer container1 = bootstrapContainer(1, classes1);
        BeanManagerImpl beanManager1 = getBeanManager(container1);
        Bean<?> stableBean1 = beanManager1.resolve(beanManager1.getBeans(Stable.class));

        TestContainer container2 = bootstrapContainer(2, classes2);
        BeanManagerImpl beanManager2 = getBeanManager(container2);
        Bean<?> stableBean2 = beanManager2.resolve(beanManager2.getBeans(Stable.class));
View Full Code Here

        BeanManagerImpl beanManager1 = getBeanManager(container1);
        Bean<?> stableBean1 = beanManager1.resolve(beanManager1.getBeans(Stable.class));

        TestContainer container2 = bootstrapContainer(2, classes2);
        BeanManagerImpl beanManager2 = getBeanManager(container2);
        Bean<?> stableBean2 = beanManager2.resolve(beanManager2.getBeans(Stable.class));

        use(1);
        // Set a value into Foo1
        Stable stable1 = (Stable) beanManager1.getReference(stableBean1, Stable.class, beanManager1.createCreationalContext(stableBean1));
        stable1.getFodder().setAmount(10);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.