Examples of Greeting


Examples of com.linkedin.restli.examples.greetings.api.Greeting

  }

  @Test
  public void testUnequalCollections()
  {
    Greeting g1 = new Greeting().setMessage("foo").setId(1L);
    Greeting g2 = new Greeting().setMessage("foo").setId(2L);

    List<Greeting> actual = Arrays.asList(g1, g2);
    List<Greeting> expected = Arrays.asList(g1, new Greeting().setId(3L).setMessage("foo"));

    String indexErrorMessage = "are not equal at index 1";
    String propertyErrorMessage = "Mismatch on property \"id\", expected:<3> but was:<2>";

    try
View Full Code Here

Examples of com.linkedin.restli.examples.greetings.api.Greeting

  public void testNullCreateResponse(final RootBuilderWrapper<Long, Greeting> builders)
      throws RemoteInvocationException
  {
    //Forces the server to return a null CreateResponse
    final RootBuilderWrapper.MethodBuilderWrapper<Long, Greeting, EmptyRecord> methodBuilderWrapper = builders.create();
    final Greeting illGreeting = new Greeting().setMessage("nullCreateResponse").setTone(Tone.INSULTING);
    createAndAssertNullMessages(methodBuilderWrapper, illGreeting);
  }
View Full Code Here

Examples of com.linkedin.restli.examples.greetings.api.Greeting

  public void testNullHttpStatusCreateResponse(final RootBuilderWrapper<Long, Greeting> builders)
      throws RemoteInvocationException
  {
    //Forces the server to return a valid CreateResponse but with a null HttpStatus inside of it
    final RootBuilderWrapper.MethodBuilderWrapper<Long, Greeting, EmptyRecord> methodBuilderWrapper = builders.create();
    final Greeting illGreeting = new Greeting().setMessage("nullHttpStatus").setTone(Tone.INSULTING);
    createAndAssertNullMessages(methodBuilderWrapper, illGreeting);
  }
View Full Code Here

Examples of com.linkedin.restli.examples.greetings.api.Greeting

  private void sendUpdateAndAssert(final RootBuilderWrapper<Long, Greeting> builders, Long id)
      throws RemoteInvocationException
  {
    try
    {
      final Greeting someGreeting = new Greeting().setMessage("Hello").setTone(Tone.INSULTING);
      REST_CLIENT.sendRequest(builders.update().id(id).input(someGreeting).build()).getResponse();
    }
    catch (final RestLiResponseException responseException)
    {
      assertCorrectInternalServerMessageForNull(responseException, "update");
View Full Code Here

Examples of com.linkedin.restli.examples.greetings.api.Greeting

  private void sendBatchUpdateAndAssert(final RootBuilderWrapper<Long, Greeting> builders, Long id)
      throws RemoteInvocationException
  {
    try
    {
      final Greeting someGreeting = new Greeting().setMessage("Hello").setTone(Tone.INSULTING);
      Request<BatchKVResponse<Long, UpdateStatus>> writeRequest =
          builders.batchUpdate().input(id, someGreeting).build();
      REST_CLIENT.sendRequest(writeRequest).getResponse();
    }
    catch (final RestLiResponseException responseException)
View Full Code Here

Examples of com.linkedin.restli.examples.greetings.api.Greeting

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX
      + "requestBuilderDataProvider")
  public void testBatchCreateNulls(final RootBuilderWrapper<Long, Greeting> builders)
      throws RemoteInvocationException
  {
    final Greeting firstGreeting = new Greeting().setMessage("first").setTone(Tone.INSULTING);
    final Greeting secondGreeting = new Greeting().setMessage("first").setTone(Tone.INSULTING);

    //Forces the server to return a null list
    sendBatchCreateAndAssert(builders, Collections.<Greeting>emptyList());

    //Forces the server to return a BatchCreateResult with a null list in it
View Full Code Here

Examples of com.linkedin.restli.examples.greetings.api.Greeting

    Request<Greeting> request = builders.get().id(1L).setQueryParam("auth", "PLEASE").build();
    ResponseFuture<Greeting> future = REST_CLIENT.sendRequest(request);
    Response<Greeting> greetingResponse = future.getResponse();

    // POST
    Greeting greeting = new Greeting(greetingResponse.getEntity().data().copy());
    greeting.setMessage("This is a new message!");

    Request<EmptyRecord>  writeRequest = builders.update().id(1L).input(greeting)
      .setQueryParam("auth", "PLEASE").build();
    REST_CLIENT.sendRequest(writeRequest).getResponse();
View Full Code Here

Examples of com.linkedin.restli.examples.greetings.api.Greeting

        .setActionParam("NewTone", Tone.SINCERE)
        .setActionParam("DelOld", false)
        .build();
    ResponseFuture<Greeting> responseFuture = client.sendRequest(request);
    Assert.assertEquals(responseFuture.getResponse().getStatus(), 200);
    final Greeting newGreeting = responseFuture.getResponse().getEntity();
    Assert.assertNotNull(newGreeting);
    Assert.assertEquals(newGreeting.getId().longValue(), 1L);
    Assert.assertEquals(newGreeting.getTone(), Tone.SINCERE);
    checkContentEncodingHeaderIsAbsent(responseFuture.getResponse());
  }
View Full Code Here

Examples of com.linkedin.restli.examples.greetings.api.Greeting

    String response1 = greetingResponse.getEntity().getMessage();
    Assert.assertNotNull(response1);
    checkContentEncodingHeaderIsAbsent(future.getResponse());

    // POST
    Greeting greeting = new Greeting(greetingResponse.getEntity().data().copy());
    greeting.setMessage(response1 + "Again");

    Request<EmptyRecord> writeRequest = builders.update().id(1L).input(greeting).build();
    client.sendRequest(writeRequest).getResponse();

    // GET again, to verify that our POST worked.
View Full Code Here

Examples of com.linkedin.restli.examples.greetings.api.Greeting

    // GET
    Request<Greeting> request = builders.get().id(1L).build();
    ResponseFuture<Greeting> future = client.sendRequest(request);
    Response<Greeting> greetingResponse = future.getResponse();

    Greeting original = greetingResponse.getEntity();
    checkContentEncodingHeaderIsAbsent(greetingResponse);

    // POST
    Greeting greeting = new Greeting(original.data().copy());
    greeting.setMessage(original.getMessage() + " Again");

    PatchRequest<Greeting> patch = PatchGenerator.diff(original, greeting);

    Request<EmptyRecord> writeRequest = builders.partialUpdate().id(1L).input(patch).build();
    int status = client.sendRequest(writeRequest).getResponse().getStatus();
    Assert.assertEquals(status, HttpStatus.S_204_NO_CONTENT.getCode());

    // GET again, to verify that our POST worked.
    Request<Greeting> request2 = builders.get().id(1L).build();
    ResponseFuture<Greeting> future2 = client.sendRequest(request2);
    String response2 = future2.getResponse().getEntity().getMessage();

    Assert.assertEquals(response2, greeting.getMessage());
    checkContentEncodingHeaderIsAbsent(future2.getResponse());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.