Package org.apache.tuscany.spi.component

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


        AtomicComponent sourceComponent = builder.build(parent, sourceComponentDefinition, deploymentContext);
        Reference reference = bindingBuilder.build(parent, targetReferenceDefinition, deploymentContext);

        parent.register(sourceComponent);
        parent.register(reference);
        connector.connect(reference.getInboundWire(), reference.getOutboundWire(), true);
        connector.connect(sourceComponent);
        grandParent.register(parent);
        grandParent.start();
        scope.onEvent(new CompositeStart(this, parent));
View Full Code Here


        BoundServiceDefinition<SystemBinding> serviceDefinition = MockComponentFactory.createBoundService();
        ComponentDefinition<SystemImplementation> componentDefinition = MockComponentFactory.createTarget();

        AtomicComponent sourceComponent = builder.build(parent, componentDefinition, deploymentContext);
        parent.register(sourceComponent);

        Service service = bindingBuilder.build(parent, serviceDefinition, deploymentContext);
        parent.register(service);

        connector.connect(sourceComponent);
View Full Code Here

        AtomicComponent sourceComponent = builder.build(parent, componentDefinition, deploymentContext);
        parent.register(sourceComponent);

        Service service = bindingBuilder.build(parent, serviceDefinition, deploymentContext);
        parent.register(service);

        connector.connect(sourceComponent);
        connector.connect(service);

        parent.start();
View Full Code Here

        EasyMock.expect(component2.isSystem()).andReturn(true).atLeastOnce();
        component2.stop();
        EasyMock.expect(component2.getServiceInterfaces()).andReturn(interfaces);
        EasyMock.replay(component2);

        parent.register(component1);
        try {
            parent.register(component2);
            fail();
        } catch (DuplicateNameException e) {
            // ok
View Full Code Here

        EasyMock.expect(component2.getServiceInterfaces()).andReturn(interfaces);
        EasyMock.replay(component2);

        parent.register(component1);
        try {
            parent.register(component2);
            fail();
        } catch (DuplicateNameException e) {
            // ok
        }
        parent.stop();
View Full Code Here

        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);
        SystemAtomicComponent component2 = EasyMock.createMock(SystemAtomicComponent.class);
        EasyMock.expect(component2.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component2.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component2.isSystem()).andReturn(true).atLeastOnce();
        EasyMock.replay(component2);
View Full Code Here

        EasyMock.expect(component2.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component2.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component2.isSystem()).andReturn(true).atLeastOnce();
        EasyMock.replay(component2);
        try {
            parent.register(component2);
            fail();
        } catch (DuplicateNameException e) {
            // expected
        }
    }
View Full Code Here

        }
    }

    public void testNotService() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        composite.register(getReference("foo"));
        composite.start();
        try {
            composite.getService("foo");
            fail();
        } catch (ComponentNotFoundException e) {
View Full Code Here

        }
    }

    public void testTargetNotFound() {
        CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
        composite.register(getReference("foo"));
        composite.start();
        try {
            composite.locateService(Foo.class, "foo1");
            fail();
        } catch (TargetNotFoundException e) {
View Full Code Here

        }
    }

    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() {
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.