use of com.iplanet.dpro.session.share.SessionInfo in project OpenAM by OpenRock.
the class SessionInfoFactoryTest method shouldGenerateSessionInfoFromInternalSession.
@Test
public void shouldGenerateSessionInfoFromInternalSession() throws SessionException {
// Given
given(mockSession.getID()).willReturn(mockSessionID);
given(mockSession.getRestrictionForToken(any(SessionID.class))).willReturn(mock(TokenRestriction.class));
given(mockSession.getState()).willReturn(VALID);
given(mockSession.getTimeLeftBeforePurge()).willReturn(0l);
SessionInfo mockSessionInfo = mock(SessionInfo.class);
given(mockSession.toSessionInfo()).willReturn(mockSessionInfo);
Hashtable mockHashTable = mock(Hashtable.class);
given(mockSessionInfo.getProperties()).willReturn(mockHashTable);
given(mockSession.getRestrictionForToken(any(SessionID.class))).willReturn(new MockTokenRestriction());
// When
SessionInfo result = factory.getSessionInfo(mockSession, mockSessionID);
// Then
assertThat(result).isNotNull();
}
use of com.iplanet.dpro.session.share.SessionInfo in project OpenAM by OpenRock.
the class RemoteOperationsTest method shouldUseSessionIDInRefreshRequest.
@Test
public void shouldUseSessionIDInRefreshRequest() throws SessionException {
// Given
SessionInfo mockSessionInfo = mock(SessionInfo.class);
given(mockResponse.getSessionInfo()).willReturn(Arrays.asList(mockSessionInfo));
// When
SessionInfo result = remoteOperations.refresh(mockSession, true);
// Then
assertThat(result).isEqualTo(mockSessionInfo);
}
use of com.iplanet.dpro.session.share.SessionInfo in project OpenAM by OpenRock.
the class SessionNotificationHandler method processNotification.
/**
* Process the notification.
*
* @param snot Session Notification object.
*/
private void processNotification(SessionNotification snot, boolean isLocal) {
SessionInfo info = snot.getSessionInfo();
sessionDebug.message("SESSION NOTIFICATION : " + info.toXMLString());
if (!info.getState().equals("valid")) {
if (isLocal) {
sessionCache.removeLocalSID(info);
} else {
sessionCache.removeRemoteSID(info);
}
return;
}
SessionID sid = new SessionID(info.getSessionID());
Session session = sessionCache.readSession(sid);
try {
if (session == null) {
// a new session is created
return;
}
session.update(info);
} catch (Exception e) {
sessionDebug.error("SessionNotificationHandler:processNotification : ", e);
sessionCache.removeSID(sid);
return;
}
SessionEvent evt = new SessionEvent(session, snot.getNotificationType(), snot.getNotificationTime());
SessionEvent.invokeListeners(evt);
}
use of com.iplanet.dpro.session.share.SessionInfo in project OpenAM by OpenRock.
the class MonitoredOperations method refresh.
/**
* {@inheritDoc}
*/
@Override
public SessionInfo refresh(Session session, boolean reset) throws SessionException {
final long start = System.nanoTime();
final SessionInfo response = sessionOperations.refresh(session, reset);
sessionMonitoringStore.storeRefreshTime(System.nanoTime() - start, monitorType);
return response;
}
use of com.iplanet.dpro.session.share.SessionInfo in project OpenAM by OpenRock.
the class InternalSession method removeSession.
/**
* Signals the Session for removal.
*/
private void removeSession() {
SessionInfo sessionInfo = toSessionInfo();
sessionLogging.logEvent(sessionInfo, SessionEvent.DESTROY);
sessionAuditor.auditActivity(sessionInfo, AM_SESSION_DESTROYED);
setState(DESTROYED);
sessionService.removeInternalSession(sessionID);
sessionService.sendEvent(this, SessionEvent.DESTROY);
}
Aggregations