public void testSessionEnd_Pc_ParentPc() { MockFlowSession parentSession = newFlowSession(true, null); MockFlowSession childSession = newFlowSession(true, parentSession); getListener().sessionStarting(requestContext, parentSession, null); getListener().sessionStarting(requestContext, childSession, null); assertCommitState(true, false); requestContext.setActiveSession(childSession); // sessionEnding is a no-op getListener().sessionEnding(requestContext, childSession, "success", null); assertSessionBound(); assertCommitState(true, false); // sessionEnded binds Parent PersistenceContext getListener().sessionEnded(requestContext, childSession, "success", null); assertSessionBound(); }
public void testSessionStarting_Pc_ParentPc() { MockFlowSession parentSession = newFlowSession(true, null); MockFlowSession childSession = newFlowSession(true, parentSession); getListener().sessionStarting(new MockRequestContext(), parentSession, null); assertSessionBound(); assertSessionInScope(parentSession); getListener().sessionStarting(new MockRequestContext(), childSession, null); assertSessionBound(); assertSessionInScope(childSession); assertSame("Parent PersistenceContext should be re-used", parentSession.getScope().get("persistenceContext"), childSession.getScope().get("persistenceContext")); }
public void testSessionStarting_NoPc_ParentPc() { MockFlowSession parentSession = newFlowSession(true, null); MockFlowSession childSession = newFlowSession(false, parentSession); getListener().sessionStarting(new MockRequestContext(), parentSession, null); assertSessionBound(); assertSessionInScope(parentSession); getListener().sessionStarting(new MockRequestContext(), childSession, null); assertSessionNotBound(); assertSessionNotInScope(childSession); }