use of org.apache.tapestry5.http.internal.services.TapestrySessionFactory in project tapestry-5 by apache.
the class RequestImplTest method get_session_doesnt_exist.
@Test
public void get_session_doesnt_exist() {
HttpServletRequest sr = mockHttpServletRequest();
TapestrySessionFactory sf = newMock(TapestrySessionFactory.class);
expect(sf.getSession(false)).andReturn(null);
replay();
Request request = new RequestImpl(sr, CHARSET, sf);
assertNull(request.getSession(false));
verify();
}
use of org.apache.tapestry5.http.internal.services.TapestrySessionFactory in project tapestry-5 by apache.
the class RequestImplTest method isSessionInvalidated_is_true_when_session_is_invalid.
@Test
public void isSessionInvalidated_is_true_when_session_is_invalid() {
HttpServletRequest sr = mockHttpServletRequest();
Session session = mockSession();
TapestrySessionFactory sf = newMock(TapestrySessionFactory.class);
expect(sf.getSession(false)).andReturn(session);
expect(session.isInvalidated()).andReturn(true);
replay();
Request request = new RequestImpl(sr, CHARSET, sf);
assertTrue(request.isSessionInvalidated());
verify();
}
use of org.apache.tapestry5.http.internal.services.TapestrySessionFactory in project tapestry-5 by apache.
the class RequestImplTest method isSessionInvalidated_is_false_when_no_session_at_all.
@Test
public void isSessionInvalidated_is_false_when_no_session_at_all() {
HttpServletRequest sr = mockHttpServletRequest();
TapestrySessionFactory sf = newMock(TapestrySessionFactory.class);
expect(sf.getSession(false)).andReturn(null);
replay();
Request request = new RequestImpl(sr, CHARSET, sf);
assertFalse(request.isSessionInvalidated());
verify();
}
use of org.apache.tapestry5.http.internal.services.TapestrySessionFactory in project tapestry-5 by apache.
the class RequestImplTest method force_session_create.
@Test
public void force_session_create() {
HttpServletRequest sr = mockHttpServletRequest();
TapestrySessionFactory sf = newMock(TapestrySessionFactory.class);
Session session = mockSession();
expect(sf.getSession(true)).andReturn(session);
replay();
Request request = new RequestImpl(sr, CHARSET, sf);
assertSame(request.getSession(true), session);
verify();
}
use of org.apache.tapestry5.http.internal.services.TapestrySessionFactory in project tapestry-5 by apache.
the class RequestImplTest method isSessionInvalidated_is_false_when_session_exists_and_is_valid.
@Test
public void isSessionInvalidated_is_false_when_session_exists_and_is_valid() {
HttpServletRequest sr = mockHttpServletRequest();
Session session = mockSession();
TapestrySessionFactory sf = newMock(TapestrySessionFactory.class);
expect(sf.getSession(false)).andReturn(session);
expect(session.isInvalidated()).andReturn(false);
replay();
Request request = new RequestImpl(sr, CHARSET, sf);
assertFalse(request.isSessionInvalidated());
verify();
}
Aggregations