Search in sources :

Example 16 with ClientSession

use of com.canoo.platform.server.client.ClientSession in project dolphin-platform by canoo.

the class ClientSessionImplTest method testRemoveAttribute.

@Test
public void testRemoveAttribute() {
    // given:
    ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
    // when:
    dolphinSession.setAttribute("test-attribute", "Hello Dolphin Session");
    dolphinSession.removeAttribute("test-attribute");
    // then:
    Assert.assertEquals(0, dolphinSession.getAttributeNames().size());
    Assert.assertNull(dolphinSession.getAttribute("test-attribute"));
}
Also used : HttpSessionMock(com.canoo.impl.server.util.HttpSessionMock) ClientSession(com.canoo.platform.server.client.ClientSession) HttpClientSessionImpl(com.canoo.dp.impl.server.client.HttpClientSessionImpl) Test(org.testng.annotations.Test)

Example 17 with ClientSession

use of com.canoo.platform.server.client.ClientSession in project dolphin-platform by canoo.

the class ClientSessionImplTest method testInvalidate.

@Test
public void testInvalidate() {
    // given:
    ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
    // when:
    dolphinSession.setAttribute("test-attribute1", "Hello Dolphin Session");
    dolphinSession.setAttribute("test-attribute2", "Yeah!");
    dolphinSession.setAttribute("test-attribute3", "Dolphin Platform");
    dolphinSession.invalidate();
    // then:
    Assert.assertEquals(0, dolphinSession.getAttributeNames().size());
    Assert.assertFalse(dolphinSession.getAttributeNames().contains("test-attribute1"));
    Assert.assertFalse(dolphinSession.getAttributeNames().contains("test-attribute2"));
    Assert.assertFalse(dolphinSession.getAttributeNames().contains("test-attribute3"));
    Assert.assertNull(dolphinSession.getAttribute("test-attribute1"));
    Assert.assertNull(dolphinSession.getAttribute("test-attribute2"));
    Assert.assertNull(dolphinSession.getAttribute("test-attribute3"));
}
Also used : HttpSessionMock(com.canoo.impl.server.util.HttpSessionMock) ClientSession(com.canoo.platform.server.client.ClientSession) HttpClientSessionImpl(com.canoo.dp.impl.server.client.HttpClientSessionImpl) Test(org.testng.annotations.Test)

Example 18 with ClientSession

use of com.canoo.platform.server.client.ClientSession in project dolphin-platform by canoo.

the class ClientSessionImplTest method testNullAttribute.

@Test
public void testNullAttribute() {
    // given:
    ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
    // then:
    Assert.assertEquals(0, dolphinSession.getAttributeNames().size());
    Assert.assertNull(dolphinSession.getAttribute("test-attribute"));
}
Also used : HttpSessionMock(com.canoo.impl.server.util.HttpSessionMock) ClientSession(com.canoo.platform.server.client.ClientSession) HttpClientSessionImpl(com.canoo.dp.impl.server.client.HttpClientSessionImpl) Test(org.testng.annotations.Test)

Aggregations

ClientSession (com.canoo.platform.server.client.ClientSession)18 HttpClientSessionImpl (com.canoo.dp.impl.server.client.HttpClientSessionImpl)7 HttpSessionMock (com.canoo.impl.server.util.HttpSessionMock)7 Test (org.testng.annotations.Test)7 ClientSessionLifecycleHandlerImpl (com.canoo.dp.impl.server.client.ClientSessionLifecycleHandlerImpl)3 DolphinContextProvider (com.canoo.dp.impl.server.context.DolphinContextProvider)3 ClientSessionProvider (com.canoo.dp.impl.server.client.ClientSessionProvider)2 DolphinContext (com.canoo.dp.impl.server.context.DolphinContext)2 ClasspathScanner (com.canoo.platform.server.spi.components.ClasspathScanner)2 ManagedBeanFactory (com.canoo.platform.server.spi.components.ManagedBeanFactory)2 ServletContext (javax.servlet.ServletContext)2 HttpSession (javax.servlet.http.HttpSession)2 CreateContextCommand (com.canoo.dp.impl.remoting.commands.CreateContextCommand)1 Command (com.canoo.dp.impl.remoting.legacy.communication.Command)1 ClientSessionFilter (com.canoo.dp.impl.server.client.ClientSessionFilter)1 ClientSessionLifecycleHandler (com.canoo.dp.impl.server.client.ClientSessionLifecycleHandler)1 ClientSessionManager (com.canoo.dp.impl.server.client.ClientSessionManager)1 ClientSessionMutextHolder (com.canoo.dp.impl.server.client.ClientSessionMutextHolder)1 HttpSessionCleanerListener (com.canoo.dp.impl.server.client.HttpSessionCleanerListener)1 RemotingConfiguration (com.canoo.dp.impl.server.config.RemotingConfiguration)1