Search in sources :

Example 1 with NoOpsRequest

use of org.atmosphere.cpr.AtmosphereRequestImpl.NoOpsRequest in project atmosphere by Atmosphere.

the class SessionTest method sessionReplacementTest.

@Test
public void sessionReplacementTest() {
    AtmosphereConfig config = new AtmosphereFramework().getAtmosphereConfig();
    config.setSupportSession(true);
    HttpServletRequest httpRequest = new NoOpsRequest();
    AtmosphereRequest request = new AtmosphereRequestImpl.Builder().request(httpRequest).session(httpRequest.getSession(true)).build();
    AtmosphereResponse response = new AtmosphereResponseImpl.Builder().build();
    AtmosphereResource r = config.resourcesFactory().create(config, request, response, mock(AsyncSupport.class));
    request.setAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE, r);
    assertNotNull(request.getSession());
    request.getSession().invalidate();
    assertNull(request.getSession(false));
    assertNotNull(r.session(true));
}
Also used : HttpServletRequest(jakarta.servlet.http.HttpServletRequest) NoOpsRequest(org.atmosphere.cpr.AtmosphereRequestImpl.NoOpsRequest) Test(org.testng.annotations.Test)

Aggregations

HttpServletRequest (jakarta.servlet.http.HttpServletRequest)1 NoOpsRequest (org.atmosphere.cpr.AtmosphereRequestImpl.NoOpsRequest)1 Test (org.testng.annotations.Test)1