* @version $Rev: 451895 $ $Date: 2006-10-01 23:58:18 -0700 (Sun, 01 Oct 2006) $
*/
public class HttpSessionScopeInstanceLifecycleTestCase extends TestCase {
public void testInitDestroy() throws Exception {
WorkContext ctx = new WorkContextImpl();
HttpSessionScopeContainer scope = new HttpSessionScopeContainer(ctx);
scope.start();
SystemAtomicComponent initDestroyContext = MockFactory.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();
Object session = new Object();
ctx.setIdentifier(HttpSessionScopeContainer.HTTP_IDENTIFIER, session);
scope.onEvent(new HttpSessionStart(this, session));
RequestScopeInitDestroyComponent initDestroy =
(RequestScopeInitDestroyComponent) scope.getInstance(initDestroyContext);
Assert.assertNotNull(initDestroy);