Package com.linkedin.restli.examples.greetings.api

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


    CompoundKey key = new CompoundKey();
    key.append("src", key1());
    key.append("dest", key2());

    Request<Message> request = builders.get().id(key).build();
    Message response = REST_CLIENT.sendRequest(request).get().getEntity();
    Assert.assertNotNull(response);
    Assert.assertEquals(response.getId(), key.getPart("src") + " " + key.getPart("dest"), "Message should be key1 + ' ' + key2 for associationKey(key1,key2)");
  }
View Full Code Here


    params.setMajor(key1());
    params.setMinor(key3());

    ComplexResourceKey<TwoPartKey, TwoPartKey> complexKey = new ComplexResourceKey<TwoPartKey, TwoPartKey>(key, params);
    Request<Message> request = builders.get().id(complexKey).build();
    Message response = REST_CLIENT.sendRequest(request).get().getEntity();
    Assert.assertNotNull(response);
    Assert.assertEquals(response.getId(), key.getMajor() + " " + key.getMinor(), "Message should be key1 + ' ' + key2 for complexKey(key1,key2)");
  }
View Full Code Here

  {
    String parentKey = key1();
    String subKey = key2();

    Request<Message> request = builders.get().setPathKey("parentKey", parentKey).id(subKey).build();
    Message response = REST_CLIENT.sendRequest(request).get().getEntity();
    Assert.assertNotNull(response);
    Assert.assertEquals(response.getId(), parentKey + " " + subKey, "Message should be key1 + ' ' + key2 for subResourceKey(key1,key2)");
  }
View Full Code Here

  {
    Request<CollectionResponse<Message>> request = builders.findBy("Search").setQueryParam("keyword", key1()).build();
    CollectionResponse<Message> response = REST_CLIENT.sendRequest(request).get().getEntity();
    List<Message> hits = response.getElements();
    Assert.assertEquals(hits.size(), 1);
    Message hit = hits.get(0);
    Assert.assertEquals(hit.getMessage(), key1(), "Message of matching result should be key1");
  }
View Full Code Here

  public void testIterable(RootBuilderWrapper<Integer, Greeting> builders)
  {
    builders.findBy("Test")
      .setQueryParam("primitive", Arrays.asList(1, 2, 3))
      .setQueryParam("enum", Arrays.asList(Tone.FRIENDLY, Tone.SINCERE))
      .setQueryParam("record" ,Arrays.asList(new Message(), new Message()))
      .setQueryParam("existing", Arrays.asList(new ToneFacet(), new ToneFacet()));
  }
View Full Code Here

        new Object[]
          {
            new ActionsBuilders().options(),
            new NamedDataSchema[]
              {
                new Message().schema(),
                (NamedDataSchema)DataTemplateUtil.getSchema(Tone.class)
              }
          },
        new Object[]
          {
            new ActionsRequestBuilders().options(),
            new NamedDataSchema[]
              {
                new Message().schema(),
                (NamedDataSchema)DataTemplateUtil.getSchema(Tone.class)
              }
          }
      };
  }
View Full Code Here

  public Message get(String key)
  {
    PathKeys pathKeys = getContext().getPathKeys();
    String srcKey = pathKeys.getAsString("src");
    String destKey = pathKeys.getAsString("dest");
    Message message = new Message();
    message.setId(srcKey);
    message.setTone(Tone.FRIENDLY);
    message.setMessage(destKey);
    return message;
  }
View Full Code Here

  @Finder("tone")
  public List<Message> findByTone(@QueryParam("tone") Tone tone)
  {
    List<Message> messages = new ArrayList<Message>(2);

    Message message1 = new Message();
    message1.setId("one");
    message1.setMessage("one");
    message1.setTone(tone);

    Message message2 = new Message();
    message2.setId("two");
    message2.setMessage("two");
    message2.setTone(tone);

    messages.add(message1);
    messages.add(message2);

    return messages;
View Full Code Here

  @SuppressWarnings("deprecation")
  public void testCreate(RootBuilderWrapper<CompoundKey, Message> builders) throws Exception
  {
    // Associations should never support create operations. This is a bug in Rest.li that will be fixed. For now we want
    // to make sure that creating and then calling getId() on the response throws an exception.
    Request<EmptyRecord> request = builders.create().input(new Message().setMessage("foo")).build();
    REST_CLIENT.sendRequest(request).getResponse().getId();
  }
View Full Code Here

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestSubBuilderDataProvider")
  public void testSubresourceGet(RootBuilderWrapper<String, Message> builders) throws RemoteInvocationException
  {
    Request<Message> request = builders.get().setPathKey("dest", "dest").setPathKey("src", "src").id("id").build();
    Message message = REST_CLIENT.sendRequest(request).getResponse().getEntity();
    Assert.assertEquals(message.getId(), "src");
    Assert.assertEquals(message.getMessage(), "dest");
  }
View Full Code Here

TOP

Related Classes of com.linkedin.restli.examples.greetings.api.Message

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.