Package org.apache.tuscany.spi.component

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


        deploymentContext = new RootDeploymentContext(null, null, mock, null);
    }

    @SuppressWarnings("unchecked")
    public void testBuildConnect() throws Exception {
        CompositeComponent parent = new CompositeComponentImpl(null, null, null, null);

        CompositeBuilder builder = new CompositeBuilder();
        WireService wireService = new JDKWireService();
        builder.setWireService(wireService);
        BuilderRegistryImpl builderRegistry = new BuilderRegistryImpl();
        builderRegistry.setWireService(wireService);
        JavaComponentBuilder jBuilder = new JavaComponentBuilder();
        jBuilder.setWireService(wireService);
        builderRegistry.register(JavaImplementation.class, jBuilder);
        builderRegistry.register(CompositeImplementation.class, builder);
        CompositeBindlessBuilder bindlessBuilder = new CompositeBindlessBuilder();
        bindlessBuilder.setWireService(wireService);
        builderRegistry.register(bindlessBuilder);
        builder.setBuilderRegistry(builderRegistry);
        CompositeComponent component =
            (CompositeComponent) builder.build(parent, createTopComponentDef(), deploymentContext);

        ConnectorImpl connector = new ConnectorImpl();
        connector.connect(component);

        deploymentContext.getModuleScope().start();
        component.start();
        CompositeComponent sourceComponent = (CompositeComponent) component.getChild("SourceComponent");
        Source source = (Source) sourceComponent.getServiceInstance("InnerSourceService");
        assertNotNull(source);
        AtomicComponent innerSourceComponent = (AtomicComponent) sourceComponent.getChild("InnerSourceComponent");
        Source innerSourceInstance = (Source) deploymentContext.getModuleScope().getInstance(innerSourceComponent);
        assertNotNull(innerSourceInstance);
        component.stop();
    }
View Full Code Here


     *
     * @return a newly created root for the component tree
     */
    public RuntimeComponent createRuntime() {
        DefaultRuntime runtime = new DefaultRuntime();
        CompositeComponent systemComponent =
            new CompositeComponentImpl(ComponentNames.TUSCANY_SYSTEM, runtime, null, null);
        runtime.setSystemComponent(systemComponent);
        CompositeComponent rootComponent =
            new CompositeComponentImpl(ComponentNames.TUSCANY_ROOT, runtime, null, null);
        runtime.setRootComponent(rootComponent);
        return runtime;
    }
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.