use of com.linkedin.restli.internal.server.response.GetResponseEnvelope in project rest.li by linkedin.
the class TestRestLiValidationFilter method validateWithProjectionData.
@DataProvider(name = "validateWithProjectionData")
public Object[][] validateWithProjectionData() {
RestLiResponseData<GetResponseEnvelope> getResponseData = ResponseDataBuilderUtil.buildGetResponseData(HttpStatus.S_200_OK, makeTestRecord());
RestLiResponseData<CreateResponseEnvelope> createResponseData = ResponseDataBuilderUtil.buildCreateResponseData(HttpStatus.S_201_CREATED, new IdResponse<>(123L));
RestLiResponseData<ActionResponseEnvelope> actionResponseData = ResponseDataBuilderUtil.buildActionResponseData(HttpStatus.S_200_OK, new EmptyRecord());
return new Object[][] { // Resource model Response data Projection mask Expect error?
{ RestLiAnnotationReader.processResource(ActionsResource.class), actionResponseData, null, false }, { RestLiAnnotationReader.processResource(ActionsResource.class), actionResponseData, new MaskTree(), false }, { RestLiAnnotationReader.processResource(ActionsResource.class), actionResponseData, makeMask("ignoreMePlease"), false }, { RestLiAnnotationReader.processResource(CollectionResource.class), getResponseData, null, false }, { RestLiAnnotationReader.processResource(CollectionResource.class), getResponseData, new MaskTree(), false }, { RestLiAnnotationReader.processResource(CollectionResource.class), getResponseData, makeMask("nonexistentField"), true }, { RestLiAnnotationReader.processResource(CollectionResource.class), getResponseData, makeMask("intField"), false }, { RestLiAnnotationReader.processResource(CollectionResource.class), actionResponseData, null, false }, { RestLiAnnotationReader.processResource(CollectionResource.class), actionResponseData, new MaskTree(), false }, { RestLiAnnotationReader.processResource(CollectionResource.class), actionResponseData, makeMask("ignoreMePlease"), false }, { RestLiAnnotationReader.processResource(SimpleResource.class), getResponseData, null, false }, { RestLiAnnotationReader.processResource(SimpleResource.class), getResponseData, new MaskTree(), false }, { RestLiAnnotationReader.processResource(SimpleResource.class), getResponseData, makeMask("nonexistentField"), true }, { RestLiAnnotationReader.processResource(SimpleResource.class), getResponseData, makeMask("intField"), false }, { RestLiAnnotationReader.processResource(SimpleResource.class), createResponseData, null, false }, { RestLiAnnotationReader.processResource(SimpleResource.class), createResponseData, new MaskTree(), false }, { RestLiAnnotationReader.processResource(SimpleResource.class), createResponseData, makeMask("nonexistentField"), true }, { RestLiAnnotationReader.processResource(SimpleResource.class), createResponseData, makeMask("intField"), false }, { RestLiAnnotationReader.processResource(SimpleResource.class), actionResponseData, null, false }, { RestLiAnnotationReader.processResource(SimpleResource.class), actionResponseData, new MaskTree(), false }, { RestLiAnnotationReader.processResource(SimpleResource.class), actionResponseData, makeMask("ignoreMePlease"), false }, { RestLiAnnotationReader.processResource(AssociationResource.class), getResponseData, null, false }, { RestLiAnnotationReader.processResource(AssociationResource.class), getResponseData, new MaskTree(), false }, { RestLiAnnotationReader.processResource(AssociationResource.class), getResponseData, makeMask("nonexistentField"), true }, { RestLiAnnotationReader.processResource(AssociationResource.class), getResponseData, makeMask("intField"), false }, { RestLiAnnotationReader.processResource(AssociationResource.class), actionResponseData, null, false }, { RestLiAnnotationReader.processResource(AssociationResource.class), actionResponseData, new MaskTree(), false }, { RestLiAnnotationReader.processResource(AssociationResource.class), actionResponseData, makeMask("ignoreMePlease"), false } };
}
use of com.linkedin.restli.internal.server.response.GetResponseEnvelope in project rest.li by linkedin.
the class TestRestLiResponseHandler method testBuildRestLiUnstructuredDataResponse.
@Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "basicData")
@SuppressWarnings("unchecked")
public void testBuildRestLiUnstructuredDataResponse(AcceptTypeData acceptTypeData, ProtocolVersion protocolVersion, String errorResponseHeaderName) throws Exception {
final RestRequest request = buildRequest(Collections.EMPTY_MAP, protocolVersion);
RoutingResult routingResult = buildUnstructuredDataRoutingResult(request);
RestLiResponseData<GetResponseEnvelope> responseData = (RestLiResponseData<GetResponseEnvelope>) _responseHandler.buildRestLiResponseData(request, routingResult, null);
assertEquals(responseData.getResponseEnvelope().getStatus(), HttpStatus.S_200_OK);
assertEquals(responseData.getResponseEnvelope().getRecord(), new EmptyRecord());
RestLiResponse restResponse = buildPartialRestResponse(request, routingResult, null);
assertNotNull(restResponse);
}
Aggregations