Package com.linkedin.restli.internal.server

Examples of com.linkedin.restli.internal.server.AugmentedRestLiResponseData$Builder


                                      String response2,
                                      ProtocolVersion protocolVersion,
                                      String errorResponseHeaderName) throws Exception
  {
    final RestRequest request = buildRequest(acceptTypeData.acceptHeaders, protocolVersion);
    AugmentedRestLiResponseData responseData;
    RoutingResult routingResult1 = buildRoutingResultAction(Status.class, request, acceptTypeData.acceptHeaders);
    // #1 simple record template
    responseData = _responseHandler.buildRestLiResponseData(request, routingResult1, buildStatusRecord());
    checkResponseData(responseData, HttpStatus.S_200_OK, 1, false, true, errorResponseHeaderName);
    assertEquals(responseData.getEntityResponse().toString(), response1);
    // #2 DataTemplate response
    StringMap map = new StringMap();
    map.put("key1", "value1");
    map.put("key2", "value2");
    RoutingResult routingResult2 = buildRoutingResultAction(StringMap.class, request, acceptTypeData.acceptHeaders);
    responseData = _responseHandler.buildRestLiResponseData(request, routingResult2, map);
    checkResponseData(responseData, HttpStatus.S_200_OK, 1, false, true, errorResponseHeaderName);
    String actual = responseData.getEntityResponse().toString();
    assertEquals(actual, response2);
    RoutingResult routingResult3 = buildRoutingResultAction(Void.TYPE, request, acceptTypeData.acceptHeaders);
    // #3 empty response
    responseData =
    _responseHandler.buildRestLiResponseData(request, routingResult3, null);
    checkResponseData(responseData, HttpStatus.S_200_OK, 1, false, false, errorResponseHeaderName);
    assertEquals(responseData.getEntityResponse(), null);
  }
View Full Code Here


    RoutingResult routingResult = new RoutingResult(mockContext, mockDescriptor);

    Map<String, String> headers = getHeaders();

    BatchGetResponseBuilder responseBuilder = new BatchGetResponseBuilder(new ErrorResponseBuilder());
    AugmentedRestLiResponseData responseData = responseBuilder.buildRestLiResponseData(null,
                                                                                       routingResult,
                                                                                       results,
                                                                                       headers);
    PartialRestResponse restResponse = responseBuilder.buildResponse(routingResult, responseData);
View Full Code Here

    ResourceMethodDescriptor mockDescriptor = getMockResourceMethodDescriptor();
    RoutingResult routingResult = new RoutingResult(null, mockDescriptor);

    BatchCreateResponseBuilder responseBuilder = new BatchCreateResponseBuilder(null);
    AugmentedRestLiResponseData responseData = responseBuilder.buildRestLiResponseData(null,
                                                                                       routingResult,
                                                                                       results,
                                                                                       headers);
    PartialRestResponse restResponse = responseBuilder.buildResponse(routingResult, responseData);

    EasyMock.verify(mockDescriptor);
    Assert.assertEquals(restResponse.getHeaders(), headers);
    Assert.assertEquals(restResponse.getEntity(),
                        new BatchCreateIdResponse<Long>((List<com.linkedin.restli.common.CreateIdStatus<Long>>) responseData.getCollectionResponse()));
    Assert.assertEquals(restResponse.getStatus(), HttpStatus.S_200_OK);
  }
View Full Code Here

    RuntimeException runtimeException = new RuntimeException("Internal server error!");
    RestLiServiceException serviceException = new RestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR,
                                                                         runtimeException);

    ErrorResponseBuilder errorResponseBuilder = new ErrorResponseBuilder();
    AugmentedRestLiResponseData responseData = errorResponseBuilder.buildRestLiResponseData(null,
                                                                                            routingResult,
                                                                                            serviceException,
                                                                                            headers);
    PartialRestResponse restResponse = errorResponseBuilder.buildResponse(routingResult, responseData);
View Full Code Here

    ResourceMethodDescriptor mockDescriptor = getMockResourceMethodDescriptor();
    ResourceContext mockContext = getMockResourceContext(protocolVersion);
    RoutingResult routingResult = new RoutingResult(mockContext, mockDescriptor);

    CreateResponseBuilder createResponseBuilder = new CreateResponseBuilder();
    AugmentedRestLiResponseData responseData = createResponseBuilder.buildRestLiResponseData(restRequest,
                                                                                             routingResult,
                                                                                             createResponse,
                                                                                             headers);
    PartialRestResponse partialRestResponse = createResponseBuilder.buildResponse(routingResult, responseData);
View Full Code Here

    ResourceContext mockContext = getMockResourceContext();
    ResourceMethodDescriptor mockDescriptor = getMockResourceMethodDescriptor();
    RoutingResult routingResult = new RoutingResult(mockContext, mockDescriptor);

    CollectionResponseBuilder responseBuilder = new CollectionResponseBuilder();
    AugmentedRestLiResponseData responseData = responseBuilder.buildRestLiResponseData(getRestRequest(),
                                                                                       routingResult,
                                                                                       results,
                                                                                       headers);
    PartialRestResponse restResponse = responseBuilder.buildResponse(routingResult, responseData);
View Full Code Here

    RoutingResult routingResult = new RoutingResult(mockContext, mockDescriptor);

    Map<String, String> headers = getHeaders();

    BatchUpdateResponseBuilder batchUpdateResponseBuilder = new BatchUpdateResponseBuilder(new ErrorResponseBuilder());
    AugmentedRestLiResponseData responseData = batchUpdateResponseBuilder.buildRestLiResponseData(null,
                                                                                                  routingResult,
                                                                                                  results,
                                                                                                  headers);
    PartialRestResponse restResponse = batchUpdateResponseBuilder.buildResponse(routingResult, responseData);
View Full Code Here

    Map<String, String> headers = getHeaders();
    ResourceMethodDescriptor mockDescriptor = getMockResourceMethodDescriptor();
    RoutingResult routingResult = new RoutingResult(null, mockDescriptor);

    ActionResponseBuilder actionResponseBuilder = new ActionResponseBuilder();
    AugmentedRestLiResponseData responseData = actionResponseBuilder.buildRestLiResponseData(null,
                                                                                             routingResult,
                                                                                             result,
                                                                                             headers);
    PartialRestResponse restResponse = actionResponseBuilder.buildResponse(routingResult, responseData);
View Full Code Here

    ResourceMethodDescriptor mockDescriptor = getMockResourceMethodDescriptor();
    RoutingResult routingResult = new RoutingResult(null, mockDescriptor);

    UpdateResponseBuilder updateResponseBuilder = new UpdateResponseBuilder();
    AugmentedRestLiResponseData responseData = updateResponseBuilder.buildRestLiResponseData(null,
                                                                                             routingResult,
                                                                                             updateResponse,
                                                                                             headers);
    PartialRestResponse partialRestResponse = updateResponseBuilder.buildResponse(routingResult, responseData);
View Full Code Here

    RoutingResult routingResult = new RoutingResult(mockContext, mockDescriptor);

    GetResponseBuilder getResponseBuilder = new GetResponseBuilder();

    AugmentedRestLiResponseData responseData = getResponseBuilder.buildRestLiResponseData(null,
                                                                                          routingResult,
                                                                                          record,
                                                                                          headers);

    PartialRestResponse partialRestResponse = getResponseBuilder.buildResponse(null, responseData);
View Full Code Here

TOP

Related Classes of com.linkedin.restli.internal.server.AugmentedRestLiResponseData$Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.