Package org.apache.tuscany.spi.component

Examples of org.apache.tuscany.spi.component.Service


            if (componentType instanceof CompositeComponentType<?, ?, ?>) {
                // If this is the case, then it means that component has already been returned
                // by CompositeBuilder and thus its children, in particular composite services,
                // have been registered
                CompositeComponent compositeComponent = (CompositeComponent) component;
                Service serviceChild = (Service) compositeComponent.getChild(service.getName());
                assert serviceChild != null;
                if (serviceChild instanceof CompositeService) {
                    serviceChild.setInboundWire(inboundWire);
                    // Notice that now the more immediate container of the wire is the composite service
                    inboundWire.setContainer(serviceChild);
                }
            }
            component.addInboundWire(inboundWire);
View Full Code Here


    public void testProcess3() {
        InboundWire inboundWire = createMock(InboundWire.class);
        OutboundWire outboundWire = createMock(OutboundWire.class);

        Service service = createMock(Service.class);
        CompositeComponent composite = createMock(CompositeComponent.class);
        expect(service.getParent()).andReturn(composite);
        expect(inboundWire.getContainer()).andReturn(service).anyTimes();
        expect(outboundWire.getContainer()).andReturn(service).anyTimes();

        Map<Operation<?>, OutboundInvocationChain> outboundChains =
            new HashMap<Operation<?>, OutboundInvocationChain>();
View Full Code Here

    }

    public void testChildStart() {
        AbstractApplicationContext appContext = EasyMock.createNiceMock(AbstractApplicationContext.class);
        replay(appContext);
        Service service = EasyMock.createMock(Service.class);
        EasyMock.expect(service.getName()).andReturn("foo").anyTimes();
        service.start();
        service.getInterface();
        EasyMock.expectLastCall().andReturn(Object.class);
        expect(service.isSystem()).andReturn(false).atLeastOnce();
        replay(service);
        SpringCompositeComponent component = new SpringCompositeComponent("spring", appContext, null, null, null);
        component.register(service);
        component.start();
        verify(service);
View Full Code Here

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

        builder.setWireService(wireService);
        builder.setBuilderRegistry(registry);
        CompositeComponent parent = createNiceMock(CompositeComponent.class);
        DeploymentContext context = createNiceMock(DeploymentContext.class);
        CompositeComponent component = (CompositeComponent) builder.build(parent, componentDefinition, context);
        Service service = component.getService("fooService");
        TestBean bean = (TestBean) service.getServiceInstance();
        assertEquals("call foo", bean.echo("call foo"));
        verify(registry);
    }
View Full Code Here

        List<Class<?>> interfaces = new ArrayList<Class<?>>();
        interfaces.add(Source.class);
        interfaces.add(Source2.class);

        Source serviceSource = new SourceImpl();
        Service component = EasyMock.createMock(Service.class);
        EasyMock.expect(component.getName()).andReturn("service").atLeastOnce();
        component.getInterface();
        EasyMock.expectLastCall().andReturn(Source.class).atLeastOnce();
        EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
        EasyMock.expect(component.getServiceInstance()).andReturn(serviceSource);
        EasyMock.replay(component);
        parent.register(component);


        AtomicComponent component2 = EasyMock.createMock(AtomicComponent.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

    private CompositeContext context;

    public void testDemoBoot() {
        SpringCompositeComponent comp = (SpringCompositeComponent) component.getChild("Spring");
        Service service = (Service) comp.getChild("fooService");
        TestBean bean = (TestBean) service.getServiceInstance();
        bean.echo("foo");
        bean.getBean().echo("foo");
    }
View Full Code Here

        ComponentDefinition<SystemImplementation> componentDefinition = MockComponentFactory.createTarget();

        AtomicComponent sourceComponent = builder.build(parent, componentDefinition, deploymentContext);
        parent.register(sourceComponent);

        Service service = bindingBuilder.build(parent, serviceDefinition, deploymentContext);
        parent.register(service);

        connector.connect(sourceComponent);
        connector.connect(service);
View Full Code Here

                wireService.checkCompatibility(inboundContract, outboundContract, true);
            } catch (IncompatibleServiceContractException e) {
                throw new Axis2BindingBuilderRuntimeException(e);
            }
           
            Service service = new Axis2Service(serviceDefinition.getName(), outboundContract, parent, wireService, wsBinding,
                    servletHost, configContext, workContext);
            service.setBindingServiceContract(inboundContract);
           
            return service;
           
        } catch (InvalidServiceContractException e) {
            throw new Axis2BindingBuilderRuntimeException(e);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.component.Service

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.