use of com.linkedin.restli.internal.server.RestLiRouter in project rest.li by linkedin.
the class TestRestLiRouting method testRoutingErrors.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "routingErrors")
public void testRoutingErrors(String uri, ProtocolVersion version, String httpMethod, HttpStatus status) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(CombinedResources.CombinedNKeyAssociationResource.class, DiscoveredItemsResource.class, FollowsAssociativeResource.class, LocationResource.class, RepliesCollectionResource.class, StatusCollectionResource.class, CustomStatusCollectionResource.class, TrendRegionsCollectionResource.class, TrendingResource.class, TwitterAccountsResource.class);
_router = new RestLiRouter(pathRootResourceMap, new RestLiConfig());
expectRoutingExceptionWithStatus(uri, version, httpMethod, null, status);
}
use of com.linkedin.restli.internal.server.RestLiRouter in project rest.li by linkedin.
the class TestRestLiRouting method testActionRootRouting.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "actionRootRouting")
public void testActionRootRouting(ProtocolVersion version, String uri, String actionName) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(TwitterAccountsResource.class);
_router = new RestLiRouter(pathRootResourceMap, new RestLiConfig());
RestRequest request = createRequest(uri, "POST", version);
ServerResourceContext context = new ResourceContextImpl(new PathKeysImpl(), request, new RequestContext());
ResourceMethodDescriptor method = _router.process(context);
assertNotNull(method);
assertEquals(method.getActionName(), actionName);
assertEquals(method.getType(), ResourceMethod.ACTION);
}
Aggregations