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 testSessionEnd_Pc_NoParentPc() { MockFlowSession parentSession = newFlowSession(false, null); MockFlowSession childSession = newFlowSession(true, parentSession); getListener().sessionStarting(requestContext, parentSession, null); getListener().sessionStarting(requestContext, childSession, null); assertCommitState(true, false); requestContext.setActiveSession(childSession); // Session ending commits, unbinds/closes PersistenceContext getListener().sessionEnding(requestContext, childSession, "success", null); assertSessionNotBound(); // sessionEnded has no effect getListener().sessionEnded(requestContext, childSession, "success", null); assertSessionNotBound(); assertCommitState(false, true); }