use of com.linkedin.restli.internal.server.RestLiRouter in project rest.li by linkedin.
the class TestRestLiRouting method testRoutingCollection.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "routingCollection")
public void testRoutingCollection(String uri, ProtocolVersion version, String httpMethod, String restliMethod, ResourceMethod method, String methodName, String[] pathKeys) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(StatusCollectionResource.class);
_router = new RestLiRouter(pathRootResourceMap, new RestLiConfig());
checkResult(uri, version, httpMethod, restliMethod, method, StatusCollectionResource.class, methodName, false, pathKeys);
}
use of com.linkedin.restli.internal.server.RestLiRouter in project rest.li by linkedin.
the class TestRestLiRouting method testRoutingDetailsSimpleDelete.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "routingDetailsSimple")
public void testRoutingDetailsSimpleDelete(ProtocolVersion version, String uri) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(TrendingResource.class);
_router = new RestLiRouter(pathRootResourceMap, new RestLiConfig());
RestRequest request = createRequest(uri, "DELETE", version);
ServerResourceContext context = new ResourceContextImpl(new PathKeysImpl(), request, new RequestContext());
ResourceMethodDescriptor resourceMethodDescriptor = _router.process(context);
assertNotNull(resourceMethodDescriptor);
assertEquals(resourceMethodDescriptor.getType(), ResourceMethod.DELETE);
assertNull(resourceMethodDescriptor.getActionName());
assertNull(resourceMethodDescriptor.getFinderName());
assertEquals(resourceMethodDescriptor.getMethod().getDeclaringClass(), TrendingResource.class);
assertEquals(resourceMethodDescriptor.getMethod().getName(), "delete");
assertEquals(resourceMethodDescriptor.getMethod().getParameterTypes(), new Class<?>[] {});
assertEquals(resourceMethodDescriptor.getResourceModel().getName(), "trending");
PathKeys keys = context.getPathKeys();
assertNull(keys.getBatchIds());
}
use of com.linkedin.restli.internal.server.RestLiRouter in project rest.li by linkedin.
the class TestRestLiRouting method testActionNestedRouting.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "actionNestedRouting")
public void testActionNestedRouting(ProtocolVersion version, String uri) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(StatusCollectionResource.class, RepliesCollectionResource.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(), "replyToAll");
assertEquals(method.getType(), ResourceMethod.ACTION);
assertEquals(context.getPathKeys().get("statusID"), Long.valueOf(1));
}
use of com.linkedin.restli.internal.server.RestLiRouter in project rest.li by linkedin.
the class TestRestLiRouting method testRoutingAssociationBatch.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "routingAssociationResourceBatch")
public void testRoutingAssociationBatch(String uri, ProtocolVersion version, String httpMethod, String restliMethod, ResourceMethod method, String methodName, Set<CompoundKey> compoundKeys) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(FollowsAssociativeResource.class);
_router = new RestLiRouter(pathRootResourceMap, new RestLiConfig());
checkResult(uri, version, httpMethod, restliMethod, method, FollowsAssociativeResource.class, methodName, true);
checkBatchKeys(uri, version, httpMethod, compoundKeys);
}
use of com.linkedin.restli.internal.server.RestLiRouter in project rest.li by linkedin.
the class TestRestLiRouting method testRoutingSubResourceCollectionBatch.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "routingSubResourceCollectionBatch")
public void testRoutingSubResourceCollectionBatch(String uri, ProtocolVersion version, String httpMethod, String restliMethod, ResourceMethod method, String methodName, Set<Long> keys) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(StatusCollectionResource.class, RepliesCollectionResource.class);
_router = new RestLiRouter(pathRootResourceMap, new RestLiConfig());
checkResult(uri, version, httpMethod, restliMethod, method, RepliesCollectionResource.class, methodName, true);
checkBatchKeys(uri, version, httpMethod, keys);
}
Aggregations