Search in sources :

Example 21 with Response

use of org.forgerock.http.protocol.Response in project OpenAM by OpenRock.

the class AbstractHttpAccessAuditFilterTest method mockHandler.

private Handler mockHandler(Context context, Request request, Status status) {
    Handler handler = mock(Handler.class);
    Promise<Response, NeverThrowsException> promise = newResultPromise(new Response(status));
    given(handler.handle(context, request)).willReturn(promise);
    return handler;
}
Also used : Response(org.forgerock.http.protocol.Response) NeverThrowsException(org.forgerock.util.promise.NeverThrowsException) Handler(org.forgerock.http.Handler)

Example 22 with Response

use of org.forgerock.http.protocol.Response in project OpenAM by OpenRock.

the class AbstractHttpAccessAuditFilterTest method shouldGetUserIdForAccessOutcomeIfNotSet.

@Test
public void shouldGetUserIdForAccessOutcomeIfNotSet() {
    //Given
    Response response = new Response();
    AuditRequestContext.putProperty(USER_ID, null);
    //When
    String userId = auditFilter.getUserIdForAccessOutcome(response);
    //Then
    assertThat(userId).isEmpty();
}
Also used : Response(org.forgerock.http.protocol.Response) Test(org.testng.annotations.Test)

Aggregations

Response (org.forgerock.http.protocol.Response)22 Request (org.forgerock.http.protocol.Request)15 Test (org.testng.annotations.Test)14 Context (org.forgerock.services.context.Context)8 JsonValue (org.forgerock.json.JsonValue)6 AttributesContext (org.forgerock.services.context.AttributesContext)6 RootContext (org.forgerock.services.context.RootContext)6 Handler (org.forgerock.http.Handler)4 ReadRequest (org.forgerock.json.resource.ReadRequest)4 ResourceResponse (org.forgerock.json.resource.ResourceResponse)4 RestAuthException (org.forgerock.openam.core.rest.authn.exceptions.RestAuthException)4 RestAuthResponseException (org.forgerock.openam.core.rest.authn.exceptions.RestAuthResponseException)4 NeverThrowsException (org.forgerock.util.promise.NeverThrowsException)4 Map (java.util.Map)3 UriRouterContext (org.forgerock.http.routing.UriRouterContext)3 SessionContext (org.forgerock.http.session.SessionContext)3 ActionRequest (org.forgerock.json.resource.ActionRequest)3 ActionResponse (org.forgerock.json.resource.ActionResponse)3 CreateRequest (org.forgerock.json.resource.CreateRequest)3 DeleteRequest (org.forgerock.json.resource.DeleteRequest)3