Package org.apache.tuscany.spi.builder

Examples of org.apache.tuscany.spi.builder.Connector


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


        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);

        // Configure the mock builder registry
        BuilderRegistry registry = createMock(BuilderRegistry.class);
        expect(registry.build(isA(CompositeComponent.class),
            isA(BoundServiceDefinition.class),
View Full Code Here

        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 void testAtomicWireBuild() throws Exception {
        WorkContext work = new WorkContextImpl();
        ScopeContainer scope = new ModuleScopeContainer(work);
        scope.start();

        Connector connector = new ConnectorImpl();
        SystemComponentBuilder builder = new SystemComponentBuilder();

        CompositeComponent parent = new CompositeComponentImpl(null, null, connector, null);

        ComponentDefinition<SystemImplementation> targetComponentDefinition = MockComponentFactory.createTarget();
View Full Code Here

    public void testAtomicToReferenceWireBuild() throws Exception {
        WorkContext work = new WorkContextImpl();
        ScopeContainer scope = new ModuleScopeContainer(work);
        scope.start();

        Connector connector = new ConnectorImpl();
        SystemComponentBuilder builder = new SystemComponentBuilder();
        SystemBindingBuilder bindingBuilder = new SystemBindingBuilder();

        CompositeComponent grandParent = new CompositeComponentImpl("grandparent", null, null, null);
        CompositeComponent parent = new CompositeComponentImpl("parent", grandParent, null, null);

        // create a context in the grandparent that the reference will be autowired to
        ComponentDefinition<SystemImplementation> targetComponentDefinition = MockComponentFactory.createTarget();
        AtomicComponent targetComponentComponent = builder.build(parent, targetComponentDefinition, deploymentContext);
        grandParent.register(targetComponentComponent);

        BoundReferenceDefinition<SystemBinding> targetReferenceDefinition = MockComponentFactory.createBoundReference();
        ComponentDefinition<SystemImplementation> sourceComponentDefinition =
            MockComponentFactory.createSourceWithTargetReference();

        AtomicComponent sourceComponent = builder.build(parent, sourceComponentDefinition, deploymentContext);
        Reference reference = bindingBuilder.build(parent, targetReferenceDefinition, deploymentContext);

        parent.register(sourceComponent);
        parent.register(reference);
        connector.connect(reference.getInboundWire(), reference.getOutboundWire(), true);
        connector.connect(sourceComponent);
        grandParent.register(parent);
        grandParent.start();
        scope.onEvent(new CompositeStart(this, parent));
        Source source = (Source) parent.getSystemChild("source").getServiceInstance();
        assertNotNull(source);
View Full Code Here

        JavaAtomicComponent clientComponent =
            (JavaAtomicComponent) builder.build(parent, sourceDefinition, context);
        wireService.createWires(clientComponent, sourceDefinition);
        container.register(clientComponent);

        Connector connector = new ConnectorImpl(new JDKWireService(), null, scheduler , workContext);

        connector.connect(clientComponent);
        FooClient client = (FooClient) clientComponent.getServiceInstance();
        client.invoke();
        assertTrue(client.invoked);
    }
View Full Code Here

        JavaAtomicComponent clientComponent2 =
            (JavaAtomicComponent) builder.build(parent, sourceDefinition2, context);
        wireService.createWires(clientComponent2, sourceDefinition2);
        container.register(clientComponent2);

        Connector connector = new ConnectorImpl(new JDKWireService(), null, scheduler, workContext);
        connector.connect(clientComponent1);
        connector.connect(clientComponent2);
        FooClient client1 = (FooClient) clientComponent1.getServiceInstance();
        client1.invoke();
        assertTrue(client1.invoked);
        FooClient client2 = (FooClient) clientComponent2.getServiceInstance();
        client2.invoke();
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.builder.Connector

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.