Package org.apache.tuscany.model.assembly

Examples of org.apache.tuscany.model.assembly.Component


        assertEquals("HelloWorld", prop.getValue());
    }

    public void testIntProperty() throws XMLStreamException, ConfigurationLoadException {
        String xml = "<properties><propInt>1234</propInt></properties>";
        Component component = createFooComponent();
        loadProperties(xml, component);
        ConfiguredProperty prop = component.getConfiguredProperty("propInt");
        assertEquals(1234, prop.getValue());
    }
View Full Code Here


        assertEquals(1234, prop.getValue());
    }

    public void testIntegerProperty() throws XMLStreamException, ConfigurationLoadException {
        String xml = "<properties><propInteger>1234</propInteger></properties>";
        Component component = createFooComponent();
        loadProperties(xml, component);
        ConfiguredProperty prop = component.getConfiguredProperty("propInteger");
        assertEquals(Integer.valueOf(1234), prop.getValue());
    }
View Full Code Here

        assertEquals(Integer.valueOf(1234), prop.getValue());
    }

    public void testCustomProperty() throws XMLStreamException, ConfigurationLoadException {
        String xml = "<properties><propFoo factory='" + FooFactory.class.getName() + "'><name>Hello</name></propFoo></properties>";
        Component component = createFooComponent();
        loadProperties(xml, component);
        ConfiguredProperty prop = component.getConfiguredProperty("propFoo");
        Foo instance = (Foo) prop.getValue();
        assertEquals("Hello", instance.name);
    }
View Full Code Here

        system.publish(new ModuleStart(this));
        Assert.assertNotNull(system.getContext("TestService1").getInstance(null));
        Assert.assertNotNull(system.getContext("TestService2EP").getInstance(null));

        // create a test module and wire an external service to the system entry point
        Component moduleComponent = MockFactory.createCompositeComponent("test.module");
        runtime.registerModelObject(moduleComponent);
        CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("test.module");
        Assert.assertNotNull(moduleContext);
        ExternalService es = MockFactory.createESSystemBinding("TestService2ES", "tuscany.system/TestService2EP");
        moduleContext.registerModelObject(es);
View Full Code Here

        CompositeContext system = runtime.getSystemContext();
        Assert.assertNotNull(system);
        system.registerModelObject(MockFactory.createSystemModule());

        // create a test module and wire an external service to the system entry point
        Component moduleComponent = MockFactory.createCompositeComponent("test.module");
        runtime.registerModelObject(moduleComponent);
        CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("test.module");
        Assert.assertNotNull(moduleContext);
        ExternalService es = MockFactory.createAutowirableExternalService("TestService2ES", ModuleScopeSystemComponent.class);
        moduleContext.registerModelObject(es);
View Full Code Here

        system.publish(new ModuleStop(this));
    }

    public void testServiceNotFound() throws Exception {
        // create a test module
        Component moduleComponent = MockFactory.createCompositeComponent("module");
        runtime.registerModelObject(moduleComponent);
        CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("module");
        moduleContext.publish(new ModuleStart(this));
        try {
            moduleContext.locateService("TestService");
View Full Code Here

    public void testExternalServiceReferenceNotFound() throws Exception {
        CompositeContext system = runtime.getSystemContext();

        // create a test module
        Component moduleComponent = MockFactory.createCompositeComponent("module");
        runtime.registerModelObject(moduleComponent);
        CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("module");
        ExternalService es = MockFactory.createESSystemBinding("TestServiceES", "tuscany.system/TestService1xEP");
        moduleContext.registerModelObject(es);
View Full Code Here

        system.publish(new ModuleStop(this));
    }

    public void testEntryPointReferenceNotFound() throws Exception {
        // create a test module
        Component moduleComponent = MockFactory.createCompositeComponent("module");
        runtime.registerModelObject(moduleComponent);

        Component component = factory.createSystemComponent("NoService", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        // do not register the above component!

        CompositeContextImpl moduleContext = (CompositeContextImpl) runtime.getContext("module");
        EntryPoint epSystemBinding = MockFactory.createEPSystemBinding("TestServiceEP", ModuleScopeSystemComponent.class, "NoReference", component);
        moduleContext.registerModelObject(epSystemBinding);
View Full Code Here

    /**
     * Test two module components that have external services wired to entry points contained in each
     */
    public void testCircularWires() throws Exception {
        // create a test modules
        Component module1 = MockFactory.createCompositeComponent("module1");
        runtime.registerModelObject(module1);
        Component module2 = MockFactory.createCompositeComponent("module2");
        runtime.registerModelObject(module2);

        CompositeContextImpl moduleContext1 = (CompositeContextImpl) runtime.getContext("module1");
        CompositeContextImpl moduleContext2 = (CompositeContextImpl) runtime.getContext("module2");

        Component component1 = factory.createSystemComponent("Component1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        EntryPoint entryPoint1 = MockFactory.createEPSystemBinding("EntryPoint1", ModuleScopeSystemComponent.class, "Component1", component1);
        ExternalService externalService1 = MockFactory.createESSystemBinding("ExternalService1", "module2/EntryPoint2");
        moduleContext1.registerModelObject(component1);
        moduleContext1.registerModelObject(entryPoint1);
        moduleContext1.registerModelObject(externalService1);

        Component component2 = factory.createSystemComponent("Component2", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        EntryPoint entryPoint2 = MockFactory.createEPSystemBinding("EntryPoint2", ModuleScopeSystemComponent.class, "Component2", component2);
        ExternalService externalService2 = MockFactory.createESSystemBinding("ExternalService2", "module1/EntryPoint1");
        moduleContext2.registerModelObject(component2);
        moduleContext2.registerModelObject(entryPoint2);
        moduleContext2.registerModelObject(externalService2);
View Full Code Here

     * Tests that a circular reference between an external service in one module and an entry point in another
     * is caught as an error condition FIXME this must be implemented
     */
    public void testInterModuleCircularReference() throws Exception {
        // create a test modules
        Component module1 = MockFactory.createCompositeComponent("module1");
        runtime.registerModelObject(module1);
        Component module2 = MockFactory.createCompositeComponent("module2");
        runtime.registerModelObject(module2);

        CompositeContextImpl moduleContext1 = (CompositeContextImpl) runtime.getContext("module1");
        CompositeContextImpl moduleContext2 = (CompositeContextImpl) runtime.getContext("module2");
        ExternalService externalService1 = MockFactory.createESSystemBinding("ExternalService1", "module2/EntryPoint2");
View Full Code Here

TOP

Related Classes of org.apache.tuscany.model.assembly.Component

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.