Package org.apache.webbeans.lifecycle.test

Examples of org.apache.webbeans.lifecycle.test.MockHttpSession


    }

    @Test
    public void testTransactionalInterceptor()
    {
        ContextFactory.initSessionContext(new MockHttpSession());
       
        // Interceptors must explicitly get enabled via XML. We fake this:
        InterceptorsManager.getInstance().addNewInterceptor(TransactionalInterceptor.class);
       
        defineInterceptor(TransactionalInterceptor.class);
       
        Bean<ShoppingCard> bean = defineManagedBean(ShoppingCard.class);
        ShoppingCard card = getManager().getInstance(bean);
       
        card.placeOrder();
       
        Assert.assertTrue(ShoppingCard.getCALLED());
       
        card.placeOrder2();
       
        Assert.assertFalse(ShoppingCard.getCALLED());
               
        ContextFactory.destroySessionContext(new MockHttpSession());
    }
View Full Code Here


    }

    @Test
    public void testSecureAndTransactionalInterceptor()
    {
        ContextFactory.initSessionContext(new MockHttpSession());
        defineInterceptor(SecureAndTransactionalInterceptor.class);
       
        Bean<SecureAndTransactionalComponent> bean = defineManagedBean(SecureAndTransactionalComponent.class);
        SecureAndTransactionalComponent payment = getManager().getInstance(bean);
       
        Assert.assertFalse(SecureAndTransactionalComponent.getCALL());
       
        payment.pay();
       
        Assert.assertTrue(SecureAndTransactionalComponent.getCALL());
       
               
        ContextFactory.destroySessionContext(new MockHttpSession());
    }
View Full Code Here

    public void testProducer4()
    {
        defineManagedBean(Producer4.class);
        AbstractOwbBean<Producer4ConsumerComponent> component = defineManagedBean(Producer4ConsumerComponent.class);

        ContextFactory.initSessionContext(new MockHttpSession());

        Producer4ConsumerComponent instance = getManager().getInstance(component);

        Assert.assertNotNull(instance);
View Full Code Here

    public void testDisposal1()
    {
        clear();

        ContextFactory.initRequestContext(null);
        ContextFactory.initSessionContext(new MockHttpSession());

        defineManagedBean(Disposal1.class);

        @SuppressWarnings("unchecked")
        List<Integer> list = (List<Integer>) getManager().getInstanceByName("createBinding1");
View Full Code Here

    }

   
    private void initializeContexts()
    {
        this.mockHttpSession = new MockHttpSession();
       
        ContextFactory.initRequestContext(null);
        ContextFactory.initSessionContext(mockHttpSession);
        ContextFactory.initConversationContext(null);
       
View Full Code Here

     *
     * @return new mock session
     */
    protected HttpSession getSession()
    {
        return new MockHttpSession();
    }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.lifecycle.test.MockHttpSession

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.