Package org.apache.tuscany.spi.extension

Examples of org.apache.tuscany.spi.extension.ServiceExtension


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


        ComponentDefinition<SpringImplementation> componentDefinition =
            new ComponentDefinition<SpringImplementation>("spring", impl);

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

        // Configure the mock builder registry
        BuilderRegistry registry = createMock(BuilderRegistry.class);
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"));
        Connector connector = ArtifactFactory.createConnector();
        connector.connect(service);
        ArtifactFactory.terminateWire(inboundWire);
        return service;
View Full Code Here

        Assert.assertEquals(Scope.COMPOSITE, composite.getScope());
    }

    public void testGetChildren() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        composite.register(new ServiceExtension("foo", null, null, null));
        Assert.assertEquals(1, composite.getChildren().size());
    }
View Full Code Here

        Assert.assertEquals(1, composite.getChildren().size());
    }

    public void testGetServices() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        composite.register(new ServiceExtension("foo", null, null, null));
        composite.register(getReference("bar"));
        Assert.assertEquals(1, composite.getServices().size());
    }
View Full Code Here

        Assert.assertEquals(1, composite.getServices().size());
    }

    public void testGetService() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        composite.register(new ServiceExtension("foo", null, null, null));
        composite.start();
        assertNotNull(composite.getService("foo"));
    }
View Full Code Here

        assertNotNull(composite.getService("foo"));
    }

    public void testServiceNotFound() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        composite.register(new ServiceExtension("foo", null, null, null));
        composite.start();
        try {
            composite.getService("bar");
            fail();
        } catch (ComponentNotFoundException e) {
View Full Code Here

        }
    }

    public void testReferencesServices() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        composite.register(new ServiceExtension("foo", null, null, null));
        composite.register(getReference("bar"));
        Assert.assertEquals(1, composite.getReferences().size());
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.extension.ServiceExtension

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.