Search in sources :

Example 1 with ClusteredSessionImpl

use of org.apache.tapestry5.http.internal.services.ClusteredSessionImpl in project tapestry-5 by apache.

the class SessionImplTest method dirty_persisted_object_is_forced_to_update.

@Test
public void dirty_persisted_object_is_forced_to_update() {
    HttpSession hs = mockHttpSession();
    HttpServletRequest hsr = mockHttpServletRequest();
    SessionPersistedObjectAnalyzer analyzer = newMock(SessionPersistedObjectAnalyzer.class);
    Object dirty = new Object();
    SessionLock lock = mockLock();
    lock.acquireWriteLock();
    train_getAttribute(hs, "dirty", dirty);
    replay();
    Session session = new ClusteredSessionImpl(hsr, hs, lock, analyzer);
    assertSame(session.getAttribute("dirty"), dirty);
    verify();
    expect(analyzer.checkAndResetDirtyState(dirty)).andReturn(true);
    train_getSession(hsr, false, hs);
    lock.acquireWriteLock();
    hs.setAttribute("dirty", dirty);
    replay();
    session.restoreDirtyObjects();
    verify();
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) SessionPersistedObjectAnalyzer(org.apache.tapestry5.http.services.SessionPersistedObjectAnalyzer) ClusteredSessionImpl(org.apache.tapestry5.http.internal.services.ClusteredSessionImpl) HttpSession(javax.servlet.http.HttpSession) SessionLock(org.apache.tapestry5.http.internal.services.SessionLock) HttpSession(javax.servlet.http.HttpSession) Session(org.apache.tapestry5.http.services.Session) Test(org.testng.annotations.Test)

Aggregations

HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpSession (javax.servlet.http.HttpSession)1 ClusteredSessionImpl (org.apache.tapestry5.http.internal.services.ClusteredSessionImpl)1 SessionLock (org.apache.tapestry5.http.internal.services.SessionLock)1 Session (org.apache.tapestry5.http.services.Session)1 SessionPersistedObjectAnalyzer (org.apache.tapestry5.http.services.SessionPersistedObjectAnalyzer)1 Test (org.testng.annotations.Test)1