Package org.apache.tuscany.core.context.event

Examples of org.apache.tuscany.core.context.event.HttpSessionEnd


     */
    @Override
    public void stop() {
        setModuleContext(null);
        moduleContext.publish(new RequestEnd(this, new Object()));
        moduleContext.publish(new HttpSessionEnd(this, sessionKey));
        moduleContext.publish(new ModuleStop(this));
        moduleContext.stop();
        monitor.moduleStopped(moduleContext.getName());
    }
View Full Code Here


    public void sessionDestroyed(HttpSessionEvent event) {
        // todo do we actually need to bind the module context to the thread to fire this event?
        ModuleContext oldContext = CurrentModuleContext.getContext();
        try {
            ContextBinder.BINDER.setContext((ModuleContext) moduleContext);
            moduleContext.publish(new HttpSessionEnd(this, event.getSession()));
        } finally{
            ContextBinder.BINDER.setContext(oldContext);
        }
    }
View Full Code Here

        SessionScopeComponent comp3 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp3);
        Assert.assertNotSame(comp1, comp3); // should be different instances
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);

        scope.onEvent(new HttpSessionEnd(this, session));
        scope.onEvent(new HttpSessionEnd(this, session2));
        scope.stop();
    }
View Full Code Here

        Assert.assertSame(comp1, comp2); // should be same instances
        Assert.assertSame(comp2, comp3); // should not be same instances
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);

        // shutdown sessions
        scope.onEvent(new HttpSessionEnd(this, session));
        scope.onEvent(new HttpSessionEnd(this, session2));

        scope.stop();
    }
View Full Code Here

        Assert.assertNotNull(comp3);
        Assert.assertNotSame(comp2, comp3);
        Assert.assertTrue(comp3.isInitialized());
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);

        scope.onEvent(new HttpSessionEnd(this, session));
        Assert.assertTrue(comp2.isDestroyed());

        scope.onEvent(new HttpSessionEnd(this, session2));
        Assert.assertTrue(comp3.isDestroyed());
        scope.stop();
    }
View Full Code Here

        Assert.assertNotNull(comp3);
        Assert.assertNotSame(comp2, comp3);
        Assert.assertTrue(comp3.isInitialized());
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);

        scope.onEvent(new HttpSessionEnd(this, session));
        Assert.assertTrue(comp2.isDestroyed());

        scope.onEvent(new HttpSessionEnd(this, session2));
        Assert.assertTrue(comp3.isDestroyed());
        scope.stop();
    }
View Full Code Here

        Assert.assertFalse(initDestroy.isDestroyed());
        Assert.assertFalse(destroyOnly.isDestroyed());
        // end request
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);
        // expire session
        scope.onEvent(new HttpSessionEnd(this,session));
        Assert.assertTrue(initDestroy.isDestroyed());
        Assert.assertTrue(destroyOnly.isDestroyed());

        scope.stop();
    }
View Full Code Here

        // end request
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);

        // expire session
        scope.onEvent(new HttpSessionEnd(this, session));
        Assert.assertEquals(0, one.getNumberInstantiated());
        scope.stop();
    }
View Full Code Here

        Assert.assertEquals("Hello foo", response);
        Assert.assertEquals(2, mockInterceptor.getCount());
        HelloWorldService service1 = (HelloWorldService) child.getContext("target").getInstance(null);
        Assert.assertEquals(2, service1.count());
        child.publish(new RequestEnd(this, id2));
        child.publish(new HttpSessionEnd(this, session));

        // second session
        Object session2 = new Object();
        child.publish(new RequestStart(this, new Object()));
        child.publish(new HttpSessionBound(this, session2));
View Full Code Here

        scope.onEvent(new HttpSessionBound(this,session));
        OrderedDependentPojo source = (OrderedDependentPojo) scope.getContext("source").getInstance(null);
        assertNotNull(source.getPojo());
        // expire module
        assertEquals(2,source.getNumberInstantiated());
        scope.onEvent(new HttpSessionEnd(this,session));
        assertEquals(0,source.getNumberInstantiated());
        scope.stop();
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.context.event.HttpSessionEnd

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.