Package org.apache.tuscany.spi.component

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


        EasyMock.expect(mockLoader.load(EasyMock.isA(CompositeComponent.class),
            EasyMock.eq(mockReader),
            EasyMock.eq(deploymentContext))).andReturn(modelObject);
        EasyMock.replay(mockLoader);
        registry.registerLoader(name, (StAXElementLoader<ModelObject>) mockLoader);
        CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class);
        assertSame(modelObject, registry.load(parent, mockReader, deploymentContext));
        EasyMock.verify(mockLoader);
        EasyMock.verify(mockMonitor);
        EasyMock.verify(mockReader);
View Full Code Here


        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        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

        composite.register(new ServiceExtension("foo", null, null, null));
        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

*/
public class JavaComponentBuilderTestCase extends TestCase {
    private DeploymentContext deploymentContext;

    public void testBuild() throws Exception {
        CompositeComponent parent = new CompositeComponentImpl(null, null, null, null);

        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> sourceType =
            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
        sourceType.setImplementationScope(Scope.MODULE);
        JavaMappedReference reference = new JavaMappedReference();
View Full Code Here

        composite.register(getReference("bar"));
        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

        composite.start();
        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) {
            // expected
        }
    }
View Full Code Here

            inboundWire.setContainer(component);
            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);
        }

        for (ReferenceTarget referenceTarget : definition.getReferenceTargets().values()) {
            Map<String, ? extends ReferenceDefinition> references = componentType.getReferences();
            ReferenceDefinition mappedReference = references.get(referenceTarget.getReferenceName());
            if (mappedReference == null) {
                String refName = referenceTarget.getReferenceName();
                ReferenceNotFoundException e = new ReferenceNotFoundException(refName);
                e.addContextName(refName);
                e.addContextName(definition.getName());
                throw e;
            }
            OutboundWire wire = createWire(referenceTarget, mappedReference);
            wire.setContainer(component);
            component.addOutboundWire(wire);
            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 references,
                // have been registered
                CompositeComponent compositeComponent = (CompositeComponent) component;
                Reference reference = (Reference) compositeComponent.getChild(referenceTarget.getReferenceName());
                assert reference != null;
                if (reference instanceof CompositeReference) {
                    reference.setOutboundWire(wire);
                    // Notice that now the more immediate container of the wire is the composite reference
                    wire.setContainer(reference);
View Full Code Here

    public static TypeHelper getTypeHelper(TransformationContext context) {
        TypeHelper typeHelper = null;
        if (context == null || context.getMetadata() == null) {
            return TypeHelper.INSTANCE;
        }
        CompositeComponent composite = (CompositeComponent) context.getMetadata().get(CompositeComponent.class);
        if (composite != null) {
            SDOType sdoType = (SDOType) composite.getExtensions().get(SDOType.class);
            if (sdoType != null) {
                typeHelper = sdoType.getTypeHelper();
            }
        }
        if (typeHelper == null) {
View Full Code Here

        Port port = wsdlService.getPort("SoapPort");
        WebServiceBinding wsBinding = new WebServiceBinding(wsdlDef, port, "uri", "portURI", wsdlService);
        //Create a mocked WireService, make the call of ServiceExtension.getServiceInstance() returns a proxy instance.
        WireService wireService = EasyMock.createNiceMock(WireService.class);
        EasyMock.replay(wireService);
        CompositeComponent parent = EasyMock.createNiceMock(CompositeComponent.class);
        // TODO figure out what to do with the service contract
        ServiceContract<?> contract = new WSDLServiceContract();
        contract.setInterfaceClass(Greeter.class);
        WorkContext workContext = EasyMock.createNiceMock(WorkContext.class);
        EasyMock.replay(workContext);
View Full Code Here

    private DeploymentContext deploymentContext;
    private ComponentDefinition<SystemCompositeImplementation> componentDefinition;
    private SystemCompositeImplementation implementation;

    public void testBoot1Load() throws LoaderException {
        CompositeComponent parent = createNiceMock(CompositeComponent.class);
        URL scdl = BootstrapDeployerTestCase.class.getResource("boot1.scdl");
        implementation.setScdlLocation(scdl);
        deployer.load(parent, componentDefinition, deploymentContext);
        CompositeComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> composite =
            implementation.getComponentType();
View Full Code Here

TOP

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

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.