Package org.apache.tuscany.spi.component

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


        initDestroyContext.start();

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

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


        initOnlyContext.start();

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

        Object session = new Object();
        ctx.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
        scope.onEvent(new HttpSessionStart(this, session));
        RequestScopeInitDestroyComponent 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();

        scope.onEvent(new CompositeStart(this, null));
        Object instance = context.getServiceInstance();
        assertSame(instance, context.getServiceInstance());
View Full Code Here

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

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

    public void testSystemServiceLifecycle() throws Exception {
        List<Class<?>> services = new ArrayList<Class<?>>();
        services.add(Foo.class);
        CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
        SystemAtomicComponent component = EasyMock.createMock(SystemAtomicComponent.class);
        component.start();
        EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
        component.stop();
        EasyMock.replay(component);
View Full Code Here

    public void testSystemServiceAutowire() throws Exception {
        List<Class<?>> services = new ArrayList<Class<?>>();
        services.add(Foo.class);
        CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
        SystemAtomicComponent component = EasyMock.createMock(SystemAtomicComponent.class);
        component.start();
        EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component.getServiceInstance()).andReturn(new Foo() {
        });
        EasyMock.expect(component.isSystem()).andReturn(true).atLeastOnce();
View Full Code Here

    public void testAutowire() throws Exception {
        List<Class<?>> services = new ArrayList<Class<?>>();
        services.add(Foo.class);
        CompositeComponent parent = new CompositeComponentImpl("foo", "foo", null, null, null);
        SystemAtomicComponent component = EasyMock.createMock(SystemAtomicComponent.class);
        component.start();
        EasyMock.expect(component.getName()).andReturn("bar").atLeastOnce();
        EasyMock.expect(component.getServiceInterfaces()).andReturn(services);
        EasyMock.expect(component.getServiceInstance()).andReturn(new Foo() {
        });
        EasyMock.expect(component.isSystem()).andReturn(false).atLeastOnce();
View Full Code Here

        RequestScopeContainer scope = new RequestScopeContainer(ctx);
        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

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

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

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

            MockFactory.createAtomicComponent("InitOnly", scope, RequestScopeInitOnlyComponent.class);
        initOnlyContext.start();

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

        scope.onEvent(new RequestStart(this));
        RequestScopeInitDestroyComponent initDestroy =
            (RequestScopeInitDestroyComponent) scope.getInstance(initDestroyContext);
        Assert.assertNotNull(initDestroy);
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.