Package org.apache.tuscany.spi.wire

Examples of org.apache.tuscany.spi.wire.OutboundWire


        EasyMock.expect(outboundChain.getHeadInterceptor()).andReturn(headInterceptor);
        EasyMock.replay(outboundChain);
        Map<Operation<?>, OutboundInvocationChain> outboundChains =
            new HashMap<Operation<?>, OutboundInvocationChain>();
        outboundChains.put(operation, outboundChain);
        OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
        EasyMock.expect(outboundWire.getServiceContract()).andReturn(contract).anyTimes();
        EasyMock.expect(outboundWire.getTargetName()).andReturn(new QualifiedName("target/FooService")).anyTimes();
        EasyMock.expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
        EasyMock.replay(outboundWire);

        Reference reference = EasyMock.createMock(Reference.class);
        EasyMock.expect(reference.getParent()).andReturn(null);
        EasyMock.expect(reference.createTargetInvoker(contract, operation)).andReturn(null);
View Full Code Here


        EasyMock.expect(outboundChain.getOperation()).andReturn(operation);
        EasyMock.replay(outboundChain);
        Map<Operation<?>, OutboundInvocationChain> outboundChains =
            new HashMap<Operation<?>, OutboundInvocationChain>();
        outboundChains.put(operation, outboundChain);
        OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
        outboundWire.getTargetCallbackInvocationChains();
        EasyMock.expectLastCall().andReturn(Collections.emptyMap());
        EasyMock.expect(outboundWire.getServiceContract()).andReturn(contract).anyTimes();
        EasyMock.expect(outboundWire.getTargetName()).andReturn(new QualifiedName("target/FooService")).anyTimes();
        EasyMock.expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();

        // create the service
        Service service = EasyMock.createMock(Service.class);
        EasyMock.expect(service.getName()).andReturn("source");
        EasyMock.expect(service.isSystem()).andReturn(false).atLeastOnce();
        EasyMock.expect(service.getParent()).andReturn(parent).atLeastOnce();
        EasyMock.expect(service.getInboundWire()).andReturn(inboundWire).atLeastOnce();
        EasyMock.expect(service.getScope()).andReturn(Scope.COMPOSITE);
        EasyMock.expect(service.getOutboundWire()).andReturn(outboundWire);
        EasyMock.replay(service);

        EasyMock.expect(outboundWire.getContainer()).andReturn(service);
        EasyMock.replay(outboundWire);

        connector.connect(service);

        EasyMock.verify(service);
