use of org.forgerock.http.protocol.Request in project OpenAM by OpenRock.
the class RestRouterIT method shouldReadChfEndpointOnRealmHandlerWithRootRealm.
@Test
public void shouldReadChfEndpointOnRealmHandlerWithRootRealm() throws Exception {
//Given
Context context = mockRequiredContexts();
Request request = newRequest("GET", "/json/authenticate");
//When
handler.handle(context, request);
//Then
verify(authenticateResource).get();
}
use of org.forgerock.http.protocol.Request in project OpenAM by OpenRock.
the class RestRouterIT method newRequest.
private Request newRequest(String method, String uri) throws URISyntaxException {
Request request = new Request().setMethod(method).setUri(URI.create(uri));
request.getUri().setHost("HOSTNAME");
return request;
}
use of org.forgerock.http.protocol.Request in project OpenAM by OpenRock.
the class RestRouterIT method shouldNotBePossibleToReachInternalResourceViaChf.
@Test
public void shouldNotBePossibleToReachInternalResourceViaChf() throws Exception {
// Given
Context context = mockContext();
Request request = newRequest("GET", "/json/internal");
// When
Promise<Response, NeverThrowsException> promise = handler.handle(context, request);
// Then
Response response = promise.get();
assertThat(response.getStatus()).isEqualTo(Status.NOT_FOUND);
verifyZeroInteractions(internalResource);
}
use of org.forgerock.http.protocol.Request in project OpenAM by OpenRock.
the class HttpRouterProviderTest method shouldAddRoutesToRouter.
@Test(dataProvider = "routeRequestsData")
public void shouldAddRoutesToRouter(String requestUri, Handler exceptedHandler) {
//Given
Context context = new RootContext();
Request request = new Request().setUri(URI.create(requestUri));
Router router = httpRouterProvider.get();
//When
router.handle(context, request);
//Then
verify(exceptedHandler).handle(any(Context.class), eq(request));
}
use of org.forgerock.http.protocol.Request in project OpenAM by OpenRock.
the class AbstractHttpAccessAuditFilterTest method shouldGetUserIdForAccessAttemptIfNotSet.
@Test
public void shouldGetUserIdForAccessAttemptIfNotSet() {
//Given
Request request = new Request();
AuditRequestContext.putProperty(USER_ID, null);
//When
String userId = auditFilter.getUserIdForAccessAttempt(request);
//Then
assertThat(userId).isEmpty();
}
Aggregations