Package org.apache.tuscany.core.context.impl

Examples of org.apache.tuscany.core.context.impl.CompositeContextImpl


        targets.get(0).setString("foo");
        Assert.assertEquals("foo",target.getString());
    }

    private CompositeContext createContext() {
        CompositeContextImpl context = new CompositeContextImpl();
        context.setName("system.context");
        List<ContextFactoryBuilder>builders = MockFactory.createSystemBuilders();
        WireFactoryService wireService = new DefaultWireFactoryService(new MessageFactoryImpl(), new JDKWireFactoryFactory(), new DefaultPolicyBuilderRegistry());
        builders.add(new JavaContextFactoryBuilder(wireService));
        List<WireBuilder> wireBuilders = new ArrayList<WireBuilder>();
        wireBuilders.add(new JavaTargetWireBuilder());
        context.setConfigurationContext(new MockConfigContext(builders,wireBuilders));
        return context;
    }
View Full Code Here


* @version $Rev: 408581 $ $Date: 2006-05-21 23:34:24 -0700 (Sun, 21 May 2006) $
*/
public class JavaAtomicContextLifecycleTestCase extends TestCase {

    public void testComponentNameSet() throws Exception {
        CompositeContext mc = new CompositeContextImpl();
        mc.setName("mc");
        JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit",
                ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc);
        context.start();
        ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null);
        Assert.assertNotNull(instance);
View Full Code Here

        Assert.assertEquals("TestServiceInit", instance.getName());
        context.stop();
    }

    public void testModuleContextSet() throws Exception {
        CompositeContext mc = new CompositeContextImpl();
        mc.setName("mc");
        JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit",
                ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc);
        context.start();
        ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null);
        Assert.assertNotNull(instance);
View Full Code Here

* @version $Rev: 394173 $ $Date: 2006-04-14 11:54:59 -0700 (Fri, 14 Apr 2006) $
*/
public class JavaAtomicContextMetadataInjectionTestCase extends TestCase {

    public void testComponentNameSet() throws Exception {
        CompositeContext mc = new CompositeContextImpl();
        mc.setName("mc");
        JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit",
                ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc);
        context.start();
        ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null);
        Assert.assertNotNull(instance);
View Full Code Here

        Assert.assertEquals("TestServiceInit", instance.getName());
        context.stop();
    }

    public void testModuleContextSet() throws Exception {
        CompositeContext mc = new CompositeContextImpl();
        mc.setName("mc");
        JavaAtomicContext context = MockFactory.createPojoContext("TestServiceInit",
                ModuleScopeInitOnlyComponent.class, Scope.MODULE, mc);
        context.start();
        ModuleScopeInitOnlyComponent instance = (ModuleScopeInitOnlyComponent) context.getInstance(null);
        Assert.assertNotNull(instance);
View Full Code Here

            }
        }
    }

    private static CompositeContext createContext() {
        return new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), new EventContextImpl(), new MockConfigContext(null));
    }
View Full Code Here




    private static CompositeContext createContext() {
        return new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(), new EventContextImpl(),
                new MockConfigContext(null));
    }
View Full Code Here

    /**
     * Checks that registration of duplicate named model objects before context start throws an exception
     */
    public void testRegisterSameName() throws Exception {
        CompositeContext parent = new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(),
                new EventContextImpl(), new MockConfigContext(builders));
        parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child"));
        try {
            parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child"));
            parent.start();
            fail("Expected " + DuplicateNameException.class.getName());
        } catch (DuplicateNameException e) {
            // expected
        }
    }
View Full Code Here

    /**
     * Checks that registration of duplicate named model objects after context start throws an exception
     */
    public void testRegisterSameNameAfterStart() throws Exception {
        CompositeContext parent = new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(),
                new EventContextImpl(), new MockConfigContext(builders));
        parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child"));
        parent.start();
        CompositeContext child = (CompositeContext) parent.getContext("test.child");
        Assert.assertNotNull(child);
        try {
            parent.registerModelObject(MockFactory.createSystemCompositeComponent("test.child"));
            fail("Expected " + DuplicateNameException.class.getName());
        } catch (DuplicateNameException e) {
            // expected
        }
    }
View Full Code Here

        parent.stop();
    }

    protected CompositeContext createContextHierachy() throws Exception {
        List<ContextFactoryBuilder> systemBuilders = MockFactory.createSystemBuilders();
        CompositeContext parent = new CompositeContextImpl("test.parent", null, new DefaultScopeStrategy(),
                new EventContextImpl(), new MockConfigContext(systemBuilders));
        Component component = MockFactory.createCompositeComponent("test.child");
        parent.registerModelObject(component);
        parent.start();
        CompositeContext child = (CompositeContext) parent.getContext("test.child");
        Assert.assertNotNull(child);
        return parent;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.context.impl.CompositeContextImpl

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.