Search in sources :

Example 1 with HttpSessionMock

use of com.canoo.impl.server.util.HttpSessionMock in project dolphin-platform by canoo.

the class ClientSessionImplTest method testImmutableAttributeSet.

@Test(expectedExceptions = UnsupportedOperationException.class)
public void testImmutableAttributeSet() {
    // given:
    ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
    // then:
    dolphinSession.getAttributeNames().add("att");
}
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 2 with HttpSessionMock

use of com.canoo.impl.server.util.HttpSessionMock in project dolphin-platform by canoo.

the class ClientSessionImplTest method testMultipleAttributes.

@Test
public void testMultipleAttributes() {
    // 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");
    // then:
    Assert.assertEquals(3, dolphinSession.getAttributeNames().size());
    Assert.assertTrue(dolphinSession.getAttributeNames().contains("test-attribute1"));
    Assert.assertTrue(dolphinSession.getAttributeNames().contains("test-attribute2"));
    Assert.assertTrue(dolphinSession.getAttributeNames().contains("test-attribute3"));
    Assert.assertEquals("Hello Dolphin Session", dolphinSession.getAttribute("test-attribute1"));
    Assert.assertEquals("Yeah!", dolphinSession.getAttribute("test-attribute2"));
    Assert.assertEquals("Dolphin Platform", 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 3 with HttpSessionMock

use of com.canoo.impl.server.util.HttpSessionMock in project dolphin-platform by canoo.

the class ClientSessionImplTest method testAddAttribute.

@Test
public void testAddAttribute() {
    // given:
    ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
    // when:
    dolphinSession.setAttribute("test-attribute", "Hello Dolphin Session");
    // then:
    Assert.assertEquals(1, dolphinSession.getAttributeNames().size());
    Assert.assertTrue(dolphinSession.getAttributeNames().contains("test-attribute"));
    Assert.assertEquals("Hello Dolphin Session", 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 4 with HttpSessionMock

use of com.canoo.impl.server.util.HttpSessionMock in project dolphin-platform by canoo.

the class ClientSessionImplTest method testImmutableAttributeSet2.

@Test(expectedExceptions = UnsupportedOperationException.class)
public void testImmutableAttributeSet2() {
    // given:
    ClientSession dolphinSession = new HttpClientSessionImpl(new HttpSessionMock());
    // when:
    dolphinSession.setAttribute("test-attribute", "Hello Dolphin Session");
    // then:
    dolphinSession.getAttributeNames().remove("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 5 with HttpSessionMock

use of com.canoo.impl.server.util.HttpSessionMock 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)

Aggregations

HttpClientSessionImpl (com.canoo.dp.impl.server.client.HttpClientSessionImpl)7 HttpSessionMock (com.canoo.impl.server.util.HttpSessionMock)7 ClientSession (com.canoo.platform.server.client.ClientSession)7 Test (org.testng.annotations.Test)7