Package org.apache.tuscany.spi.wire

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


                                                                       Map<String, Member> members,
                                                                       ScopeContainer targetScope) throws Exception {
        JavaAtomicComponent targetContext =
            createJavaComponent(targetName, targetScope, targetClass);
        String serviceName = targetService.getName().substring(targetService.getName().lastIndexOf('.') + 1);
        InboundWire inboundWire = createServiceWire(serviceName, targetService, null);
        targetContext.addInboundWire(inboundWire);

        PojoConfiguration configuration = new PojoConfiguration();
        configuration.setScopeContainer(sourceScope);
        configuration.setInstanceFactory(new PojoObjectFactory(sourceClass.getConstructor()));
View Full Code Here


    }


    public static <T> InboundWire createServiceWire(String serviceName, Class<T> interfaze, Interceptor interceptor)
        throws InvalidServiceContractException {
        InboundWire wire = new InboundWireImpl();
        ServiceContract<?> contract = REGISTRY.introspect(interfaze);
        wire.setServiceContract(contract);
        wire.setServiceName(serviceName);
        wire.addInvocationChains(
            createInboundChains(interfaze, interceptor));
        return wire;
    }
View Full Code Here

            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);
View Full Code Here

        sourceConfig.addReferenceSite(setter.getName(), setter);
        SystemAtomicComponent sourceCtx = new SystemAtomicComponentImpl(source, sourceConfig);
        QualifiedName targetName = new QualifiedName(target);
        SystemOutboundWire wire = new SystemOutboundWireImpl(setter.getName(), targetName, targetClass);
        InboundWire inboundWire = new SystemInboundWireImpl(targetName.getPortName(), targetClass, targetComponent);
        wire.setTargetWire(inboundWire);

        sourceCtx.addOutboundWire(wire);
        contexts.put(source, sourceCtx);
        contexts.put(target, targetComponent);
View Full Code Here

        return new SystemAtomicComponentImpl(name, configuration);
    }

    public static <T> InboundWire createTargetWireFactory(String serviceName, Class<T> interfaze)
        throws InvalidServiceContractException {
        InboundWire wire = new InboundWireImpl();
        wire.setServiceName(serviceName);
        JavaServiceContract contract = new JavaServiceContract(interfaze);
        wire.setServiceContract(contract);
        wire.addInvocationChains(createInboundChains(interfaze));
        return wire;
    }
View Full Code Here

public class ServiceInvocationTestCase extends TestCase {

    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);
        Connector connector = ArtifactFactory.createConnector();
        connector.connect(inboundWire, outboundWire, true);
        for (InboundInvocationChain chain : inboundWire.getInvocationChains().values()) {
            chain.setTargetInvoker(composite.createTargetInvoker("foo", chain.getOperation()));
        }
        composite.register(service);
        TestBean serviceInstance = (TestBean) composite.getService("fooService").getServiceInstance();
        assertEquals("bar", serviceInstance.echo("bar"));
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();
View Full Code Here

    public static <T> Service createService(String name,
                                               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"));
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);
        registry.process(owire, iwire);
View Full Code Here

    }

    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);
        registry.process(iwire, owire);
View Full Code Here

TOP

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

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.