Package org.apache.tuscany.spi.component

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


    protected void setUp() throws Exception {
        super.setUp();
        ClassLoader cl = getClass().getClassLoader();
        LauncherImpl launcher = new LauncherImpl();
        launcher.setApplicationLoader(cl);
        CompositeComponent composite = launcher.bootRuntime(cl.getResource(LauncherImpl.METAINF_SYSTEM_SCDL_PATH),
                                                            new NullMonitorFactory());

        for (String extensionName : extensions.keySet()) {
            deployExtension(composite, extensionName, extensions.get(extensionName));
        }
View Full Code Here


    protected void setUp() throws Exception {
        super.setUp();
        ClassLoader cl = getClass().getClassLoader();
        TestLauncher launcher = new TestLauncher();
        launcher.setApplicationLoader(cl);
        CompositeComponent composite = launcher.bootRuntime(cl.getResource(LauncherImpl.METAINF_SYSTEM_SCDL_PATH),
            new NullMonitorFactory());

        for (String extensionName : extensions.keySet()) {
            deployExtension(composite, extensionName, extensions.get(extensionName));
        }
View Full Code Here

            registerAutowire(reference);
        } else if (child instanceof AtomicComponent) {
            AtomicComponent atomic = (AtomicComponent) child;
            registerAutowire(atomic);
        } else if (child instanceof CompositeComponent) {
            CompositeComponent component = (CompositeComponent) child;
            if (lifecycleState == RUNNING && component.getLifecycleState() == UNINITIALIZED) {
                component.start();
            }
            registerAutowire(component);
            addListener(component);
        }
    }
View Full Code Here

* @version $Rev: 451895 $ $Date: 2006-10-01 23:58:18 -0700 (Sun, 01 Oct 2006) $
*/
public class AutowireResolutionTestCase extends TestCase {

    public void testConstruction() {
        CompositeComponent parent = createMock(CompositeComponent.class);
        replay(parent);
        CompositeComponent component = new CompositeComponentImpl("test", parent, null, null);
        assertEquals("test", component.getName());
        assertSame(parent, component.getParent());
        verify(parent);
    }
View Full Code Here

        assertSame(parent, component.getParent());
        verify(parent);
    }

    public void testResolveToSelf() {
        CompositeComponent parent = createMock(CompositeComponent.class);
        replay(parent);
        CompositeComponent component = new CompositeComponentImpl("test", parent, null, null);
        assertSame(component, component.resolveInstance(CompositeComponent.class));
        verify(parent);
    }
View Full Code Here

        assertSame(component, component.resolveInstance(CompositeComponent.class));
        verify(parent);
    }

    public void testSystemResolveToSelf() {
        CompositeComponent parent = createMock(CompositeComponent.class);
        replay(parent);
        CompositeComponent component = new CompositeComponentImpl("test", parent, null, null);
        assertSame(component, component.resolveSystemInstance(CompositeComponent.class));
        verify(parent);
    }
View Full Code Here

    }

    public void testResolvedByAutowire() {
        Foo foo = new Foo() {
        };
        CompositeComponent parent = createMock(CompositeComponent.class);
        EasyMock.expect(parent.resolveInstance(eq(Foo.class))).andReturn(foo);
        replay(parent);
        CompositeComponent component = new CompositeComponentImpl("test", parent, null, null);
        assertSame(foo, component.resolveInstance(Foo.class));
        verify(parent);
    }
View Full Code Here

    }

    public void testSystemResolvedByAutowire() {
        Foo foo = new Foo() {
        };
        CompositeComponent parent = createMock(CompositeComponent.class);
        EasyMock.expect(parent.resolveSystemInstance(eq(Foo.class))).andReturn(foo);
        replay(parent);
        CompositeComponent component = new CompositeComponentImpl("test", parent, null, null);
        assertSame(foo, component.resolveSystemInstance(Foo.class));
        verify(parent);
    }
View Full Code Here

     * Verify parent resolution strategy for application services
     */
    public void testNamespaceIsolationAutowire() {
        Foo foo = new Foo() {
        };
        CompositeComponent parent = new CompositeComponentImpl("parent", null, null, null);
        parent.registerJavaObject("foo", Foo.class, foo);
        CompositeComponent component = new CompositeComponentImpl("test", parent, null, null);
        assertNull(component.resolveInstance(Foo.class));
    }
View Full Code Here

* @version $Rev: 451895 $ $Date: 2006-10-01 23:58:18 -0700 (Sun, 01 Oct 2006) $
*/
public class SystemOutboundAutowireTestCase extends TestCase {

    public void testAutowire() {
        CompositeComponent component = createMock(CompositeComponent.class);
        expect(component.resolveSystemInstance(Object.class)).andReturn(new Object());
        replay(component);
        SystemOutboundAutowire wire = new SystemOutboundAutowire("foo", Object.class, component, false);
        assertNotNull(wire.getTargetService());
        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.