Package org.apache.tuscany.core.context.event

Examples of org.apache.tuscany.core.context.event.ModuleStart


    public void testModuleRegistration() throws Exception {
        CompositeContext moduleContext = createContext();
        Module module = MockFactory.createSystemModule();
        moduleContext.registerModelObject(module);
        moduleContext.start();
        moduleContext.publish(new ModuleStart(this));
        GenericSystemComponent component = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(component);
        GenericSystemComponent ep = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null);
        Assert.assertNotNull(ep);
        moduleContext.publish(new ModuleStop(this));
View Full Code Here


    public void testModuleRegistrationAfterStart() throws Exception {
        CompositeContext moduleContext = createContext();
        moduleContext.start();
        Module module = MockFactory.createSystemModule();
        moduleContext.registerModelObject(module);
        moduleContext.publish(new ModuleStart(this));
        GenericSystemComponent component = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(component);
        GenericSystemComponent ep = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null);
        Assert.assertNotNull(ep);
        moduleContext.publish(new ModuleStop(this));
View Full Code Here

        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));
        GenericSystemComponent test = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(test);
        GenericSystemComponent testEP = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null);
        Assert.assertNotNull(testEP);
        moduleContext.publish(new ModuleStop(this));
View Full Code Here

        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));
        GenericSystemComponent test = (GenericSystemComponent) moduleContext.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(test);
        GenericSystemComponent testEP = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null);
        Assert.assertNotNull(testEP);
        moduleContext.publish(new ModuleStop(this));
View Full Code Here

    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);
        EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component);
        moduleContext.registerModelObject(ep);
        GenericSystemComponent testEP = (GenericSystemComponent) moduleContext.getContext("TestService1EP").getInstance(null);
View Full Code Here

    public void testInitDestroyOrderModuleScope() throws Exception {
        EventContext ctx = new EventContextImpl();
        ModuleScopeContext scope = new ModuleScopeContext(ctx);
        scope.registerFactories(MockContextFactory.createWiredContexts(Scope.MODULE,scope));
        scope.start();
        scope.onEvent(new ModuleStart(this));
        OrderedDependentPojo source = (OrderedDependentPojo) scope.getContext("source").getInstance(null);
        assertNotNull(source.getPojo());
        // expire module
        assertEquals(2,source.getNumberInstantiated());
        scope.onEvent(new ModuleStop(this));
View Full Code Here

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

        List<Extensible> models = createAssembly();
        for (Extensible model : models) {
            child.registerModelObject(model);
        }

        scopeContainer.onEvent(new ModuleStart(this));
        Object session = new Object();
        Object id = new Object();
        //ctx.setIdentifier(EventContext.SESSION,session);
        scopeContainer.onEvent(new RequestStart(this,id));
        scopeContainer.onEvent(new HttpSessionBound(this,session));
View Full Code Here

        CompositeContext child = (CompositeContext) scopeContainer.getContext("CompositeComponent");
        List<Extensible> parts = createAssembly();
        for (Extensible part : parts) {
            child.registerModelObject(part);
        }
        scopeContainer.onEvent(new ModuleStart(this));
        scopeContainer.getContext("CompositeComponent");
    }
View Full Code Here

        CompositeContext moduleComponentCtx = new CompositeContextImpl();
        moduleComponentCtx.setName("testMC");
        CompositeScopeContext scopeContainer = new CompositeScopeContext(ctx);
        scopeContainer.registerFactory(MockFactory.createCompositeConfiguration("CompositeComponent"));
        scopeContainer.start();
        scopeContainer.onEvent(new ModuleStart(this));
        scopeContainer.getContext("CompositeComponent");
        scopeContainer.onEvent(new ModuleStop(this));
        scopeContainer.stop();
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.context.event.ModuleStart

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.