Add Default Expiration Option to MapSessionRepository

Fixes gh-73
This commit is contained in:
Rob Winch
2014-12-11 21:00:03 -06:00
parent 646682b056
commit 977d1f474b
3 changed files with 37 additions and 3 deletions

View File

@@ -42,4 +42,21 @@ public class MapSessionRepositoryTests {
assertThat(repository.getSession(session.getId())).isNull();
}
}
@Test
public void createSessionDefaultExpiration() {
ExpiringSession session = repository.createSession();
assertThat(session).isInstanceOf(MapSession.class);
assertThat(session.getMaxInactiveInterval()).isEqualTo(new MapSession().getMaxInactiveInterval());
}
@Test
public void createSessionCustomDefaultExpiration() {
final int expectedMaxInterval = new MapSession().getMaxInactiveInterval() + 10;
repository.setDefaultMaxInactiveInterval(expectedMaxInterval);
ExpiringSession session = repository.createSession();
assertThat(session.getMaxInactiveInterval()).isEqualTo(expectedMaxInterval);
}
}