Package org.apache.tuscany.core.mock.component

Examples of org.apache.tuscany.core.mock.component.ModuleScopeInitDestroyComponent


            scope,
            ModuleScopeDestroyOnlyComponent.class);
        destroyOnlyContext.start();

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

        ModuleScopeInitOnlyComponent initOnly = (ModuleScopeInitOnlyComponent) scope.getInstance(initOnlyContext);
        Assert.assertNotNull(initOnly);

        ModuleScopeDestroyOnlyComponent destroyOnly =
            (ModuleScopeDestroyOnlyComponent) scope.getInstance(destroyOnlyContext);
        Assert.assertNotNull(destroyOnly);

        Assert.assertTrue(initDestroy.isInitialized());
        Assert.assertTrue(initOnly.isInitialized());
        Assert.assertFalse(initDestroy.isDestroyed());
        Assert.assertFalse(destroyOnly.isDestroyed());

        // expire module
        scope.onEvent(new CompositeStop(this, null));

        Assert.assertTrue(initDestroy.isDestroyed());
        Assert.assertTrue(destroyOnly.isDestroyed());

        scope.stop();
    }
View Full Code Here


        WorkContext workContext = new WorkContextImpl();
        ModuleScopeContainer scopeContext = new ModuleScopeContainer(workContext);
        scopeContext.start();
        SystemAtomicComponent atomicContext = createContext(scopeContext);
        // start the request
        ModuleScopeInitDestroyComponent o1 =
            (ModuleScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
        assertTrue(o1.isInitialized());
        assertFalse(o1.isDestroyed());
        ModuleScopeInitDestroyComponent o2 =
            (ModuleScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
        assertEquals(o1, o2);
        scopeContext.onEvent(new CompositeStop(this, null));
        assertTrue(o1.isDestroyed());
        scopeContext.stop();
View Full Code Here

        ModuleScopeContainer scopeContext = new ModuleScopeContainer(workContext);
        scopeContext.start();

        SystemAtomicComponent atomicContext = createContext(scopeContext);

        ModuleScopeInitDestroyComponent o1 =
            (ModuleScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
        assertTrue(o1.isInitialized());
        assertFalse(o1.isDestroyed());

        ModuleScopeInitDestroyComponent o2 =
            (ModuleScopeInitDestroyComponent) scopeContext.getInstance(atomicContext);
        assertSame(o1, o2);
        scopeContext.onEvent(new CompositeStop(this, null));
        assertTrue(o1.isDestroyed());
        scopeContext.stop();
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.mock.component.ModuleScopeInitDestroyComponent

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.