View Full Code Here

        outboundChain.prepare();
        EasyMock.replay(outboundChain);
        Map<Operation<?>, OutboundInvocationChain> outboundChains =
            new HashMap<Operation<?>, OutboundInvocationChain>();
        outboundChains.put(operation, outboundChain);
        OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
        EasyMock.expect(outboundWire.getServiceContract()).andReturn(contract).anyTimes();
        EasyMock.expect(outboundWire.getTargetName()).andReturn(new QualifiedName("target/FooService")).anyTimes();
        EasyMock.expect(outboundWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
        outboundWire.getTargetCallbackInvocationChains();
        EasyMock.expectLastCall().andReturn(Collections.emptyMap());

        Map<String, List<OutboundWire>> outboundWires = new HashMap<String, List<OutboundWire>>();
        List<OutboundWire> list = new ArrayList<OutboundWire>();
        list.add(outboundWire);
        outboundWires.put("fooService", list);

        // create the source
        AtomicComponent source = EasyMock.createMock(AtomicComponent.class);
        EasyMock.expect(source.isSystem()).andReturn(false).atLeastOnce();
        EasyMock.expect(source.getScope()).andReturn(Scope.MODULE);
        EasyMock.expect(source.getParent()).andReturn(parent).atLeastOnce();
        EasyMock.expect(source.getOutboundWires()).andReturn(outboundWires);
        EasyMock.expect(source.getName()).andReturn("source");
        source.getInboundWires();
        EasyMock.expectLastCall().andReturn(Collections.emptyMap());
        EasyMock.replay(source);

        EasyMock.expect(outboundWire.getContainer()).andReturn(source);
        EasyMock.replay(outboundWire);

        connector.connect(source);
        EasyMock.verify(outboundWire);
        EasyMock.verify(targetWire);
View Full Code Here

        EasyMock.expect(inboundWire.getContainer()).andReturn(null);
        inboundWire.getInvocationChains();
        EasyMock.expectLastCall().andReturn(Collections.emptyMap());
        EasyMock.replay(inboundWire);

        OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
        outboundWire.getInvocationChains();
        EasyMock.expectLastCall().andReturn(Collections.emptyMap());
        outboundWire.setTargetWire(inboundWire);
        EasyMock.expect(outboundWire.getContainer()).andReturn(null);
        EasyMock.expect(outboundWire.getServiceContract()).andReturn(null);
        EasyMock.replay(outboundWire);

        connector.connect(outboundWire, inboundWire, true);
        EasyMock.verify(inboundWire);
        EasyMock.verify(outboundWire);
View Full Code Here

        outboundChain.prepare();
        EasyMock.replay(outboundChain);
        Map<Operation<?>, OutboundInvocationChain> outboundChains =
            new HashMap<Operation<?>, OutboundInvocationChain>();
        outboundChains.put(operation, outboundChain);
        OutboundWire sourceWire = EasyMock.createMock(OutboundWire.class);
        EasyMock.expect(sourceWire.getContainer()).andReturn(component);
        EasyMock.expect(sourceWire.getServiceContract()).andReturn(contract).anyTimes();
        EasyMock.expect(sourceWire.getTargetName()).andReturn(new QualifiedName("target/FooService")).anyTimes();
        EasyMock.expect(sourceWire.getInvocationChains()).andReturn(outboundChains).anyTimes();
        sourceWire.getTargetCallbackInvocationChains();
        EasyMock.expectLastCall().andReturn(Collections.emptyMap());
        EasyMock.replay(sourceWire);

        connector.connect(sourceWire, targetWire, false);
        EasyMock.verify(inboundChain);
View Full Code Here

* @version $Rev: 452233 $ $Date: 2006-10-02 14:49:09 -0700 (Mon, 02 Oct 2006) $
*/
public class ConnectorPostProcessTestCase extends TestCase {

    public void testInboundToOutboundPostProcessCalled() throws Exception {
        OutboundWire owire = createNiceMock(OutboundWire.class);
        replay(owire);
        InboundWire iwire = createNiceMock(InboundWire.class);
        Map<Operation<?>, InboundInvocationChain> chains = new HashMap<Operation<?>, InboundInvocationChain>();
        expect(iwire.getInvocationChains()).andReturn(chains);
        replay(iwire);
View Full Code Here

    public void testOutboundToInboundPostProcessCalled() throws Exception {
        Component source = createNiceMock(Component.class);
        expect(source.getName()).andReturn("Component");
        replay(source);

        OutboundWire owire = createNiceMock(OutboundWire.class);
        EasyMock.expect(owire.getContainer()).andReturn(source);

        Map<Operation<?>, OutboundInvocationChain> chains = new HashMap<Operation<?>, OutboundInvocationChain>();
        expect(owire.getInvocationChains()).andReturn(chains);
        Map<Operation<?>, InboundInvocationChain> ichains = new HashMap<Operation<?>, InboundInvocationChain>();
        expect(owire.getTargetCallbackInvocationChains()).andReturn(ichains);
        replay(owire);
        InboundWire iwire = createNiceMock(InboundWire.class);
        expect(iwire.getSourceCallbackInvocationChains("Component")).andReturn(chains);
        replay(iwire);
        WirePostProcessorRegistry registry = createMock(WirePostProcessorRegistry.class);
View Full Code Here

    private WireService wireService = new JDKWireService(new WorkContextImpl(), null);

    public void testToStatelessScope() throws Exception {
        StatelessScopeContainer scope = new StatelessScopeContainer(workContext);
        scope.start();
        final OutboundWire wire = getWire(scope);
        Target service = (Target) wireService.createProxy(wire);
        assertNotNull(service);
        service.setString("foo");
        assertEquals(null, service.getString());
        scope.stop();
View Full Code Here

        final RequestScopeContainer scope = new RequestScopeContainer(workContext);
        scope.start();

        scope.onEvent(new RequestStart(this));

        final OutboundWire wire = getWire(scope);
        Target service = (Target) wireService.createProxy(wire);
        assertNotNull(service);
        service.setString("foo");

        // another request
View Full Code Here

        scope.start();
        Object session1 = new Object();
        workContext.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session1);
        scope.onEvent(new HttpSessionStart(this, session1));

        final OutboundWire wire = getWire(scope);
        Target service = (Target) wireService.createProxy(wire);
        Target target = (Target) wireService.createProxy(wire);
        assertNotNull(service);
        service.setString("foo");
        assertEquals("foo", service.getString());
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.wire.OutboundWire

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.