Package org.apache.webbeans.test.mock

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


    public void testProducer4()
    {
        defineSimpleWebBean(Producer4.class);
        AbstractBean<Producer4ConsumerComponent> component = defineSimpleWebBean(Producer4ConsumerComponent.class);

        ContextFactory.initSessionContext(new MockHttpSession());

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

        Assert.assertNotNull(instance);
View Full Code Here


    }

    @Test
    public void testSecureAndTransactionalInterceptor()
    {
        ContextFactory.initSessionContext(new MockHttpSession());
        defineSimpleWebBeanInterceptor(SecureAndTransactionalInterceptor.class);
       
        Bean<SecureAndTransactionalComponent> bean = defineSimpleWebBean(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

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

    public void testDisposal1()
    {
        clear();

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

        defineSimpleWebBean(Disposal1.class);

        EntityManager em = (EntityManager) getManager().getInstanceByName("createEntityManager");
        em.clear();
View Full Code Here

    public void testProducer4()
    {
        defineSimpleWebBean(Producer4.class);
        AbstractComponent<Producer4ConsumerComponent> component = defineSimpleWebBean(Producer4ConsumerComponent.class);

        ContextFactory.initSessionContext(new MockHttpSession());

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

        Assert.assertNotNull(instance);
View Full Code Here

    public Manager createManager()
    {
        ContextFactory.initApplicationContext(null);
        ContextFactory.initRequestContext(null);
        ContextFactory.initSessionContext(new MockHttpSession());
        ContextFactory.initConversationContext(null);
        return MockManager.getInstance();
    }
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.test.mock.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.