Search in sources :

Example 6 with ImmutableSessionAttributes

use of org.wildfly.clustering.web.session.ImmutableSessionAttributes in project wildfly by wildfly.

the class InfinispanSessionFactoryTestCase method createImmutableSession.

@Test
public void createImmutableSession() {
    Map.Entry<InfinispanSessionMetaData<Object>, Object> entry = mock(Map.Entry.class);
    SessionCreationMetaData creationMetaData = mock(SessionCreationMetaData.class);
    SessionAccessMetaData accessMetaData = mock(SessionAccessMetaData.class);
    InfinispanSessionMetaData<Object> metaDataValue = new InfinispanSessionMetaData<>(creationMetaData, accessMetaData, null);
    Object attributesValue = new Object();
    ImmutableSessionMetaData metaData = mock(ImmutableSessionMetaData.class);
    ImmutableSessionAttributes attributes = mock(ImmutableSessionAttributes.class);
    String id = "id";
    when(entry.getKey()).thenReturn(metaDataValue);
    when(entry.getValue()).thenReturn(attributesValue);
    when(this.metaDataFactory.createImmutableSessionMetaData(id, metaDataValue)).thenReturn(metaData);
    when(this.attributesFactory.createImmutableSessionAttributes(id, attributesValue)).thenReturn(attributes);
    ImmutableSession result = this.factory.createImmutableSession(id, entry);
    assertSame(id, result.getId());
    assertSame(metaData, result.getMetaData());
    assertSame(attributes, result.getAttributes());
}
Also used : ImmutableSessionAttributes(org.wildfly.clustering.web.session.ImmutableSessionAttributes) ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) ImmutableSessionMetaData(org.wildfly.clustering.web.session.ImmutableSessionMetaData) Map(java.util.Map) Test(org.junit.Test)

Aggregations

ImmutableSession (org.wildfly.clustering.web.session.ImmutableSession)6 ImmutableSessionAttributes (org.wildfly.clustering.web.session.ImmutableSessionAttributes)6 ImmutableSessionMetaData (org.wildfly.clustering.web.session.ImmutableSessionMetaData)5 Test (org.junit.Test)4 Map (java.util.Map)2 Batch (org.wildfly.clustering.ee.Batch)2 SessionExpirationListener (org.wildfly.clustering.web.session.SessionExpirationListener)2 HttpServerExchange (io.undertow.server.HttpServerExchange)1 Session (io.undertow.server.session.Session)1 SessionListener (io.undertow.server.session.SessionListener)1 SessionListeners (io.undertow.server.session.SessionListeners)1 Deployment (io.undertow.servlet.api.Deployment)1 Duration (java.time.Duration)1 Instant (java.time.Instant)1 UUID (java.util.UUID)1 HttpSession (javax.servlet.http.HttpSession)1 HttpSessionBindingEvent (javax.servlet.http.HttpSessionBindingEvent)1 HttpSessionBindingListener (javax.servlet.http.HttpSessionBindingListener)1 CacheEntryRemoved (org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved)1 ImmutableHttpSessionAdapter (org.wildfly.clustering.web.session.ImmutableHttpSessionAdapter)1