Package org.apache.webbeans.newtests.interceptors.beans

Examples of org.apache.webbeans.newtests.interceptors.beans.RequestScopedBean


            Object reference1 = getBeanManager().getReference(bean, RequestScopedBean.class, ctx);
            Assert.assertNotNull(reference1);

            Assert.assertTrue(reference1 instanceof RequestScopedBean);

            RequestScopedBean beanInstance1 = (RequestScopedBean)reference1;

            TransactionInterceptor.count = 0;

            for (int i= 1; i < ITERATIONS; i++)
            {
                beanInstance1.getMyService();
            }

            getWebBeansContext().getContextsService().endContext(RequestScoped.class, servletRequestEvent);
        }
View Full Code Here


        startContainer(beanClasses, beanXmls);

        for (int i = 1; i < 100; i++)
        {
            RequestScopedBean rb1 = getInstance("requestScopedBean");
            Assert.assertNotNull(rb1);
            Assert.assertNotNull(rb1.getInstance());

            getLifecycle().getContextService().endContext(RequestScoped.class, null);

            // and now the 2nd request
            getLifecycle().getContextService().startContext(RequestScoped.class, null);
View Full Code Here

                    Object reference1 = getBeanManager().getReference(bean, RequestScopedBean.class, ctx);
                    Assert.assertNotNull(reference1);

                    Assert.assertTrue(reference1 instanceof RequestScopedBean);

                    RequestScopedBean beanInstance1 = (RequestScopedBean)reference1;

                    TransactionInterceptor.count = 0;

                    long start = System.nanoTime();

                    for (int i= 1; i < ITERATIONS; i++)
                    {
                        beanInstance1.getI();
                        beanInstance1.getMyService().getJ();
                    }

                    WebBeansContext.currentInstance().getContextFactory().destroyRequestContext(null);
                }
            }
View Full Code Here

        Object reference1 = getBeanManager().getReference(bean, RequestScopedBean.class, ctx);
        Assert.assertNotNull(reference1);
       
        Assert.assertTrue(reference1 instanceof RequestScopedBean);

        RequestScopedBean beanInstance1 = (RequestScopedBean)reference1;
       
        TransactionInterceptor.count = 0;
       
        beanInstance1.getMyService().getJ();

        RequestScopedBean realInstance1 = beanInstance1.getInstance();
       
        Assert.assertTrue(TransactionInterceptor.ECHO);
        Assert.assertEquals(2, TransactionInterceptor.count);

        TransactionInterceptor.ECHO = false;

        WebBeansContext webBeansContext = WebBeansContext.getInstance();
        webBeansContext.getContextFactory().destroyRequestContext(null);
        webBeansContext.getContextFactory().initRequestContext(null);

        CreationalContext<RequestScopedBean> ctx2 = getBeanManager().createCreationalContext(bean);
        Object reference2 = getBeanManager().getReference(bean, RequestScopedBean.class, ctx2);
        Assert.assertNotNull(reference2);
       
        Assert.assertTrue(reference2 instanceof RequestScopedBean);
       
        RequestScopedBean beanInstance2 = (RequestScopedBean)reference2;
        beanInstance2.getMyService().getJ();
        RequestScopedBean realInstance2 = beanInstance2.getInstance();

        Assert.assertTrue(TransactionInterceptor.ECHO);

        Assert.assertEquals(4, TransactionInterceptor.count);
       
        Assert.assertNotSame(realInstance1, realInstance2);
        Assert.assertEquals(realInstance1.getMyService().getJ(), realInstance2.getMyService().getJ());
       
        shutDownContainer();
       
    }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.newtests.interceptors.beans.RequestScopedBean

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.