Package org.apache.tuscany.spi.wire

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


        configuration.setWireService(WIRE_SERVICE);
        for (Map.Entry<String, Member> entry : members.entrySet()) {
            configuration.addReferenceSite(entry.getKey(), entry.getValue());
        }
        JavaAtomicComponent sourceContext = new JavaAtomicComponent(sourceName, configuration, null);
        OutboundWire outboundWire = createReferenceWire(targetName, sourceReferenceClass, null);
        List<OutboundWire> factories = new ArrayList<OutboundWire>();
        factories.add(outboundWire);
        sourceContext.addOutboundWires(sourceReferenceClass, factories);
        targetScope.register(targetContext);
        sourceScope.register(sourceContext);
View Full Code Here


    }

    public static <T> OutboundWire createReferenceWire(String refName, Class<T> interfaze, Interceptor interceptor)
        throws InvalidServiceContractException {

        OutboundWire wire = new OutboundWireImpl();
        wire.setReferenceName(refName);
        Map<Operation<?>, OutboundInvocationChain> outboundChains = createOutboundChains(interfaze, interceptor);
        wire.addInvocationChains(outboundChains);
        ServiceContract<?> contract = REGISTRY.introspect(interfaze);
        wire.setServiceContract(contract);
        return wire;
    }
View Full Code Here

        return wire;
    }

    public static <T> OutboundWire createReferenceWire(String refName, Class<T> interfaze)
        throws InvalidServiceContractException {
        OutboundWire wire = new OutboundWireImpl();
        wire.setReferenceName(refName);
        wire.addInvocationChains(createOutboundChains(interfaze));
        ServiceContract<?> contract = REGISTRY.introspect(interfaze);
        wire.setServiceContract(contract);
        return wire;
    }
View Full Code Here

        DataType<DataType> outputType1 =
            new DataType<DataType>("idl:output", Object.class, operation1.getOutputType());
        DataType<DataType> outputType2 =
            new DataType<DataType>("idl:output", Object.class, operation2.getOutputType());

        OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
        InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
        CompositeComponent composite = EasyMock.createMock(CompositeComponent.class);
        Component component = EasyMock.createMock(Component.class);
        EasyMock.expect(component.getParent()).andReturn(composite).once();
        EasyMock.expect(outboundWire.getContainer()).andReturn(component);
        EasyMock.replay(outboundWire, inboundWire, composite, component);

        interceptor = new DataBindingInteceptor(outboundWire, operation1, inboundWire, operation2);
        Mediator mediator = createMock(Mediator.class);
        Object[] source = new Object[] {"<foo>bar</foo>"};
View Full Code Here

    public void testInvocation() throws InvalidServiceContractException {
        AbstractApplicationContext springContext = createSpringContext();
        SpringCompositeComponent composite = new SpringCompositeComponent("parent", springContext, null, null, null);
        InboundWire inboundWire = ArtifactFactory.createInboundWire("fooService", TestBean.class);
        OutboundWire outboundWire = ArtifactFactory.createOutboundWire("fooService", TestBean.class);
        outboundWire.setTargetName(new QualifiedName("foo"));
        ArtifactFactory.terminateWire(outboundWire);
        Service service =
            new ServiceExtension("fooService", TestBean.class, composite, createWireService());
        service.setInboundWire(inboundWire);
        service.setOutboundWire(outboundWire);
View Full Code Here

        // Create a service instance that the mock builder registry will return
        WireService wireService = ArtifactFactory.createWireService();
        ServiceExtension serviceContext =
            new ServiceExtension("fooService", TestBean.class, null, wireService);
        InboundWire inboundWire = ArtifactFactory.createInboundWire("fooService", TestBean.class);
        OutboundWire outboundWire = ArtifactFactory.createOutboundWire("fooService", TestBean.class);
        ArtifactFactory.terminateWire(outboundWire);
        serviceContext.setInboundWire(inboundWire);
        serviceContext.setOutboundWire(outboundWire);
        Connector connector = ArtifactFactory.createConnector();
        connector.connect(inboundWire, outboundWire, true);
View Full Code Here

        ReferenceTarget target = new ReferenceTarget();
        target.setReferenceName("ref");
        target.addTarget(new URI("foo"));
        definition.add(target);
        AtomicComponent component = builder.build(parent, definition, deploymentContext);
        OutboundWire wire = component.getOutboundWires().get("ref").get(0);
        SystemInboundWire inbound = EasyMock.createMock(SystemInboundWire.class);
        FooImpl targetFoo = new FooImpl();
        EasyMock.expect(inbound.getTargetService()).andReturn(targetFoo);
        EasyMock.replay(inbound);
        wire.setTargetWire(inbound);
        component.start();
        FooImpl foo = (FooImpl) component.getServiceInstance();
        assertNotNull(foo.ref);
        container.onEvent(new CompositeStop(this, null));
        EasyMock.verify(inbound);
View Full Code Here

                                               Class<T> serviceInterface,
                                               CompositeComponent parent,
                                               WireService wireService) throws InvalidServiceContractException {
        Service service = new ServiceExtension(name, serviceInterface, parent, wireService);
        InboundWire inboundWire = ArtifactFactory.createInboundWire(name, serviceInterface);
        OutboundWire outboundWire = ArtifactFactory.createOutboundWire(name, serviceInterface);
        ArtifactFactory.terminateWire(outboundWire);
        service.setInboundWire(inboundWire);
        service.setOutboundWire(outboundWire);
        outboundWire.setTargetName(new QualifiedName("foo"));
        Connector connector = ArtifactFactory.createConnector();
        connector.connect(service);
        ArtifactFactory.terminateWire(inboundWire);
        return service;
    }
View Full Code Here

*/
public class WirePostProcessorRegistryImplTestCase extends TestCase {

    public void testRegisterUnregister() throws Exception {
        WirePostProcessorRegistry registry = new WirePostProcessorRegistryImpl();
        OutboundWire owire = EasyMock.createMock(OutboundWire.class);
        InboundWire iwire = EasyMock.createMock(InboundWire.class);
        WirePostProcessor processor = createMock(WirePostProcessor.class);
        processor.process(EasyMock.eq(owire), EasyMock.eq(iwire));
        EasyMock.replay(processor);
        registry.register(processor);
View Full Code Here

        verify(processor);
    }

    public void testProcessInboundToOutbound() throws Exception {
        WirePostProcessorRegistry registry = new WirePostProcessorRegistryImpl();
        OutboundWire owire = EasyMock.createMock(OutboundWire.class);
        InboundWire iwire = EasyMock.createMock(InboundWire.class);
        WirePostProcessor processor = createMock(WirePostProcessor.class);
        processor.process(EasyMock.eq(iwire), EasyMock.eq(owire));
        EasyMock.replay(processor);
        registry.register(processor);
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.