use of org.forgerock.http.protocol.Request in project OpenAM by OpenRock.
the class RestRouterIT method shouldReadChfEndpointOnRootHandler.
@Test
public void shouldReadChfEndpointOnRootHandler() throws Exception {
//Given
Context context = mockContext();
Request request = newRequest("GET", "/json/dashboard");
//When
handler.handle(context, request);
//Then
verify(dashboardResource).get();
}
use of org.forgerock.http.protocol.Request in project OpenAM by OpenRock.
the class RestRouterIT method shouldReadCrestEndpointOnRealmHandlerWithSubRealm.
@Test
public void shouldReadCrestEndpointOnRealmHandlerWithSubRealm() throws Exception {
//Given
Context context = mockRequiredContexts();
Request request = newRequest("GET", "/json/subrealm/users/demo");
auditingOff();
mockRealm("/subrealm");
//When
handler.handle(context, request);
//Then
ArgumentCaptor<Context> contextCaptor = ArgumentCaptor.forClass(Context.class);
verify(usersResource).readInstance(contextCaptor.capture(), eq("demo"), any(ReadRequest.class));
assertThat(contextCaptor.getValue().asContext(RealmContext.class).getResolvedRealm()).isEqualTo("/subrealm");
}
use of org.forgerock.http.protocol.Request in project OpenAM by OpenRock.
the class RestRouterIT method shouldReadChfEndpointOnRealmHandlerWithSubRealm.
@Test
public void shouldReadChfEndpointOnRealmHandlerWithSubRealm() throws Exception {
//Given
Context context = mockContext();
Request request = newRequest("GET", "/json/subrealm/authenticate");
mockRealm("/subrealm");
//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 shouldReadCrestEndpointOnRootHandler.
@Test
public void shouldReadCrestEndpointOnRootHandler() throws Exception {
//Given
Context context = mockRequiredContexts();
Request request = newRequest("GET", "/json/config");
auditingOff();
//When
handler.handle(context, request);
//Then
verify(configResource).readInstance(any(Context.class), any(ReadRequest.class));
}
use of org.forgerock.http.protocol.Request in project OpenAM by OpenRock.
the class RestRouterIT method shouldReadCrestEndpointOnRealmHandlerWithRootRealm.
@Test
public void shouldReadCrestEndpointOnRealmHandlerWithRootRealm() throws Exception {
//Given
Context context = mockRequiredContexts();
Request request = newRequest("GET", "/json/users/demo");
auditingOff();
//When
handler.handle(context, request);
//Then
ArgumentCaptor<Context> contextCaptor = ArgumentCaptor.forClass(Context.class);
verify(usersResource).readInstance(contextCaptor.capture(), eq("demo"), any(ReadRequest.class));
assertThat(contextCaptor.getValue().asContext(RealmContext.class).getResolvedRealm()).isEqualTo("/");
}
Aggregations