Package org.apache.tuscany.core.context.scope

Examples of org.apache.tuscany.core.context.scope.StatelessScopeContext


    }

    public Map<Scope, ScopeContext> getScopeContexts(EventContext eventContext) {
        ScopeContext aggregrateScope = new CompositeScopeContext(eventContext);
        ScopeContext moduleScoper = new ModuleScopeContext(eventContext);
        ScopeContext statelessScope = new StatelessScopeContext(eventContext);
        Map<Scope, ScopeContext> scopes = new HashMap<Scope, ScopeContext>();
        scopes.put(Scope.AGGREGATE, aggregrateScope);
        scopes.put(Scope.MODULE, moduleScoper);
        scopes.put(Scope.INSTANCE, statelessScope);
        return scopes;
View Full Code Here


    /**
     * Tests instance identity is properly maintained
     */
    public void testInstanceManagement() throws Exception {
        EventContext ctx = new EventContextImpl();
        StatelessScopeContext scope = new StatelessScopeContext(ctx);
        scope.registerFactories(createConfigurations());
        scope.start();
        // first request
        StatelessComponentImpl comp1 = (StatelessComponentImpl) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp1);
        // second request
        StatelessComponentImpl comp2 = (StatelessComponentImpl) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp2);
        Assert.assertNotSame(comp1, comp2);
        scope.stop();
    }
View Full Code Here

        scope.stop();
    }

    public void testRegisterContextBeforeRequest() throws Exception {
        EventContext ctx = new EventContextImpl();
        StatelessScopeContext scope = new StatelessScopeContext(ctx);
        scope.registerFactories(createConfigurations());
        scope.registerFactory(createConfiguration("NewTestService"));
        scope.start();
        StatelessComponent comp1 = (StatelessComponent) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp1);
        StatelessComponent comp2 = (StatelessComponent) scope.getContext("NewTestService").getInstance(null);
        Assert.assertNotNull(comp2);
        scope.stop();
    }
View Full Code Here

        scope.stop();
    }

    public void testRegisterContextAfterRequest() throws Exception {
        EventContext ctx = new EventContextImpl();
        StatelessScopeContext scope = new StatelessScopeContext(ctx);
        scope.registerFactories(createConfigurations());
        scope.start();
        StatelessComponent comp1 = (StatelessComponent) scope.getContext("TestService1").getInstance(null);
        Assert.assertNotNull(comp1);
        scope.registerFactory(createConfiguration("NewTestService"));
        StatelessComponent comp2 = (StatelessComponent) scope.getContext("NewTestService").getInstance(null);
        Assert.assertNotNull(comp2);
        scope.stop();
    }
View Full Code Here

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

TOP

Related Classes of org.apache.tuscany.core.context.scope.StatelessScopeContext

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.