use of org.forgerock.http.routing.Router in project OpenAM by OpenRock.
the class HttpRouterProvider method get.
@Override
public Router get() {
Router router = new Router();
for (HttpRouteProvider routeProvider : routeProviders) {
injector.injectMembers(routeProvider);
Set<HttpRoute> routes = routeProvider.get();
for (HttpRoute route : routes) {
router.addRoute(requestUriMatcher(route.getMode(), route.getUriTemplate()), route.getHandler());
}
}
return router;
}
use of org.forgerock.http.routing.Router 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));
}
Aggregations