Search in sources :

Example 6 with TestHttpSession

use of org.eclipse.scout.rt.testing.server.TestHttpSession in project scout.rt by eclipse.

the class ServerSessionCacheTest method testMultipleHttpSessions.

/**
 * If there are multiple HTTP sessions (can happen, if many requests are created in parallel for the same sessionId),
 * but a single sessionId, a new server session should only be created once.
 */
@Test
public void testMultipleHttpSessions() {
    TestHttpSession httpSession1 = new TestHttpSession();
    TestHttpSession httpSession2 = new TestHttpSession();
    IServerSessionLifecycleHandler handler = new TestServerSessionLifecycleHandler();
    IServerSession session1 = BEANS.get(ServerSessionCache.class).getOrCreate(handler, httpSession1);
    IServerSession session2 = BEANS.get(ServerSessionCache.class).getOrCreate(handler, httpSession2);
    assertSame(session1, session2);
}
Also used : IServerSession(org.eclipse.scout.rt.server.IServerSession) TestHttpSession(org.eclipse.scout.rt.testing.server.TestHttpSession) Test(org.junit.Test)

Aggregations

IServerSession (org.eclipse.scout.rt.server.IServerSession)6 TestHttpSession (org.eclipse.scout.rt.testing.server.TestHttpSession)6 Test (org.junit.Test)6 IBlockingCondition (org.eclipse.scout.rt.platform.job.IBlockingCondition)1 AbstractServerSession (org.eclipse.scout.rt.server.AbstractServerSession)1