InternalSessionTest.java revision 42c10b520a70c6b2c67ad812cfda98ac1663f0c5
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2016 ForgeRock AS.
*/
public class InternalSessionTest {
public void setUp() {
MockitoAnnotations.initMocks(this);
}
public void tearDown() {
}
// Session events
@Test
public void firesInternalSessionEventWhenAttemptToSetProtectedPropertyIsBlocked() throws Exception {
// Given
doThrow(SessionException.class)
// When
try {
} catch (SessionException se) {
// expected
}
// Then
}
@Test
public void firesInternalSessionEventWhenProtectedPropertyIsSet() throws Exception {
// Given
doNothing().when(mockSessionUtils).checkPermissionToSetProperty(eq(clientToken), eq("key"), eq("value"));
// When
// Then
}
@Test
public void firesInternalSessionEventWhenActivatingNonAdminUserSessionAndMaxSessionLimitReached() throws Exception {
// Given
// When
// Then
}
@Test
public void firesInternalSessionEventWhenActivatingSessionAndUserSessionQuotaExhausted() throws Exception {
// Given
// When
// Then
}
@Test
public void firesInternalSessionEventWhenActivatingSession() throws Exception {
// Given
// When
// Then
}
@Test
public void firesInternalSessionEventWhenTimingOutSession() throws Exception {
// Given
// When
// Then
}
// Timeout calculations
@Test
public void shouldSetDefaultTimeoutsWhenConstructed() {
// Given
// When
// Then
}
@Test
public void shouldAllowTimeoutsToBeConfigured() {
// Given
// When
// Then
}
@Test
public void shouldAdjustTimeRemainingBasedOnCurrentTime() {
// Given
// When
// Then
}
@Test
public void shouldAdjustTimeRemainingWhenLatestAccessTimeIsUpdated() {
// Given
// When
// Then
}
@Test
public void expirationTimeShouldNotExceedMaxSessionTime() {
// Given
// When
// Then
long expectedExpirationTimeInSeconds = MILLISECONDS.toSeconds(FrozenTimeService.INSTANCE.plus(4, MINUTES));
}
@Test
public void calculatesMaxSessionExpirationTime() {
// Given a session created at "10 minutes" with a max session time of 30 minutes...
// Then max session expiration time should occur at "40 minutes"
}
@Test
public void calculatesMaxIdleExpirationTime() {
// Given a session created at "10 minutes" with a max idle time of 5 minutes...
// When current time is "16 minutes", and the session has not been idle for any time...
// Then idle expiration time should occur at "21 minutes"
}
ArgumentCaptor<InternalSessionEvent> eventCaptor = ArgumentCaptor.forClass(InternalSessionEvent.class);
}
private InternalSession createSession() {
return new InternalSession(
}
}