Package org.apache.tuscany.model.assembly

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


        SystemImplementation sysImpl = factory.createSystemImplementation();
        sysImpl.setImplementationClass(impl);
        sysImpl.setComponentType(componentType);

        Component sc = factory.createSimpleComponent();
        sc.setName(name);
        sc.setImplementation(sysImpl);
        return sc;
    }
View Full Code Here


        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));
View Full Code Here

        runtime.start();

        ModuleComponent app1Component = createAppModuleComponent("app1");
        ModuleComponent app1aComponent = createAppModuleComponent("app1a");
        ModuleComponent app1bComponent = createAppModuleComponent("app1b");
        Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE);
        app1aComponent.getImplementation().getComponents().add(source);
        app1Component.getImplementation().getComponents().add(app1aComponent);
        app1Component.getImplementation().getComponents().add(app1bComponent);

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

        EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target);
        ep.getBindings().add(systemFactory.createSystemBinding());
        Service service = systemFactory.createService();
View Full Code Here

        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

        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

        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

    
    public void testModelVisit() throws Exception {
        ComponentType componentType;
        Service service;
        SystemImplementation impl;
        Component component;

        Module module = factory.createModule();

        // create target component
        componentType = factory.createComponentType();
        service = factory.createService();
        service.setName("target");
        componentType.getServices().add(service);
        impl = factory.createSystemImplementation();
        impl.setComponentType(componentType);
        component = factory.createSimpleComponent();
        component.setName("target");
        component.setImplementation(impl);
        component.initialize(assemblyContext);
        module.getComponents().add(component);

        // create source component
        componentType = factory.createComponentType();
        Reference ref = factory.createReference();
        ref.setName("ref");
        componentType.getReferences().add(ref);
        impl = factory.createSystemImplementation();
        impl.setComponentType(componentType);
        component = factory.createSimpleComponent();
        component.setName("source");
        component.setImplementation(impl);
        ConfiguredReference cRef = factory.createConfiguredReference("ref", "target");
        component.getConfiguredReferences().add(cRef);
        component.initialize(assemblyContext);
        module.getComponents().add(component);

        EntryPoint ep = factory.createEntryPoint();
        JavaServiceContract contract = factory.createJavaServiceContract();
        contract.setInterface(ModuleScopeSystemComponent.class);
        service = factory.createService();
        service.setServiceContract(contract);
        ConfiguredService cService = factory.createConfiguredService();
        cService.setPort(service);
        cService.initialize(assemblyContext);
        ep.setConfiguredService(cService);
        SystemBinding binding = factory.createSystemBinding();
        ep.getBindings().add(binding);
        ConfiguredReference cEpRef = factory.createConfiguredReference();
        Reference epRef = factory.createReference();
        cEpRef.setPort(epRef);
        ep.setConfiguredReference(cEpRef);
        ep.initialize(assemblyContext);
        module.getEntryPoints().add(ep);

        List<ContextFactoryBuilder> builders = new ArrayList<ContextFactoryBuilder>();
        builders.add(new TestBuilder());
        AssemblyVisitorImpl visitor = new AssemblyVisitorImpl(builders);
        module.initialize(assemblyContext);
        visitor.start(module);

        Assert.assertSame(MARKER, component.getContextFactory());
        Assert.assertSame(MARKER, cRef.getProxyFactory());
        Assert.assertSame(MARKER, ep.getContextFactory());
        Assert.assertSame(MARKER, cEpRef.getProxyFactory());

    }
View Full Code Here

        moduleContext.stop();
    }

    public void testRegistration() throws Exception {
        CompositeContext moduleContext = createContext();
        Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        moduleContext.registerModelObject(component);
        EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component);
        moduleContext.registerModelObject(ep);
        moduleContext.start();
        moduleContext.publish(new ModuleStart(this));
View Full Code Here

        moduleContext.stop();
    }

    public void testRegistrationAfterStart() throws Exception {
        CompositeContext moduleContext = createContext();
        Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        moduleContext.start();
        moduleContext.registerModelObject(component);
        EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component);
        moduleContext.registerModelObject(ep);
        moduleContext.publish(new ModuleStart(this));
View Full Code Here

        moduleContext.stop();
    }

    public void testEPRegistrationAfterModuleStart() throws Exception {
        CompositeContext moduleContext = createContext();
        Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        moduleContext.start();
        moduleContext.registerModelObject(component);
        moduleContext.publish(new ModuleStart(this));
        GenericSystemComponent test = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(test);
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.