Package org.apache.tuscany.spi.component

Examples of org.apache.tuscany.spi.component.SystemAtomicComponent.start()


        SystemAtomicComponent sourceContext = new SystemAtomicComponentImpl("source", configuration);
        QualifiedName qName = new QualifiedName("service");
        OutboundWire outboundWire = new SystemOutboundWireImpl("setTarget", qName, Target.class);
        outboundWire.setTargetWire(inboundWire);
        sourceContext.addOutboundWire(outboundWire);
        sourceContext.start();
        assertSame(((Source) sourceContext.getServiceInstance()).getTarget(), target);
        // wires should pass back direct ref
        EasyMock.verify(inboundWire);
    }
}
View Full Code Here


        scope.start();

        SystemAtomicComponent initDestroyContext = MockFactory.createAtomicComponent("InitDestroy",
            scope,
            ModuleScopeInitDestroyComponent.class);
        initDestroyContext.start();

        SystemAtomicComponent initOnlyContext = MockFactory.createAtomicComponent("InitOnly",
            scope,
            ModuleScopeInitOnlyComponent.class);
        initOnlyContext.start();
View Full Code Here

        initDestroyContext.start();

        SystemAtomicComponent initOnlyContext = MockFactory.createAtomicComponent("InitOnly",
            scope,
            ModuleScopeInitOnlyComponent.class);
        initOnlyContext.start();

        SystemAtomicComponent destroyOnlyContext = MockFactory.createAtomicComponent("DestroyOnly",
            scope,
            ModuleScopeDestroyOnlyComponent.class);
        destroyOnlyContext.start();
View Full Code Here

        initOnlyContext.start();

        SystemAtomicComponent destroyOnlyContext = MockFactory.createAtomicComponent("DestroyOnly",
            scope,
            ModuleScopeDestroyOnlyComponent.class);
        destroyOnlyContext.start();

        scope.onEvent(new CompositeStart(this, null));
        ModuleScopeInitDestroyComponent initDestroy =
            (ModuleScopeInitDestroyComponent) scope.getInstance(initDestroyContext);
        Assert.assertNotNull(initDestroy);
View Full Code Here

        configuration.setInitInvoker(initInvoker);
        configuration.setDestroyInvoker(destroyInvoker);
        Constructor<InitDestroyOnce> ctr = InitDestroyOnce.class.getConstructor((Class<?>[]) null);
        configuration.setInstanceFactory(new PojoObjectFactory<InitDestroyOnce>(ctr));
        SystemAtomicComponent context = new SystemAtomicComponentImpl("InitDestroy", configuration);
        context.start();

        Object instance = context.getServiceInstance();
        assertSame(instance, context.getServiceInstance());

        scope.onEvent(new RequestEnd(this));
View Full Code Here

        scope.onEvent(new RequestEnd(this));
        scope.stop();
        context.stop();

        scope.start();
        context.start();
        assertNotSame(instance, context.getServiceInstance());
        scope.onEvent(new RequestEnd(this));
        scope.stop();
        context.stop();
    }
View Full Code Here

        configuration.setInitInvoker(initInvoker);
        configuration.setDestroyInvoker(destroyInvoker);
        Constructor<InitDestroyOnce> ctr = InitDestroyOnce.class.getConstructor((Class<?>[]) null);
        configuration.setInstanceFactory(new PojoObjectFactory<InitDestroyOnce>(ctr));
        SystemAtomicComponent context = new SystemAtomicComponentImpl("InitDestroy", configuration);
        context.start();

        Object session = new Object();
        ctx.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
        scope.onEvent(new HttpSessionStart(this, session));
        Object instance = context.getServiceInstance();
View Full Code Here

        scope.stop();
        context.stop();

        scope.start();
        scope.onEvent(new HttpSessionStart(this, session));
        context.start();
        assertNotSame(instance, context.getServiceInstance());
        scope.onEvent(new HttpSessionEnd(this, session));
        scope.stop();
        context.stop();
    }
View Full Code Here

    public void testSystemRestart() throws NoSuchMethodException {
        List<Class<?>> interfaces = new ArrayList<Class<?>>();
        interfaces.add(Source.class);
        Source originalSource = new SourceImpl();
        SystemAtomicComponent component = EasyMock.createMock(SystemAtomicComponent.class);
        component.start();
        component.stop();
        EasyMock.expectLastCall().times(2);
        EasyMock.expect(component.getName()).andReturn("source").atLeastOnce();
        EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
        EasyMock.expect(component.getServiceInstance()).andReturn(originalSource).atLeastOnce();
View Full Code Here

        scope.start();

        SystemAtomicComponent initDestroyContext = MockFactory.createAtomicComponent("InitDestroy",
            scope,
            RequestScopeInitDestroyComponent.class);
        initDestroyContext.start();

        SystemAtomicComponent initOnlyContext = MockFactory.createAtomicComponent("InitOnly",
            scope,
            RequestScopeInitOnlyComponent.class);
        initOnlyContext.start();
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.