use of org.wso2.carbon.identity.application.authentication.framework.session.extender.response.SessionExtenderResponse in project carbon-identity-framework by wso2.
the class SessionExtenderResponseFactoryTest method testCreate.
@Test
public void testCreate() {
SessionExtenderResponse sessionExtenderResponse = mock(SessionExtenderResponse.class);
when(sessionExtenderResponse.getTraceId()).thenReturn(TRACE_ID);
HttpIdentityResponse.HttpIdentityResponseBuilder responseBuilder = sessionExtenderResponseFactory.create(sessionExtenderResponse);
HttpIdentityResponse response = responseBuilder.build();
assertNull(response.getBody());
assertNotNull(response.getHeaders().get("Trace-ID"));
}
use of org.wso2.carbon.identity.application.authentication.framework.session.extender.response.SessionExtenderResponse in project carbon-identity-framework by wso2.
the class SessionExtenderProcessorTest method testProcessWithSessionKey.
@Test(expectedExceptions = NullPointerException.class)
public void testProcessWithSessionKey() throws Exception {
mockStatic(SessionContextCache.class);
SessionExtenderRequest sessionExtenderRequest = mock(SessionExtenderRequest.class);
SessionContextCache sessionContextCache = mock(SessionContextCache.class);
SessionContextCacheKey sessionContextCacheKey = mock(SessionContextCacheKey.class);
SessionContextCacheEntry sessionContextCacheEntry = mock(SessionContextCacheEntry.class);
SessionContext sessionContext = mock(SessionContext.class);
whenNew(SessionContextCacheKey.class).withArguments(anyString()).thenReturn(sessionContextCacheKey);
when(sessionExtenderRequest.getTenantDomain()).thenReturn(TENANT_DOMAIN);
when(sessionExtenderRequest.getSessionKey()).thenReturn(IDP_SESSION_KEY);
when(SessionContextCache.getInstance()).thenReturn(sessionContextCache);
when(sessionContextCache.getSessionContextCacheEntry(anyObject(), anyString())).thenReturn(sessionContextCacheEntry);
when(sessionContextCacheEntry.getContext()).thenReturn(sessionContext);
SessionExtenderResponse.SessionExtenderResponseBuilder responseBuilder = (SessionExtenderResponse.SessionExtenderResponseBuilder) sessionExtenderProcessor.process(sessionExtenderRequest);
SessionExtenderResponse response = responseBuilder.build();
assertNotNull(response.getTraceId(), "Error creating successful response.");
}
Aggregations