use of com.iplanet.dpro.session.SessionID in project OpenAM by OpenRock.
the class ServerSessionOperationStrategyTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
// Required dependencies
mockSessionService = mock(SessionService.class);
mockNamingQuery = mock(WebtopNamingQuery.class);
// Strategies
mockLocal = mock(LocalOperations.class);
mockRemote = mock(RemoteOperations.class);
mockStateless = mock(StatelessOperations.class);
mockCTS = mock(CTSOperations.class);
mockStore = mock(SessionMonitoringStore.class);
strategy = new ServerSessionOperationStrategy(mockSessionService, mockStore, mockLocal, mockCTS, mockRemote, mockStateless, mockNamingQuery, mock(StatelessSessionFactory.class), mock(Debug.class));
// test instances
mockSession = mock(Session.class);
SessionID mockSessionId = mock(SessionID.class);
given(mockSession.getID()).willReturn(mockSessionId);
given(mockSessionId.getSessionServerID()).willReturn("TEST");
}
use of com.iplanet.dpro.session.SessionID in project OpenAM by OpenRock.
the class InternalSessionCacheTest method shouldRemovePreviousRestrictedSession.
@Test
public void shouldRemovePreviousRestrictedSession() {
// Given
SessionID oldRestriction = mock(SessionID.class);
given(session.getRestrictedTokens()).willReturn(new HashSet<SessionID>(Arrays.asList(oldRestriction)));
cache.put(session);
SessionID newRestriction = mock(SessionID.class);
given(session.getRestrictedTokens()).willReturn(new HashSet<SessionID>(Arrays.asList(newRestriction)));
// When
cache.put(session);
// Then
assertThat(cache.getByRestrictedID(oldRestriction)).isNull();
assertThat(cache.getByRestrictedID(newRestriction)).isEqualTo(session);
}
use of com.iplanet.dpro.session.SessionID in project OpenAM by OpenRock.
the class CTSOperationsTest method shouldDThrowExceptionWhenGivenLocalSession.
@Test(expectedExceptions = SessionException.class)
public void shouldDThrowExceptionWhenGivenLocalSession() throws SessionException {
// Given
SessionID mockSessionID = mock(SessionID.class);
given(mockSession.getID()).willReturn(mockSessionID);
given(mockSessionService.checkSessionLocal(mockSessionID)).willReturn(true);
// When
ctsOperations.logout(mockSession);
}
use of com.iplanet.dpro.session.SessionID in project OpenAM by OpenRock.
the class CTSOperationsTest method shouldNotDeleteLocalTokenDuringLogout.
@Test(expectedExceptions = SessionException.class)
public void shouldNotDeleteLocalTokenDuringLogout() throws SessionException, CoreTokenException {
// Given
SessionID mockSessionID = mock(SessionID.class);
given(mockSession.getID()).willReturn(mockSessionID);
given(mockSessionService.checkSessionLocal(mockSessionID)).willReturn(true);
// When
ctsOperations.logout(mockSession);
}
use of com.iplanet.dpro.session.SessionID in project OpenAM by OpenRock.
the class CTSOperationsTest method shouldDeleteRemoteTokenDuringLogout.
@Test
public void shouldDeleteRemoteTokenDuringLogout() throws SessionException, CoreTokenException {
// Given
SessionID mockSessionID = mock(SessionID.class);
given(mockSession.getID()).willReturn(mockSessionID);
given(mockSessionService.checkSessionLocal(mockSessionID)).willReturn(false);
// When
ctsOperations.logout(mockSession);
// Then
verify(mockRemote).logout(mockSession);
}
Aggregations