Package org.apache.tuscany.core.component

Examples of org.apache.tuscany.core.component.WorkContextImpl


        assertEquals(0, source.getNumberInstantiated());
        scopeCtx.stop();
    }

    public void testInitDestroyOrderRequestScope() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        RequestScopeContainer scopeCtx = new RequestScopeContainer(ctx);
        scopeCtx.start();
        scopeCtx.onEvent(new RequestStart(this));
        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source",
            OrderedDependentPojoImpl.class,
View Full Code Here


* @version $$Rev: 451895 $$ $$Date: 2006-10-01 23:58:18 -0700 (Sun, 01 Oct 2006) $$
*/
public class ModuleScopeRestartTestCase extends TestCase {

    public void testRestart() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        ModuleScopeContainer scope = new ModuleScopeContainer(ctx);
        scope.start();
        MethodEventInvoker<Object> initInvoker =
            new MethodEventInvoker<Object>(InitDestroyOnce.class.getMethod("init"));
        MethodEventInvoker<Object> destroyInvoker =
View Full Code Here

    private EventInvoker<Object> initInvoker;
    private EventInvoker<Object> destroyInvoker;
    private PojoObjectFactory<?> factory;

    public void testLifecycleManagement() throws Exception {
        WorkContext workContext = new WorkContextImpl();
        HttpSessionScopeContainer scopeContext = new HttpSessionScopeContainer(workContext);
        scopeContext.start();
        SystemAtomicComponent atomicContext = createContext(scopeContext);
        // start the request
        Object session = new Object();
        workContext.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
        SessionScopeInitDestroyComponent o1 =
            (SessionScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
        assertTrue(o1.isInitialized());
        assertFalse(o1.isDestroyed());
        SessionScopeInitDestroyComponent o2 =
View Full Code Here

        assertTrue(o1.isDestroyed());
        scopeContext.stop();
    }

    public void testSessionIsolation() throws Exception {
        WorkContext workContext = new WorkContextImpl();
        HttpSessionScopeContainer scopeContext = new HttpSessionScopeContainer(workContext);
        scopeContext.start();

        SystemAtomicComponent atomicContext = createContext(scopeContext);

        Object session1 = new Object();
        workContext.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session1);
        SessionScopeInitDestroyComponent o1 =
            (SessionScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
        assertTrue(o1.isInitialized());

        Object session2 = new Object();
        workContext.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session2);
        SessionScopeInitDestroyComponent o2 =
            (SessionScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
        assertNotSame(o1, o2);

        scopeContext.onEvent(new HttpSessionEnd(this, session1));
View Full Code Here

* @version $Rev: 462890 $ $Date: 2006-10-11 11:05:37 -0700 (Wed, 11 Oct 2006) $
*/
public class WorkContextTestCase extends TestCase {

    public void testRemoteComponent() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        CompositeComponent component = EasyMock.createNiceMock(CompositeComponent.class);
        CompositeComponent component2 = EasyMock.createNiceMock(CompositeComponent.class);
        ctx.setRemoteComponent(component);
        assertEquals(component, ctx.getRemoteComponent());
        ctx.setRemoteComponent(component2);
        assertEquals(component2, ctx.getRemoteComponent());
    }
View Full Code Here

        ctx.setRemoteComponent(component2);
        assertEquals(component2, ctx.getRemoteComponent());
    }

    public void testNonSetRemoteComponent() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        assertNull(ctx.getRemoteComponent());
    }
View Full Code Here

        WorkContext ctx = new WorkContextImpl();
        assertNull(ctx.getRemoteComponent());
    }

    public void testIndentifier() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        Object id = new Object();
        ctx.setIdentifier(this, id);
        assertEquals(id, ctx.getIdentifier(this));
    }
View Full Code Here

        ctx.setIdentifier(this, id);
        assertEquals(id, ctx.getIdentifier(this));
    }

    public void testClearIndentifier() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        Object id = new Object();
        ctx.setIdentifier(this, id);
        ctx.clearIdentifier(this);
        assertNull(ctx.getIdentifier(this));
    }
View Full Code Here

        ctx.clearIdentifier(this);
        assertNull(ctx.getIdentifier(this));
    }

    public void testClearIndentifiers() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        Object id = new Object();
        Object id2 = new Object();
        ctx.setIdentifier(id, id);
        ctx.setIdentifier(id2, id2);
        ctx.clearIdentifiers();
        assertNull(ctx.getIdentifier(id));
        assertNull(ctx.getIdentifier(id2));
    }
View Full Code Here

        assertNull(ctx.getIdentifier(id));
        assertNull(ctx.getIdentifier(id2));
    }

    public void testClearNonExistentIndentifier() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        ctx.clearIdentifier(this);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.component.WorkContextImpl

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.