Package org.apache.tuscany.core.component.scope

Examples of org.apache.tuscany.core.component.scope.ModuleScopeContainer.start()


     * Tests a module-to-request scoped wire
     */
    public void testModuleToRequest() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        ScopeContainer moduleScope = new ModuleScopeContainer(ctx);
        moduleScope.start();
        final ScopeContainer requestScope = new RequestScopeContainer(ctx);
        requestScope.start();

        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
            moduleScope, members, "target", Target.class, TargetImpl.class, requestScope);
View Full Code Here


     * Tests a module-to-stateless scoped wire is setup properly by the runtime
     */
    public void testModuleToStateless() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        ScopeContainer moduleScope = new ModuleScopeContainer(ctx);
        moduleScope.start();
        ScopeContainer statelessScope = new StatelessScopeContainer(ctx);
        statelessScope.start();

        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
            moduleScope, members, "target", Target.class, TargetImpl.class, statelessScope);
View Full Code Here

     * Tests a session-to-module scoped wire
     */
    public void testSessionToModule() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        ScopeContainer moduleScope = new ModuleScopeContainer(ctx);
        moduleScope.start();
        ScopeContainer sessionScope = new HttpSessionScopeContainer(ctx);
        sessionScope.start();

        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
            sessionScope, members, "target", Target.class, TargetImpl.class, moduleScope);
View Full Code Here

    public void testRequestToModule() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        final ScopeContainer requestScope = new RequestScopeContainer(ctx);
        final ScopeContainer moduleScope = new ModuleScopeContainer(ctx);
        requestScope.start();
        moduleScope.start();
        moduleScope.onEvent(new CompositeStart(this, null));

        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
            requestScope, members, "target", Target.class, TargetImpl.class, moduleScope);
        requestScope.onEvent(new RequestStart(this));
View Full Code Here

    /**
     * Tests a basic invocation to a target
     */
    public void testTargetInvocation() throws Exception {
        ModuleScopeContainer scope = new ModuleScopeContainer(null);
        scope.start();
        List<Class<?>> services = new ArrayList<Class<?>>();
        services.add(Greeting.class);
        JavaScriptComponent context =
            new JavaScriptComponent("source", implClass2, new HashMap<String, Object>(), services, null, scope,
                ArtifactFactory.createWireService(), null);
View Full Code Here

    public void testStatelessToModule() throws Exception {
        WorkContext ctx = new WorkContextImpl();
        ScopeContainer statelessScope = new StatelessScopeContainer(ctx);
        statelessScope.start();
        ScopeContainer moduleScope = new ModuleScopeContainer(ctx);
        moduleScope.start();

        Map<String, AtomicComponent> contexts = MockFactory.createWiredComponents("source", SourceImpl.class,
            statelessScope, members, "target", Target.class, TargetImpl.class, moduleScope);
        moduleScope.onEvent(new CompositeStart(this, null));
        AtomicComponent sourceComponent = contexts.get("source");
View Full Code Here

    /**
     * Tests a basic invocation down a target wire
     */
    public void testTargetWireInvocation() throws Exception {
        ModuleScopeContainer scope = new ModuleScopeContainer(null);
        scope.start();
        List<Class<?>> services = new ArrayList<Class<?>>();
        services.add(Greeting.class);
        JavaScriptComponent context =
            new JavaScriptComponent("source", implClass2, new HashMap<String, Object>(), services, null, scope,
                ArtifactFactory.createWireService(), null);
View Full Code Here

    }

    public void testToModuleScope() throws Exception {

        ModuleScopeContainer scope = new ModuleScopeContainer(workContext);
        scope.start();
        scope.onEvent(new CompositeStart(this, null));
        final OutboundWire wire = getWire(scope);
        Target service = (Target) wireService.createProxy(wire);
        Target target = (Target) wireService.createProxy(wire);
        assertNotNull(service);
View Full Code Here

        Assert.assertNotNull(echoMethod);
    }

    public void testScopedInvoke() throws Exception {
        ScopeContainer scope = new ModuleScopeContainer(null);
        scope.start();
        JavaAtomicComponent component =
            MockFactory.createJavaComponent("foo", scope, Echo.class);
        scope.register(component);
        JavaTargetInvoker invoker = new JavaTargetInvoker(echoMethod, component);
        invoker.setCacheable(false);
View Full Code Here

        scope.stop();
    }

    public void testClone() throws Exception {
        ScopeContainer scope = new ModuleScopeContainer(null);
        scope.start();
        JavaAtomicComponent component =
            MockFactory.createJavaComponent("foo", scope, Echo.class);
        scope.register(component);
        JavaTargetInvoker invoker = new JavaTargetInvoker(echoMethod, component);
        invoker.setCacheable(false);
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.