use of com.linkedin.restli.internal.server.model.ResourceModel in project rest.li by linkedin.
the class TestRestLiRouting method testRoutingCollectionBatch.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "routingCollectionBatch")
public void testRoutingCollectionBatch(String uri, ProtocolVersion version, String httpMethod, String restliMethod, ResourceMethod method, String methodName, Set<Long> keys) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(StatusCollectionResource.class);
_router = new RestLiRouter(pathRootResourceMap, new RestLiConfig());
checkResult(uri, version, httpMethod, restliMethod, method, StatusCollectionResource.class, methodName, true);
checkBatchKeys(uri, version, httpMethod, keys);
}
use of com.linkedin.restli.internal.server.model.ResourceModel in project rest.li by linkedin.
the class TestRestLiRouting method testRoutingAssociation.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "routingAssociation")
public void testRoutingAssociation(String uri, ProtocolVersion version, String httpMethod, ResourceMethod method, String methodName, String[] pathKeys) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(FollowsAssociativeResource.class);
_router = new RestLiRouter(pathRootResourceMap, new RestLiConfig());
checkResult(uri, version, httpMethod, method, FollowsAssociativeResource.class, methodName, false, pathKeys);
}
use of com.linkedin.restli.internal.server.model.ResourceModel in project rest.li by linkedin.
the class TestRestLiRouting method testRoutingDetailsCollectionUpdate.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "routingDetailsCollectionEntity")
public void testRoutingDetailsCollectionUpdate(ProtocolVersion version, String uri) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(StatusCollectionResource.class);
_router = new RestLiRouter(pathRootResourceMap, new RestLiConfig());
RestRequest request = createRequest(uri, "PUT", version);
ServerResourceContext context = new ResourceContextImpl(new PathKeysImpl(), request, new RequestContext());
ResourceMethodDescriptor resourceMethodDescriptor = _router.process(context);
assertNotNull(resourceMethodDescriptor);
assertEquals(resourceMethodDescriptor.getType(), ResourceMethod.UPDATE);
assertNull(resourceMethodDescriptor.getActionName());
assertNull(resourceMethodDescriptor.getFinderName());
assertEquals(resourceMethodDescriptor.getMethod().getDeclaringClass(), StatusCollectionResource.class);
assertEquals(resourceMethodDescriptor.getMethod().getName(), "update");
assertEquals(resourceMethodDescriptor.getMethod().getParameterTypes(), new Class<?>[] { Long.class, Status.class });
assertEquals(resourceMethodDescriptor.getResourceModel().getName(), "statuses");
PathKeys keys = context.getPathKeys();
assertEquals(keys.getAsLong("statusID"), Long.valueOf(1));
assertNull(keys.getAsString("foo"));
}
use of com.linkedin.restli.internal.server.model.ResourceModel in project rest.li by linkedin.
the class TestRestLiRouting method testRoutingDetailsCollectionGet.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "routingDetailsCollectionEntity")
public void testRoutingDetailsCollectionGet(ProtocolVersion version, String uri) throws Exception {
Map<String, ResourceModel> pathRootResourceMap = buildResourceModels(StatusCollectionResource.class);
_router = new RestLiRouter(pathRootResourceMap, new RestLiConfig());
// #1 simple GET
RestRequest request = createRequest(uri, "GET", version);
ServerResourceContext context = new ResourceContextImpl(new PathKeysImpl(), request, new RequestContext());
ResourceMethodDescriptor resourceMethodDescriptor = _router.process(context);
assertNotNull(resourceMethodDescriptor);
assertEquals(resourceMethodDescriptor.getType(), ResourceMethod.GET);
assertNull(resourceMethodDescriptor.getActionName());
assertNull(resourceMethodDescriptor.getFinderName());
assertEquals(resourceMethodDescriptor.getMethod().getDeclaringClass(), StatusCollectionResource.class);
assertEquals(resourceMethodDescriptor.getMethod().getName(), "get");
assertEquals(resourceMethodDescriptor.getMethod().getParameterTypes(), new Class<?>[] { Long.class });
assertEquals(resourceMethodDescriptor.getResourceModel().getName(), "statuses");
PathKeys keys = context.getPathKeys();
assertEquals(keys.getAsLong("statusID"), Long.valueOf(1));
assertNull(keys.getAsString("foo"));
}
use of com.linkedin.restli.internal.server.model.ResourceModel in project rest.li by linkedin.
the class TestRestLiRouting method testRoutingAltKeyCollection.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "routingAltCollection")
public void testRoutingAltKeyCollection(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);
}
Aggregations