Examples of clearIdentifier()


Examples of org.apache.tuscany.core.context.EventContext.clearIdentifier()

        // first request
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session);
        SessionScopeComponent comp1 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp1);
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);

        scope.registerFactory(createConfiguration("NewTestService"));

        // second request
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session);
View Full Code Here

Examples of org.apache.tuscany.core.context.EventContext.clearIdentifier()

        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session);
        SessionScopeInitDestroyComponent comp2 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService")
                .getInstance(null);
        Assert.assertNotNull(comp2);
        Assert.assertTrue(comp2.isInitialized());
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);

        // third request different session
        Object session2 = new Object();
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2);
        SessionScopeInitDestroyComponent comp3 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService")
View Full Code Here

Examples of org.apache.tuscany.core.context.EventContext.clearIdentifier()

        SessionScopeInitDestroyComponent comp3 = (SessionScopeInitDestroyComponent) scope.getContext("NewTestService")
                .getInstance(null);
        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));
View Full Code Here

Examples of org.apache.tuscany.core.context.EventContext.clearIdentifier()

        Assert.assertTrue(initDestroy.isInitialized());
        Assert.assertTrue(initOnly.isInitialized());
        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());
View Full Code Here

Examples of org.apache.tuscany.core.context.EventContext.clearIdentifier()

        Assert.assertNotNull(three);
        Assert.assertEquals(3, three.getNumberInstantiated());
        Assert.assertEquals(3, three.getInitOrder());

        // 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

Examples of org.apache.tuscany.core.context.impl.EventContextImpl.clearIdentifier()

        Object session2 = new Object();
        // first request
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session);
        SessionScopeComponent comp1 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp1);
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);

        // second request
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session);
        SessionScopeComponent comp2 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp2);
View Full Code Here

Examples of org.apache.tuscany.core.context.impl.EventContextImpl.clearIdentifier()

        // second request
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session);
        SessionScopeComponent comp2 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp2);
        Assert.assertSame(comp1, comp2);
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);

        // third request, different session
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2);
        SessionScopeComponent comp3 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp3);
View Full Code Here

Examples of org.apache.tuscany.core.context.impl.EventContextImpl.clearIdentifier()

        // third request, different session
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2);
        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

Examples of org.apache.tuscany.core.context.impl.EventContextImpl.clearIdentifier()

        // first request
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session);
        SessionScopeComponent comp1 = (SessionScopeComponent) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp1);
        ctx.clearIdentifier(HttpSessionEvent.HTTP_IDENTIFIER);

        // second request, different session
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER, session2);
        SessionScopeComponent comp2 = (SessionScopeComponent) scope.getContextByKey("TestService1", session)
                .getInstance(null);
View Full Code Here

Examples of org.apache.tuscany.core.context.impl.EventContextImpl.clearIdentifier()

        Assert.assertNotNull(comp2);
        Object id = new Object();
        scope.onEvent(new RequestEnd(this, id));
        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));
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.