Examples of registerModelObject()


Examples of org.apache.tuscany.core.context.CompositeContext.registerModelObject()

        MockSyncInterceptor mockInterceptor = new MockSyncInterceptor();
        MockInterceptorBuilder interceptorBuilder = new MockInterceptorBuilder(mockInterceptor, false);
        registry.registerTargetBuilder(interceptorBuilder);
        runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test.module"));
        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModuleWithEntryPoint(Scope.MODULE));
        child.publish(new ModuleStart(this));
        Object id = new Object();
        child.publish(new RequestStart(this, id));
        EntryPointContext ctx = (EntryPointContext) child.getContext("source");
        Assert.assertNotNull(ctx);
View Full Code Here

Examples of org.apache.tuscany.core.context.CompositeContext.registerModelObject()

        Context ctx = runtime.getSystemContext().getContext("tuscany.system.child");
        Assert.assertNotNull(ctx);
        runtime.getRootContext().registerModelObject(MockFactory.createCompositeComponent("test"));
        CompositeContext testCtx = (CompositeContext) runtime.getRootContext().getContext("test");
        Assert.assertNotNull(testCtx);
        testCtx.registerModelObject(MockFactory.createModule(Scope.REQUEST,Scope.INSTANCE));
        testCtx.publish(new ModuleStart(this));
       
        // first request
        Object id = new Object();
        testCtx.publish(new RequestStart(this,id));
View Full Code Here

Examples of org.apache.tuscany.core.context.CompositeContext.registerModelObject()

    public void testMultiplicity() throws Exception {
       
        CompositeContext context = createContext();
        context.start();
        context.registerModelObject(MockFactory.createModuleWithWiredComponentsOfDifferentInterface(Scope.MODULE, Scope.MODULE));
        context.publish(new ModuleStart(this));
        Source source = (Source) ((AtomicContext) context.getContext("source")).getTargetInstance();
        Assert.assertNotNull(source);
        OtherTarget target = (OtherTarget) ((AtomicContext)context.getContext("target")).getTargetInstance();
        Assert.assertNotNull(target);
View Full Code Here

Examples of org.apache.tuscany.core.context.CompositeContext.registerModelObject()

        runtime.addBuilder(new JavaTargetWireBuilder());
        runtime.start();
        runtime.getRootContext().registerModelObject(
                MockFactory.createCompositeComponent("test.module"));
        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModule());
        child.publish(new ModuleStart(this));
        GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null);
        Assert.assertNotNull(source);
        source.getGenericComponent().getString();
        Assert.assertEquals(1, mockInterceptor.getCount());
View Full Code Here

Examples of org.apache.tuscany.core.context.CompositeContext.registerModelObject()

        runtime.addBuilder(new JavaTargetWireBuilder());
        runtime.start();
        runtime.getRootContext().registerModelObject(
                MockFactory.createCompositeComponent("test.module"));
        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModule());
        child.publish(new ModuleStart(this));
        GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null);
        Assert.assertNotNull(source);
        source.getGenericComponent().getString();
        Assert.assertEquals(1, mockInterceptor.getCount());
View Full Code Here

Examples of org.apache.tuscany.core.context.CompositeContext.registerModelObject()

        runtime.addBuilder(new JavaTargetWireBuilder());
        runtime.start();
        runtime.getRootContext().registerModelObject(
                MockFactory.createCompositeComponent("test.module"));
        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModule());
        child.publish(new ModuleStart(this));
        GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null);
        Assert.assertNotNull(source);
        source.getGenericComponent().getString();
        Assert.assertEquals(1, mockInterceptor.getCount());
View Full Code Here

Examples of org.apache.tuscany.core.context.CompositeContext.registerModelObject()

        runtime.start();
        runtime.getRootContext().registerModelObject(
                MockFactory.createCompositeComponent("test.module"));
        CompositeContext child = (CompositeContext) runtime.getRootContext().getContext("test.module");
        child.registerModelObject(MockFactory.createModule());
        child.publish(new ModuleStart(this));
        GenericComponent source = (GenericComponent) child.getContext("source").getInstance(null);
        Assert.assertNotNull(source);
        source.getGenericComponent().getString();
        Assert.assertEquals(1, mockInterceptor.getCount());
View Full Code Here

Examples of org.apache.tuscany.core.context.CompositeContext.registerModelObject()

    public static RuntimeContext registerFooBinding(RuntimeContext runtime) throws ConfigurationException {
        CompositeContext child = (CompositeContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD);
        child.getContext(MockFactory.JAVA_BUILDER).getInstance(null);
        Component comp = systemFactory.createSystemComponent(FOO_BUILDER, ContextFactoryBuilder.class, FooBindingBuilder.class, Scope.MODULE);
        comp.getImplementation().setComponentType(getIntrospector().introspect(FooBindingBuilder.class));
        child.registerModelObject(comp);
        comp = systemFactory.createSystemComponent(FOO_WIRE_BUILDER, WireBuilder.class, FooBindingWireBuilder.class, Scope.MODULE);
        comp.getImplementation().setComponentType(getIntrospector().introspect(FooBindingWireBuilder.class));
        child.registerModelObject(comp);
        // since the child context is already started, we need to manually retrieve the components to init them
        Assert.assertNotNull(child.getContext(FOO_BUILDER).getInstance(null));
View Full Code Here

Examples of org.apache.tuscany.core.context.CompositeContext.registerModelObject()

        Component comp = systemFactory.createSystemComponent(FOO_BUILDER, ContextFactoryBuilder.class, FooBindingBuilder.class, Scope.MODULE);
        comp.getImplementation().setComponentType(getIntrospector().introspect(FooBindingBuilder.class));
        child.registerModelObject(comp);
        comp = systemFactory.createSystemComponent(FOO_WIRE_BUILDER, WireBuilder.class, FooBindingWireBuilder.class, Scope.MODULE);
        comp.getImplementation().setComponentType(getIntrospector().introspect(FooBindingWireBuilder.class));
        child.registerModelObject(comp);
        // since the child context is already started, we need to manually retrieve the components to init them
        Assert.assertNotNull(child.getContext(FOO_BUILDER).getInstance(null));
        Assert.assertNotNull(child.getContext(FOO_WIRE_BUILDER).getInstance(null));
        return runtime;
    }
View Full Code Here

Examples of org.apache.tuscany.core.context.CompositeContext.registerModelObject()


    protected CompositeContext createContextHierachy() throws Exception {
        List<ContextFactoryBuilder> mockBuilders = MockFactory.createSystemBuilders();
        CompositeContext parent = new SystemCompositeContextImpl("test.parent", null, null, new DefaultScopeStrategy(), new EventContextImpl(), new MockConfigContext(mockBuilders));
        parent.registerModelObject(MockFactory.createCompositeComponent("test.child"));
        parent.start();
        CompositeContext child = (CompositeContext) parent.getContext("test.child");
        Assert.assertNotNull(child);
        return parent;
    }
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.