Package com.linkedin.r2.sample.echo

Examples of com.linkedin.r2.sample.echo.EchoService


      headers.putAll(getHeaders());
    }
    headers.put(errorHeaderName, "true");
    headers.put(RestConstants.HEADER_RESTLI_PROTOCOL_VERSION, protocolVersion.toString());

    RestResponse restResponse = new RestResponseBuilder()
        .setEntity(entity)
        .setStatus(status)
        .setHeaders(Collections.unmodifiableMap(headers))
        .build();
View Full Code Here


        .setStatus(status)
        .setHeaders(getHeaders())
        .setProtocolVersion(getProtocolVersion())
        .build();

    RestResponse restResponse = new RestResponseBuilder()
        .setEntity(entity)
        .setStatus(status)
        .setHeaders(decodedResponse.getHeaders())
        .build();
View Full Code Here

                                    @Override
                                    public void handleRequest(RestRequest request,
                                                               RequestContext requestContext,
                                                               RequestExecutionCallback<RestResponse> callback)
                                    {
                                      RestResponse response = EasyMock.createMock(RestResponse.class);
                                      RequestExecutionReportBuilder executionReportBuilder =
                                         new RequestExecutionReportBuilder();
                                      JsonTraceCodec jsonTraceCodec = new JsonTraceCodec();
                                      Trace t = null;
View Full Code Here

  private void sendByteArrayAsResponse(Callback<RestResponse> callback,
                                    byte[] responseBytes,
                                    String mediaType)
  {
    RestResponse staticContentResponse = new RestResponseBuilder().
                                          setStatus(HttpStatus.S_200_OK.getCode()).
                                          setHeader(RestConstants.HEADER_CONTENT_TYPE, mediaType).
                                          setEntity(responseBytes).
                                          build();
    callback.onSuccess(staticContentResponse);
View Full Code Here

      headers.putAll(getHeaders());
    }
    headers.put(errorHeaderName, "true");
    headers.put(RestConstants.HEADER_RESTLI_PROTOCOL_VERSION, protocolVersion.toString());

    RestResponse restResponse = new RestResponseBuilder()
        .setEntity(entity)
        .setStatus(status)
        .setHeaders(Collections.unmodifiableMap(headers))
        .build();
View Full Code Here

        .setStatus(status)
        .setHeaders(getHeaders())
        .setProtocolVersion(getProtocolVersion())
        .build();

    RestResponse restResponse = new RestResponseBuilder()
        .setEntity(entity)
        .setStatus(status)
        .setHeaders(decodedResponse.getHeaders())
        .build();
View Full Code Here

  private void sendByteArrayAsResponse(Callback<RestResponse> callback,
                                    byte[] responseBytes,
                                    String mediaType)
  {
    RestResponse staticContentResponse = new RestResponseBuilder().
                                          setStatus(HttpStatus.S_200_OK.getCode()).
                                          setHeader(RestConstants.HEADER_CONTENT_TYPE, mediaType).
                                          setEntity(responseBytes).
                                          build();
    callback.onSuccess(staticContentResponse);
View Full Code Here

  }

  @Test
  public void testEcho() throws Exception
  {
    final EchoService client = getEchoClient(_client, Bootstrap.getEchoURI());

    final String msg = "This is a simple echo message";
    final FutureCallback<String> callback = new FutureCallback<String>();
    client.echo(msg, callback);

    Assert.assertEquals(callback.get(), msg);
  }
View Full Code Here

  }

  @Test
  public void testUnknownServiceUri() throws Exception
  {
    final EchoService client = getEchoClient(_client, URI.create("/unknown-service"));

    final String msg = "This is a simple echo message";
    final FutureCallback<String> callback = new FutureCallback<String>();
    client.echo(msg, callback);

    try
    {
      callback.get();
      Assert.fail("Should have thrown an exception");
View Full Code Here

  }

  @Test
  public void testBadRestURI()
  {
    final EchoService client = getEchoClient(_client, URI.create("/unknown-service"));
    if (!(client instanceof RestEchoClient))
    {
      return;
    }

    final String msg = "This is a simple echo message";
    final FutureCallback<String> callback = new FutureCallback<String>();
    client.echo(msg, callback);

    try
    {
      callback.get();
      Assert.fail("Should have thrown an exception");
View Full Code Here

TOP

Related Classes of com.linkedin.r2.sample.echo.EchoService

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.