Search in sources :

Example 1 with SimpleManager

use of org.wildfly.clustering.ee.cache.SimpleManager in project wildfly by wildfly.

the class ConcurrentSessionManagerTestCase method getStopTimeout.

@Test
public void getStopTimeout() {
    SessionManager<Void, Batch> manager = mock(SessionManager.class);
    SessionManager<Void, Batch> subject = new ConcurrentSessionManager<>(manager, SimpleManager::new);
    Duration expected = Duration.ofMinutes(1);
    when(manager.getStopTimeout()).thenReturn(expected);
    Duration result = subject.getStopTimeout();
    assertSame(expected, result);
}
Also used : Batch(org.wildfly.clustering.ee.Batch) Duration(java.time.Duration) SimpleManager(org.wildfly.clustering.ee.cache.SimpleManager) Test(org.junit.Test)

Example 2 with SimpleManager

use of org.wildfly.clustering.ee.cache.SimpleManager in project wildfly by wildfly.

the class ConcurrentSessionManagerTestCase method setDefaultMaxInactiveInterval.

@Test
public void setDefaultMaxInactiveInterval() {
    SessionManager<Void, Batch> manager = mock(SessionManager.class);
    SessionManager<Void, Batch> subject = new ConcurrentSessionManager<>(manager, SimpleManager::new);
    Duration value = Duration.ofMinutes(60);
    subject.setDefaultMaxInactiveInterval(value);
    verify(manager).setDefaultMaxInactiveInterval(value);
}
Also used : Batch(org.wildfly.clustering.ee.Batch) Duration(java.time.Duration) SimpleManager(org.wildfly.clustering.ee.cache.SimpleManager) Test(org.junit.Test)

Example 3 with SimpleManager

use of org.wildfly.clustering.ee.cache.SimpleManager in project wildfly by wildfly.

the class ConcurrentSessionManagerTestCase method readSession.

@Test
public void readSession() {
    SessionManager<Void, Batch> manager = mock(SessionManager.class);
    SessionManager<Void, Batch> subject = new ConcurrentSessionManager<>(manager, SimpleManager::new);
    ImmutableSession expected = mock(ImmutableSession.class);
    String id = "foo";
    when(manager.readSession(id)).thenReturn(expected);
    ImmutableSession result = subject.readSession(id);
    assertSame(expected, result);
}
Also used : ImmutableSession(org.wildfly.clustering.web.session.ImmutableSession) Batch(org.wildfly.clustering.ee.Batch) SimpleManager(org.wildfly.clustering.ee.cache.SimpleManager) Test(org.junit.Test)

Example 4 with SimpleManager

use of org.wildfly.clustering.ee.cache.SimpleManager in project wildfly by wildfly.

the class ConcurrentSessionManagerTestCase method getDefaultMaxInactiveInterval.

@Test
public void getDefaultMaxInactiveInterval() {
    SessionManager<Void, Batch> manager = mock(SessionManager.class);
    SessionManager<Void, Batch> subject = new ConcurrentSessionManager<>(manager, SimpleManager::new);
    Duration expected = Duration.ofMinutes(60);
    when(manager.getDefaultMaxInactiveInterval()).thenReturn(expected);
    Duration result = subject.getDefaultMaxInactiveInterval();
    assertSame(expected, result);
}
Also used : Batch(org.wildfly.clustering.ee.Batch) Duration(java.time.Duration) SimpleManager(org.wildfly.clustering.ee.cache.SimpleManager) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 Batch (org.wildfly.clustering.ee.Batch)4 SimpleManager (org.wildfly.clustering.ee.cache.SimpleManager)4 Duration (java.time.Duration)3 ImmutableSession (org.wildfly.clustering.web.session.ImmutableSession)1