Examples of EventContextImpl


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

        scope.onEvent(new ModuleStop(this));
        scope.stop();
    }

    public void testRegisterContextBeforeStart() throws Exception {
        EventContext ctx = new EventContextImpl();
        ModuleScopeContext scope = new ModuleScopeContext(ctx);
        scope.registerFactories(createConfigurations());
        scope.start();
        scope.registerFactory(createConfiguration("NewTestService"));
        scope.onEvent(new ModuleStart(this));
View Full Code Here

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

        Assert.assertTrue(comp2.isDestroyed());
        scope.stop();
    }

    public void testRegisterContextAfterStart() throws Exception {
        EventContext ctx = new EventContextImpl();
        ModuleScopeContext scope = new ModuleScopeContext(ctx);
        scope.start();
        scope.registerFactory(createConfiguration("NewTestService"));
        scope.onEvent(new ModuleStart(this));
        scope.registerFactories(createConfigurations());
View Full Code Here

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

    /**
     * Tests instance identity is properly maintained
     */
    public void testInstanceManagement() throws Exception {
        EventContext ctx = new EventContextImpl();
        RequestScopeContext scope = new RequestScopeContext(ctx);
        scope.registerFactories(createConfigurations());
        scope.start();

        // first request
View Full Code Here

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

        scope.stop();
    }

    public void testRegisterContextBeforeRequest() throws Exception {
        EventContext ctx = new EventContextImpl();
        RequestScopeContext scope = new RequestScopeContext(ctx);
        scope.registerFactories(createConfigurations());
        scope.registerFactory(createConfiguration("NewTestService"));
        scope.start();
        RequestScopeComponent comp1 = (RequestScopeComponent) scope.getContext("TestService1").getInstance(null);
View Full Code Here

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

        scope.onEvent(new RequestEnd(this,id));
        scope.stop();
    }

    public void testRegisterContextAfterRequest() throws Exception {
        EventContext ctx = new EventContextImpl();
        RequestScopeContext scope = new RequestScopeContext(ctx);
        scope.registerFactories(createConfigurations());
        scope.start();
        RequestScopeComponent comp1 = (RequestScopeComponent) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp1);
View Full Code Here

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

    /**
     * Tests setting no components in the scope
     */
    public void testSetNullComponents() throws Exception {
        EventContext ctx = new EventContextImpl();
        RequestScopeContext scope = new RequestScopeContext(ctx);
        scope.registerFactories(createConfigurations());
        scope.start();
        scope.stop();
    }
View Full Code Here

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

        scope.start();
        scope.stop();
    }

    public void testGetComponentByKey() throws Exception {
        EventContext ctx = new EventContextImpl();
        RequestScopeContext scope = new RequestScopeContext(ctx);
        scope.registerFactories(createConfigurations());
        scope.start();

        RequestScopeComponentImpl comp1 = (RequestScopeComponentImpl) scope.getContext("TestService1").getInstance(null);
View Full Code Here

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

        moduleContext.stop();
    }

    protected CompositeContext createContext() {
        List<ContextFactoryBuilder> builders = MockFactory.createSystemBuilders();
        return new CompositeContextImpl("test.context", null, new DefaultScopeStrategy(), new EventContextImpl(),
                new MockConfigContext(builders));
    }
View Full Code Here

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

public class DependencyLifecycleTestCase extends TestCase {



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

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

        assertEquals(0,source.getNumberInstantiated());
        scope.stop();
    }

    public void testInitDestroyOrderSessionScope() throws Exception {
        EventContext ctx = new EventContextImpl();
        SessionScopeContext scope = new SessionScopeContext(ctx);
        scope.registerFactories(MockContextFactory.createWiredContexts(Scope.SESSION,scope));
        scope.start();
        Object session =  new Object();
        ctx.setIdentifier(HttpSessionEvent.HTTP_IDENTIFIER,session);
        scope.onEvent(new HttpSessionBound(this,session));
        OrderedDependentPojo source = (OrderedDependentPojo) scope.getContext("source").getInstance(null);
        assertNotNull(source.getPojo());
        // expire module
        assertEquals(2,source.getNumberInstantiated());
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.