use of org.atmosphere.util.FakeHttpSession in project atmosphere by Atmosphere.
the class SessionTest method basicAtmosphereResourceSessionTest.
@Test
public void basicAtmosphereResourceSessionTest() throws IOException, ServletException, ExecutionException, InterruptedException {
AtmosphereRequest request = new AtmosphereRequestImpl.Builder().build();
AtmosphereResponse response = new AtmosphereResponseImpl.Builder().build();
AtmosphereConfig config = new AtmosphereFramework().getAtmosphereConfig();
AtmosphereResource r = config.resourcesFactory().create(new AtmosphereFramework().getAtmosphereConfig(), request, response, mock(AsyncSupport.class));
r.getAtmosphereConfig().setSupportSession(true);
assertNull(r.session(false));
assertNotNull(r.session());
assertNotNull(r.session(true));
assertNotNull(r.session());
request = new AtmosphereRequestImpl.Builder().session(new FakeHttpSession("-1", null, System.currentTimeMillis(), -1)).build();
response = new AtmosphereResponseImpl.Builder().build();
r = config.resourcesFactory().create(new AtmosphereFramework().getAtmosphereConfig(), request, response, mock(AsyncSupport.class));
r.getAtmosphereConfig().setSupportSession(true);
assertNotNull(r.session());
assertNotNull(r.session(true));
}
Aggregations