use of com.iplanet.dpro.session.SessionID in project OpenAM by OpenRock.
the class SessionPLLSender method sendPLLRequest.
/**
* Returns a Session Response object based on the XML document received from
* remote Session Server. This is in response to a request that we send to
* the session server.
*
* @param svcurl The URL of the Session Service.
* @param sreq The Session Request XML document.
* @return a Vector of responses from the remote server
* @exception com.iplanet.dpro.session.SessionException if there was an error in sending the XML
* document or if the response has multiple components.
*/
public SessionResponse sendPLLRequest(URL svcurl, SessionRequest sreq) throws SessionException {
try {
String cookies = sessionCookies.getCookieName() + "=" + sreq.getSessionID();
if (!SystemProperties.isServerMode()) {
SessionID sessionID = new SessionID(sreq.getSessionID());
cookies = cookies + ";" + sessionCookies.getLBCookie(sessionID);
}
final Request req = new Request(sreq.toXMLString());
final RequestSet set = new RequestSet(SESSION_SERVICE);
set.addRequest(req);
final Vector responses = PLLClient.send(svcurl, cookies, set);
if (responses.size() != 1) {
throw new SessionException(SessionBundle.rbName, "unexpectedResponse", null);
}
final Response res = (Response) responses.elementAt(0);
return SessionResponse.parseXML(res.getContent());
} catch (Exception e) {
throw new SessionException(e);
}
}
use of com.iplanet.dpro.session.SessionID in project OpenAM by OpenRock.
the class CTSOperationsTest method shouldOnlyDeleteTokenRemotelyDuringDestroy.
@Test
public void shouldOnlyDeleteTokenRemotelyDuringDestroy() throws Exception {
// Given
SessionID mockSessionID = mock(SessionID.class);
given(mockSession.getID()).willReturn(mockSessionID);
given(mockSessionService.checkSessionLocal(mockSessionID)).willReturn(false);
// When
ctsOperations.destroy(mockRequester, mockSession);
// Then
verify(mockRemote).destroy(mockRequester, mockSession);
}
use of com.iplanet.dpro.session.SessionID in project OpenAM by OpenRock.
the class CTSOperationsTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
mockRequester = mock(Session.class);
mockSession = mock(Session.class);
mockCTS = mock(CTSPersistentStore.class);
mockAdapter = mock(SessionAdapter.class);
mockIdFactory = mock(TokenIdFactory.class);
mockInfoFactory = mock(SessionInfoFactory.class);
mockSessionService = mock(SessionService.class);
mockRemote = mock(RemoteOperations.class);
SessionID mockSessionID = mock(SessionID.class);
given(mockSession.getID()).willReturn(mockSessionID);
given(mockIdFactory.toSessionTokenId(any(SessionID.class))).willReturn("TEST");
ctsOperations = new CTSOperations(mockCTS, mockAdapter, mockIdFactory, mockInfoFactory, mockSessionService, mockRemote, mock(Debug.class));
}
use of com.iplanet.dpro.session.SessionID in project OpenAM by OpenRock.
the class CTSOperationsTest method shouldCallRemoteSetPropertyDuringSetProperty.
@Test
public void shouldCallRemoteSetPropertyDuringSetProperty() throws SessionException {
// Given
SessionID mockSessionID = mock(SessionID.class);
given(mockSession.getID()).willReturn(mockSessionID);
// When / Then Throw
ctsOperations.setProperty(mockSession, "a", "b");
verify(mockRemote).setProperty(mockSession, "a", "b");
}
use of com.iplanet.dpro.session.SessionID in project OpenAM by OpenRock.
the class DefaultSessionActivatorTest method shouldDestroyAuthSession.
@Test
public void shouldDestroyAuthSession() throws Exception {
// Given
final SessionID authSessionID = new SessionID();
given(mockAuthSession.getID()).willReturn(authSessionID);
given(mockAuthSession.getPropertyNames()).willReturn(Collections.enumeration(Collections.emptyList()));
// When
DefaultSessionActivator.INSTANCE.activateSession(mockState, mockSessionService, mockAuthSession, null, null);
// Then
verify(mockSessionService).destroyInternalSession(authSessionID);
}
Aggregations