Package org.apache.tuscany.spi.component

Examples of org.apache.tuscany.spi.component.CompositeComponent.register()


    }

    public void testReferencesServices() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        composite.register(new ServiceExtension("foo", null, null, null));
        composite.register(getReference("bar"));
        Assert.assertEquals(1, composite.getReferences().size());
    }

    public void testServiceInterfaces() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
View Full Code Here


    }

    public void testServiceInterfaces() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        Service service1 = getService("foo", Foo.class);
        composite.register(service1);
        Service service2 = getService("bar", Bar.class);
        composite.register(service2);

        List<Class<?>> interfaces = composite.getServiceInterfaces();
        assertEquals(2, interfaces.size());
View Full Code Here

    public void testServiceInterfaces() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        Service service1 = getService("foo", Foo.class);
        composite.register(service1);
        Service service2 = getService("bar", Bar.class);
        composite.register(service2);

        List<Class<?>> interfaces = composite.getServiceInterfaces();
        assertEquals(2, interfaces.size());
        for (Class o : interfaces) {
            if (!(Foo.class.isAssignableFrom(o)) && !(Bar.class.isAssignableFrom(o))) {
View Full Code Here

        expectLastCall().andReturn(Foo.class);
        service.getServiceInstance();
        expectLastCall().andReturn(new Foo() {
        });
        replay(service);
        composite.register(service);
        assertNotNull(composite.getServiceInstance("foo"));
    }

    public void testGetServiceInstanceNotFound() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
View Full Code Here

    }

    public void testGetServiceInstanceNotFound() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        Service service = getService("foo", Foo.class);
        composite.register(service);
        try {
            composite.getServiceInstance("bar");
            fail();
        } catch (TargetNotFoundException e) {
            //expected
View Full Code Here

    }

    public void testGetServiceInstanceNotService() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        Reference reference = getReference("foo");
        composite.register(reference);
        try {
            composite.getServiceInstance("foo");
            fail();
        } catch (IllegalTargetException e) {
            //expected
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        parent = new CompositeComponentImpl("parent", null, null, null);
        CompositeComponent child1 = new CompositeComponentImpl("child1", parent, null, null);
        child2 = new CompositeComponentImpl("child2", child1, null, null);
        child1.register(child2);
        parent.register(child1);
    }

    protected void tearDown() throws Exception {
        parent.stop();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.