Package org.apache.tuscany.spi.component

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


    }

    public void testBoot1Deployment() throws LoaderException {
        URL scdl = BootstrapDeployerTestCase.class.getResource("boot1.scdl");
        implementation.setScdlLocation(scdl);
        CompositeComponent parent = createNiceMock(CompositeComponent.class);
        parent.register(isA(SCAObject.class));
        replay(parent);
        // load the boot1 file using the bootstrap deployer
        componentDefinition.setName("simple");
        Component component = deployer.deploy(parent, componentDefinition);
        assertNotNull(component);
View Full Code Here


    }

    public void testBoot2Deployment() throws LoaderException {
        URL scdl = BootstrapDeployerTestCase.class.getResource("boot2.scdl");
        implementation.setScdlLocation(scdl);
        CompositeComponent parent = createNiceMock(CompositeComponent.class);
        parent.register(isA(SCAObject.class));
        replay(parent);

        // load the boot2 file using the bootstrap deployer
        componentDefinition.setName("newDeployer");
        CompositeComponent component = (CompositeComponent) deployer.deploy(parent, componentDefinition);
        assertNotNull(component);
        verify(parent);
        component.start();
        Deployer newDeployer = (Deployer) component.getSystemServiceInstance("deployer");
        assertNotNull(newDeployer);

/*      // FIXME
        // load the boot2 file using the newly loaded deployer
        parent.reset();
View Full Code Here

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

        Component component = createMock(Component.class);
        CompositeComponent composite = createMock(CompositeComponent.class);
        expect(component.getParent()).andReturn(composite);
        expect(inboundWire.getContainer()).andReturn(component);
        expect(outboundWire.getContainer()).andReturn(component);

        Map<Operation<?>, OutboundInvocationChain> outboundChains =
View Full Code Here

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

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

        Map<Operation<?>, OutboundInvocationChain> outboundChains =
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 =
View Full Code Here

* @version $$Rev: 453756 $$ $$Date: 2006-10-06 13:32:59 -0700 (Fri, 06 Oct 2006) $$
*/
public class CompositeLifecycleTestCase extends TestCase {

    public void testLifecycle() throws Exception {
        CompositeComponent composite = new CompositeComponentImpl("foo", null, null, null);
        composite.start();
        assertNull(composite.getChild("nothtere"));
        composite.stop();
        composite.start();
        assertNull(composite.getChild("nothtere"));
        composite.stop();
    }
View Full Code Here

        EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
        EasyMock.expect(component.getServiceInstance()).andReturn(originalSource).atLeastOnce();
        EasyMock.expect(component.getServiceInterfaces()).andReturn(interfaces);
        EasyMock.replay(component);

        CompositeComponent composite = new CompositeComponentImpl("foo", null, null, null);
        composite.start();
        composite.register(component);

        AtomicComponent atomicComponent = (AtomicComponent) composite.getSystemChild("source");
        Source source = (Source) atomicComponent.getServiceInstance();
        assertNotNull(source);
        composite.stop();
        composite.start();
        atomicComponent = (AtomicComponent) composite.getSystemChild("source");
        Source source2 = (Source) atomicComponent.getServiceInstance();
        assertNotNull(source2);
        composite.stop();
        EasyMock.verify(component);
    }
View Full Code Here

        EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
        EasyMock.expect(component.getServiceInstance()).andReturn(originalSource).atLeastOnce();
        EasyMock.expect(component.getServiceInterfaces()).andReturn(interfaces);
        EasyMock.replay(component);

        CompositeComponent composite = new CompositeComponentImpl("foo", null, null, null);
        composite.start();
        composite.register(component);

        AtomicComponent atomicComponent = (AtomicComponent) composite.getChild("source");
        Source source = (Source) atomicComponent.getServiceInstance();
        assertNotNull(source);
        composite.stop();
        composite.start();
        atomicComponent = (AtomicComponent) composite.getChild("source");
        Source source2 = (Source) atomicComponent.getServiceInstance();
        assertNotNull(source2);
        composite.stop();
        EasyMock.verify(component);
    }
View Full Code Here

        composite.stop();
        EasyMock.verify(component);
    }

    public void testChildStoppedBeforeParent() {
        CompositeComponent parent = new CompositeComponentImpl("parent", null, null, null);
        CompositeComponent child = new CompositeComponentImpl("child", null, null, null);
        parent.register(child);
        parent.start();
        child.stop();
        parent.stop();
    }
View Full Code Here

    }

    public void testRegisterSystemService() throws Exception {
        List<Class<?>> services = new ArrayList<Class<?>>();
        services.add(Foo.class);
        CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
        SystemAtomicComponent component = EasyMock.createMock(SystemAtomicComponent.class);
        EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
        EasyMock.replay(component);
        parent.register(component);
        assertNull(parent.getChild("bar"));
        assertNotNull(parent.getSystemChild("bar"));
        EasyMock.verify(component);
    }
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.