Package org.apache.tuscany.spi.component

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


    }

    public void testRegister() throws Exception {
        List<Class<?>> services = new ArrayList<Class<?>>();
        services.add(Foo.class);
        CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
        AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
        EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
        EasyMock.replay(component);
        parent.register(component);
        assertNull(parent.getSystemChild("bar"));
        assertNotNull(parent.getChild("bar"));
        EasyMock.verify(component);
    }
View Full Code Here


        launcher.setApplicationLoader(webappClassLoader);

        try {
            System.out.println(":::" + new File(".").toURL().toString());
            // URL systemScdl = getSystemSCDL(systemScdlPath);
            CompositeComponent rt =
                launcher.bootRuntime(new File("./sca/system.scdl").toURI().toURL(), new NullMonitorFactory());
        } catch (Exception e) {
            throw new OSGILauncherInitException(e);
        }
    }
View Full Code Here

            throw new OSGILauncherInitException(e);
        }
    }

    private void bootApplication(String name, URL scdl) throws TuscanyException {
        CompositeComponent root = launcher.bootApplication(name, scdl);
        root.start();
    }
View Full Code Here

        CompositeComponent root = launcher.bootApplication(name, scdl);
        root.start();
    }

    private void loadExtension(String name, URL scdl) throws TuscanyException {
        CompositeComponent root = launcher.bootApplication(name, scdl);
        root.start();
    }
View Full Code Here

*/
public class WorkContextTestCase extends TestCase {

    public void testRemoteComponent() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        CompositeComponent component = EasyMock.createNiceMock(CompositeComponent.class);
        CompositeComponent component2 = EasyMock.createNiceMock(CompositeComponent.class);
        ctx.setRemoteComponent(component);
        assertEquals(component, ctx.getRemoteComponent());
        ctx.setRemoteComponent(component2);
        assertEquals(component2, ctx.getRemoteComponent());
    }
View Full Code Here

     * Verifies a system service and application component can be registered with the same name in a composite
     */
    public void testSystemServiceApplicationNamespaceIsolation() 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);
        AtomicComponent component2 = EasyMock.createMock(AtomicComponent.class);
        EasyMock.expect(component2.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component2.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component2.isSystem()).andReturn(false).atLeastOnce();
        EasyMock.replay(component2);
        parent.register(component2);
        EasyMock.verify(component);
        EasyMock.verify(component2);
    }
View Full Code Here

        DataType<DataType> outputType2 =
            new DataType<DataType>("idl:output", Object.class, operation2.getOutputType());

        OutboundWire outboundWire = EasyMock.createMock(OutboundWire.class);
        InboundWire inboundWire = EasyMock.createMock(InboundWire.class);
        CompositeComponent composite = EasyMock.createMock(CompositeComponent.class);
        Component component = EasyMock.createMock(Component.class);
        EasyMock.expect(component.getParent()).andReturn(composite).once();
        EasyMock.expect(outboundWire.getContainer()).andReturn(component);
        EasyMock.replay(outboundWire, inboundWire, composite, component);
View Full Code Here

    }

    public void testSystemServiceLifecycle() 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);
        component.start();
        EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
        component.stop();
        EasyMock.replay(component);
        parent.register(component);
        parent.start();
        parent.stop();
        EasyMock.verify(component);
    }
View Full Code Here

    }

    public void testComponentLifecycle() throws Exception {
        List<Class<?>> services = new ArrayList<Class<?>>();
        services.add(Foo.class);
        CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
        AtomicComponent component = EasyMock.createMock(AtomicComponent.class);
        component.start();
        EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
        component.stop();
        EasyMock.replay(component);
        parent.register(component);
        parent.start();
        parent.stop();
        EasyMock.verify(component);
    }
View Full Code Here

    }

    public void testSystemServiceAutowire() 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);
        component.start();
        EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component.getServiceInstance()).andReturn(new Foo() {
        });
        EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
        component.stop();
        EasyMock.replay(component);
        parent.register(component);
        parent.start();
        assertNull(parent.resolveSystemExternalInstance(Foo.class));
        assertNotNull(parent.resolveSystemInstance(Foo.class));
        parent.stop();
        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.