use of org.apache.tapestry5.http.internal.services.SessionImpl in project tapestry-5 by apache.
the class SessionImplTest method http_session_invalidate.
@Test
public void http_session_invalidate() {
HttpSession hs = mockHttpSession();
HttpServletRequest hsr = mockHttpServletRequest();
SessionLock lock = mockLock();
train_getSession(hsr, false, hs);
replay();
Session session = new SessionImpl(hsr, hs, lock);
assertFalse(session.isInvalidated());
verify();
train_getSession(hsr, false, null);
replay();
assertTrue(session.isInvalidated());
verify();
train_getSession(hsr, false, mockHttpSession());
replay();
assertTrue(session.isInvalidated());
}
use of org.apache.tapestry5.http.internal.services.SessionImpl in project tapestry-5 by apache.
the class SessionImplTest method get_max_inactive.
@Test
public void get_max_inactive() {
HttpSession hs = mockHttpSession();
int seconds = 999;
expect(hs.getMaxInactiveInterval()).andReturn(seconds);
replay();
Session session = new SessionImpl(null, hs, null);
assertEquals(session.getMaxInactiveInterval(), seconds);
verify();
}
use of org.apache.tapestry5.http.internal.services.SessionImpl in project tapestry-5 by apache.
the class SessionImplTest method get_attribute_names.
@Test
public void get_attribute_names() {
Enumeration e = Collections.enumeration(Arrays.asList("fred", "barney"));
HttpSession hs = mockHttpSession();
SessionLock lock = mockLock();
lock.acquireReadLock();
expect(hs.getAttributeNames()).andReturn(e);
replay();
Session session = new SessionImpl(null, hs, lock);
assertEquals(session.getAttributeNames(), Arrays.asList("barney", "fred"));
verify();
}
use of org.apache.tapestry5.http.internal.services.SessionImpl in project tapestry-5 by apache.
the class SessionImplTest method invalidate.
@Test
public void invalidate() {
HttpSession hs = mockHttpSession();
SessionLock lock = mockLock();
hs.invalidate();
replay();
Session session = new SessionImpl(null, hs, lock);
session.invalidate();
verify();
}
use of org.apache.tapestry5.http.internal.services.SessionImpl in project tapestry-5 by apache.
the class SessionImplTest method get_attribute_names_by_prefix.
@Test
public void get_attribute_names_by_prefix() {
Enumeration e = Collections.enumeration(Arrays.asList("fred", "barney", "fanny"));
HttpSession hs = mockHttpSession();
SessionLock lock = mockLock();
lock.acquireReadLock();
expect(hs.getAttributeNames()).andReturn(e);
replay();
Session session = new SessionImpl(null, hs, lock);
assertEquals(session.getAttributeNames("f"), Arrays.asList("fanny", "fred"));
verify();
}
Aggregations