use of org.forgerock.json.resource.RequestHandler in project OpenAM by OpenRock.
the class RealmContextFilterTest method filterShouldConsumeRealmFromCRUDPAQRequest.
@Test(dataProvider = "CRUDPAQ")
public void filterShouldConsumeRealmFromCRUDPAQRequest(Request request, String postURIString) throws Exception {
//Given
RequestHandler requestHandler = mock(RequestHandler.class);
String path = ENDPOINT_PATH_ELEMENT;
Context context = mockContext(path);
request.setUri(createRequestURI(HOSTNAME, path, postURIString));
mockDnsAlias(HOSTNAME, "/");
//When
Handler httpHandler = getHttpHandler(requestHandler);
httpHandler.handle(context, request).getOrThrowUninterruptibly();
//Then
ArgumentCaptor<Context> contextCaptor = ArgumentCaptor.forClass(Context.class);
ArgumentCaptor<org.forgerock.json.resource.Request> requestCaptor = ArgumentCaptor.forClass(org.forgerock.json.resource.Request.class);
collectCRUDPAQArguments(requestHandler, contextCaptor, requestCaptor);
verifyRealmContext(contextCaptor.getValue(), "", "/", null);
verifyUriRouterContext(contextCaptor.getValue(), "");
verifyResolvedResourcePath(requestCaptor.getValue(), ENDPOINT_PATH_ELEMENT);
}
Aggregations