Examples of SystemCompositeContext


Examples of org.apache.tuscany.core.context.SystemCompositeContext

     * Covers the case where a component in system1a requests autowire, which is resolved to component in its parent,
     * system1.
     */
    public void testScenario4() throws Exception {
        RuntimeContext runtime = createScenario4Runtime();
        SystemCompositeContext system = runtime.getSystemContext();
        CompositeContext system1 = (CompositeContext) system.getContext("system1");
        system1.publish(new ModuleStart(this));
        Target target = (Target) system1.getContext("target").getInstance(null);
        assertNotNull(target);
        CompositeContext system1a = (CompositeContext) system1.getContext("system1a");
        system1a.publish(new ModuleStart(this));
View Full Code Here

Examples of org.apache.tuscany.core.context.SystemCompositeContext

     * Covers the case where a component in system1a requests autowire, which is resolved to component in the parent of
     * its parent (grandparent), system.
     */
    public void testScenario5() throws Exception {
        RuntimeContext runtime = createScenario5Runtime();
        SystemCompositeContext system = runtime.getSystemContext();
        CompositeContext system1 = (CompositeContext) system.getContext("system1");
        system1.publish(new ModuleStart(this));
        Target target = (Target) system.getContext("target").getInstance(null);
        assertNotNull(target);
        CompositeContext system1a = (CompositeContext) system1.getContext("system1a");
        system1a.publish(new ModuleStart(this));

        Source source = (Source) system1a.getContext("source").getInstance(null);
View Full Code Here

Examples of org.apache.tuscany.core.context.SystemCompositeContext

    }

    private RuntimeContext createScenario1Runtime() throws Exception {
        RuntimeContext runtime = MockFactory.createCoreRuntime();
        runtime.start();
        SystemCompositeContext system = runtime.getSystemContext();
        ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1");
        ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a");
        system1Component.getImplementation().getComponents().add(system1aComponent);
        Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE);
        system1Component.getImplementation().getComponents().add(target);

        EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target);
        system1Component.getImplementation().getEntryPoints().add(ep);
        system.registerModelObject(system1Component);
        EntryPoint systemEp = MockFactory.createEPSystemBinding("target.system.ep", Target.class, "ref");

        systemEp.getBindings().add(systemFactory.createSystemBinding());
        Service service = systemFactory.createService();
        service.setName("system1/target.ep");
        (systemEp.getConfiguredReference().getTargetConfiguredServices().get(0)).setPort(service);

        system.registerModelObject(systemEp);
        ModuleComponent app1Component = createAppModuleComponent("app1");
        ModuleComponent app1aComponent = createAppModuleComponent("app1a");
        Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE);
        app1aComponent.getImplementation().getComponents().add(source);
        app1Component.getImplementation().getComponents().add(app1aComponent);
        CompositeContext root = runtime.getRootContext();
        root.registerModelObject(app1Component);
        system.publish(new ModuleStart(this));
        return runtime;
    }
View Full Code Here

Examples of org.apache.tuscany.core.context.SystemCompositeContext

    }

    private RuntimeContext createScenario3Runtime() throws Exception {
        RuntimeContext runtime = MockFactory.createCoreRuntime();
        runtime.start();
        SystemCompositeContext system = runtime.getSystemContext();
        ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1");
        ModuleComponent system2Component = MockFactory.createSystemCompositeComponent("system2");
        ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a");
        system1Component.getImplementation().getComponents().add(system1aComponent);

        Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE);
        system2Component.getImplementation().getComponents().add(target);
        EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target);
        system2Component.getImplementation().getEntryPoints().add(ep);
        system.registerModelObject(system2Component);

        Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE);
        system1aComponent.getImplementation().getComponents().add(source);
        system.registerModelObject(system1Component);
        system.publish(new ModuleStart(this));
        return runtime;
    }
View Full Code Here

Examples of org.apache.tuscany.core.context.SystemCompositeContext

    }

    private RuntimeContext createScenario4Runtime() throws Exception {
        RuntimeContext runtime = MockFactory.createCoreRuntime();
        runtime.start();
        SystemCompositeContext system = runtime.getSystemContext();
        ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1");
        ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a");
        system1Component.getImplementation().getComponents().add(system1aComponent);

        Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE);
        system1Component.getImplementation().getComponents().add(target);

        Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE);
        system1aComponent.getImplementation().getComponents().add(source);
        system.registerModelObject(system1Component);
        system.publish(new ModuleStart(this));
        return runtime;
    }
View Full Code Here

Examples of org.apache.tuscany.core.context.SystemCompositeContext

    }

    private RuntimeContext createScenario5Runtime() throws Exception {
        RuntimeContext runtime = MockFactory.createCoreRuntime();
        runtime.start();
        SystemCompositeContext system = runtime.getSystemContext();
        ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1");
        ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a");
        system1Component.getImplementation().getComponents().add(system1aComponent);

        Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE);
        system.registerModelObject(target);

        Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE);
        system1aComponent.getImplementation().getComponents().add(source);
        system.registerModelObject(system1Component);
        system.publish(new ModuleStart(this));
        return runtime;
    }
View Full Code Here

Examples of org.apache.tuscany.core.context.SystemCompositeContext

        runtime = new RuntimeContextImpl(monitorFactory, builderRegistry, new DefaultWireBuilder());
        runtime.start();

        // Load and start the system configuration
        try {
            SystemCompositeContext systemContext = runtime.getSystemContext();
            BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext);
            ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext);
            ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT);
            CompositeContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent);
            context.publish(new ModuleStart(this));

            TomcatHost host = systemContext.resolveInstance(TomcatHost.class);
            host.setHost(this);
        } catch (ConfigurationLoadException e) {
            getLogger().warn(sm.getString("runtime.loadSystemFailed", e.getResourceURI()), e);
            return;
        } catch (Exception e) {
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.