Examples of Greeting


Examples of com.example.model.Greeting

    {
        final String userEmail = "foo@example.com";
        final String content = "Hello, World!";
        final Date date = new Date();
        User author = new User(userEmail, "");
        Greeting greeting = new Greeting(author, content, date);

        greetingRepo.persist(greeting);

        assertNotNull(greeting.getId());
        assertNotNull(greetingRepo.get(greeting.getId()));
    }
View Full Code Here

Examples of com.google.appengine.samples.angularjs_guestbook.domain.Greeting

    Gson gson = new GsonBuilder().create();
    GuestbookResponse result = gson.fromJson(resultBuffer.toString().trim(),
        GuestbookResponse.class);
    assertThat(result.getGuestbookName(), is("default"));
    assertThat(result.getGreetings().size(), is(1));
    Greeting greeting = result.getGreetings().get(0);
    assertThat(greeting.getContent(), is("Test message"));
    assertThat(greeting.getAuthor(), is("test@example.com"));
    assertThat(greeting.getDate(), instanceOf(Date.class));
    assertThat(result.getUserServiceInfo(), nullValue());
  }
View Full Code Here

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

  {
    Request<Greeting> request = builders.get().id(1L).build();

    Response<Greeting> response = restClient.sendRequest(request).getResponse();
    Assert.assertEquals(response.getHeader("Content-Type"), expectedContentType);
    Greeting greeting = response.getEntity();
    Assert.assertEquals(greeting.getId(), new Long(1));
  }
View Full Code Here

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

            .build();

    Response<Greeting> response = restClient.sendRequest(request).getResponse();
    Assert.assertEquals(response.getHeader("Content-Type"), expectedContentType);

    Greeting greeting = response.getEntity();
    Assert.assertEquals(greeting.getMessage(), "This is a newly created greeting");
  }
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 + "oldBuildersClientDataDataProvider")
  public void testCreate(RestClient restClient, String expectedContentType, GreetingsBuilders builders) throws RemoteInvocationException
  {
    Greeting greeting = new Greeting();
    greeting.setMessage("Hello there!");
    greeting.setTone(Tone.FRIENDLY);

    Request<EmptyRecord> createRequest = builders.create().input(greeting).build();
    Response<EmptyRecord> response = restClient.sendRequest(createRequest).getResponse();
    Assert.assertNull(response.getHeader(RestConstants.HEADER_CONTENT_TYPE));
    @SuppressWarnings("unchecked")
    CreateResponse<Long> createResponse = (CreateResponse<Long>)response.getEntity();
    long id = createResponse.getId();
    @SuppressWarnings("deprecation")
    String stringId = response.getId();
    Assert.assertEquals(id, Long.parseLong(stringId));

    Request<Greeting> getRequest = builders.get().id(id).build();
    Response<Greeting> getResponse = restClient.sendRequest(getRequest).getResponse();
    Assert.assertEquals(getResponse.getHeader(RestConstants.HEADER_CONTENT_TYPE), expectedContentType);
    Greeting responseGreeting = getResponse.getEntity();

    Assert.assertEquals(responseGreeting.getMessage(), greeting.getMessage());
    Assert.assertEquals(responseGreeting.getTone(), greeting.getTone());
  }
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 + "newBuildersClientDataDataProvider")
  public void testCreateId(RestClient restClient, String expectedContentType, GreetingsRequestBuilders builders) throws RemoteInvocationException
  {
    Greeting greeting = new Greeting();
    greeting.setMessage("Hello there!");
    greeting.setTone(Tone.FRIENDLY);

    CreateIdRequest<Long, Greeting> createRequest = builders.create().input(greeting).build();
    Response<IdResponse<Long>> response = restClient.sendRequest(createRequest).getResponse();
    Assert.assertNull(response.getHeader(RestConstants.HEADER_CONTENT_TYPE));
    long id = response.getEntity().getId();
    @SuppressWarnings("deprecation")
    String stringId = response.getId();
    Assert.assertEquals(id, Long.parseLong(stringId));

    Request<Greeting> getRequest = builders.get().id(id).build();
    Response<Greeting> getResponse = restClient.sendRequest(getRequest).getResponse();
    Assert.assertEquals(getResponse.getHeader(RestConstants.HEADER_CONTENT_TYPE), expectedContentType);
    Greeting responseGreeting = getResponse.getEntity();

    Assert.assertEquals(responseGreeting.getMessage(), greeting.getMessage());
    Assert.assertEquals(responseGreeting.getTone(), greeting.getTone());
  }
View Full Code Here

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

    String response1 = greetingResponse1.getEntity().getMessage();
    Assert.assertNotNull(response1);

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

    Request<EmptyRecord> writeRequest = builders.update().id(1L).input(greeting).build();
    Response<EmptyRecord> updateResponse = restClient.sendRequest(writeRequest).getResponse();
    Assert.assertNull(updateResponse.getHeader(RestConstants.HEADER_CONTENT_TYPE));
View Full Code Here

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

        builders.batchGet().ids(complexKeys).buildKV();

    Response<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting>> response =
        REST_CLIENT.sendRequest(request).getResponse();

    Greeting greeting1 = response.getEntity().getResults().get(complexKeys.get(0));
    Assert.assertNotNull(greeting1);

    Greeting greeting2 = response.getEntity().getResults().get(complexKeys.get(1));
    Assert.assertNotNull(greeting2);
  }
View Full Code Here

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

      builders.batchGet().ids(complexKeys).buildKV();

    Response<BatchKVResponse<ComplexResourceKey<ComplexArray, ComplexArray>, Greeting>> response2 =
      REST_CLIENT.sendRequest(request2).getResponse();

    Greeting greeting1 = response2.getEntity().getResults().get(complexKeys.get(0));
    Assert.assertNotNull(greeting1);
    Greeting greeting2 = response2.getEntity().getResults().get(complexKeys.get(1));
    Assert.assertNotNull(greeting2);

  }
View Full Code Here

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

  @Test
  public void testOnlyOneOfErrorResponseOrEntityIsSet()
  {
    MockFailedResponseFutureBuilder<Long, Greeting> builder = new MockFailedResponseFutureBuilder<Long, Greeting>();
    builder.setEntity(new Greeting());
    try
    {
      builder.setErrorResponse(new ErrorResponse());
      Assert.fail();
    }
    catch (IllegalStateException e)
    {
      // expected
    }

    builder = new MockFailedResponseFutureBuilder<Long, Greeting>();
    builder.setErrorResponse(new ErrorResponse());
    try
    {
      builder.setEntity(new Greeting());
      Assert.fail();
    }
    catch (IllegalStateException e)
    {
      // expected
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.