Package org.apache.tuscany.spi.component

Examples of org.apache.tuscany.spi.component.WorkContext


* @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

        WorkContext ctx = new WorkContextImpl();
        ctx.clearIdentifier(this);
    }

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

        ctx.clearIdentifier(null);
        assertEquals(id, ctx.getIdentifier(this));
    }

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

        WorkContext ctx = new WorkContextImpl();
        assertNull(ctx.getIdentifier(this));
    }
   
    public void testSetGetMessageIds() {
        WorkContext context = new WorkContextImpl();
        context.setCurrentMessageId("msg-009");
        context.setCurrentCorrelationId("msg-005");
        assertEquals(context.getCurrentMessageId(), "msg-009");
        assertEquals(context.getCurrentCorrelationId(), "msg-005");
        context.setCurrentMessageId(null);
        context.setCurrentCorrelationId(null);
        assertNull(context.getCurrentMessageId());
        assertNull(context.getCurrentCorrelationId());
    }
View Full Code Here

        assertNull(context.getCurrentMessageId());
        assertNull(context.getCurrentCorrelationId());
    }

    public void testSetGetMessageIdsInNewThread() throws InterruptedException {
        WorkContext context = new WorkContextImpl();
        context.setCurrentMessageId("msg-009");
        context.setCurrentCorrelationId("msg-005");
        assertEquals(context.getCurrentMessageId(), "msg-009");
        assertEquals(context.getCurrentCorrelationId(), "msg-005");
        context.setIdentifier("TX", "002");
        ChildThread t = new ChildThread(context);
        t.start();
        t.join();
        assertTrue(t.passed);
        context.setCurrentMessageId(null);
        context.setCurrentCorrelationId(null);
        assertNull(context.getCurrentMessageId());
        assertNull(context.getCurrentCorrelationId());
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.component.WorkContext

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.