Package com.linkedin.restli.examples.custom.types

Examples of com.linkedin.restli.examples.custom.types.CustomLong


  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
  public void testAction(RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException
  {
    Long lo = 5L;
    Request<Long> request = builders.<Long>action("Action").setActionParam("L", new CustomLong(lo)).build();
    Long result = REST_CLIENT.sendRequest(request).getResponse().getEntity();

    Assert.assertEquals(result, lo);
  }
View Full Code Here


  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestBuilderDataProvider")
  public void testCustomLongArrayOnAction(RootBuilderWrapper<Long, Greeting> builders) throws RemoteInvocationException
  {
    CustomLongRefArray ls = new CustomLongRefArray();
    ls.add(new CustomLong(1L));
    ls.add(new CustomLong(2L));

    Request<CustomLongRefArray> request = builders.<CustomLongRefArray>action("ArrayAction").setActionParam("Ls", ls).build();
    CustomLongRefArray elements = REST_CLIENT.sendRequest(request).getResponse().getEntity();
    Assert.assertEquals(elements.size(), 2);
    Assert.assertEquals(elements.get(0).toLong().longValue(), 1L);
View Full Code Here

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request2BuilderDataProvider")
  public void testCollectionGet(RootBuilderWrapper<CustomLong, Greeting> builders) throws RemoteInvocationException
  {
    Long lo = 5L;
    Request<Greeting> request = builders.get().id(new CustomLong(lo)).build();
    Greeting result = REST_CLIENT.sendRequest(request).getResponse().getEntity();

    Assert.assertEquals(result.getId(), lo);
  }
View Full Code Here

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
  public void testCollectionBatchGet(RestliRequestOptions requestOptions) throws RemoteInvocationException
  {
    Request<BatchResponse<Greeting>> request =
      new CustomTypes2Builders(requestOptions).batchGet().ids(new CustomLong(1L), new CustomLong(2L), new CustomLong(3L)).build();
    Map<String, Greeting> greetings = REST_CLIENT.sendRequest(request).getResponse().getEntity().getResults();

    Assert.assertEquals(greetings.size(), 3);
    Assert.assertEquals(greetings.get("1").getId().longValue(), 1L);
    Assert.assertEquals(greetings.get("2").getId().longValue(), 2L);
View Full Code Here

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
  public void testCollectionBatchGetKV(RestliRequestOptions requestOptions) throws RemoteInvocationException
  {
    Request<BatchKVResponse<CustomLong, Greeting>> request =
      new CustomTypes2Builders(requestOptions).batchGet().ids(new CustomLong(1L), new CustomLong(2L), new CustomLong(3L)).buildKV();
    Map<CustomLong, Greeting> greetings = REST_CLIENT.sendRequest(request).getResponse().getEntity().getResults();

    Assert.assertEquals(greetings.size(), 3);
    Assert.assertEquals(greetings.get(new CustomLong(1L)).getId().longValue(), 1L);
    Assert.assertEquals(greetings.get(new CustomLong(2L)).getId().longValue(), 2L);
    Assert.assertEquals(greetings.get(new CustomLong(3L)).getId().longValue(), 3L);
  }
View Full Code Here

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
  public void testCollectionBatchGetEntity(RestliRequestOptions requestOptions) throws RemoteInvocationException
  {
    Request<BatchKVResponse<CustomLong, EntityResponse<Greeting>>> request =
      new CustomTypes2RequestBuilders(requestOptions).batchGet().ids(new CustomLong(1L), new CustomLong(2L), new CustomLong(3L)).build();
    Map<CustomLong, EntityResponse<Greeting>> greetings = REST_CLIENT.sendRequest(request).getResponse().getEntity().getResults();

    Assert.assertEquals(greetings.size(), 3);
    Assert.assertEquals(greetings.get(new CustomLong(1L)).getEntity().getId().longValue(), 1L);
    Assert.assertEquals(greetings.get(new CustomLong(2L)).getEntity().getId().longValue(), 2L);
    Assert.assertEquals(greetings.get(new CustomLong(3L)).getEntity().getId().longValue(), 3L);
  }
View Full Code Here

  }

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request2BuilderDataProvider")
  public void testCollectionBatchDelete(RootBuilderWrapper<CustomLong, Greeting> builders) throws RemoteInvocationException
  {
    Request<BatchKVResponse<CustomLong, UpdateStatus>> request = builders.batchDelete().ids(new CustomLong(1L), new CustomLong(2L), new CustomLong(3L)).build();
    Map<CustomLong, UpdateStatus> statuses = REST_CLIENT.sendRequest(request).getResponse().getEntity().getResults();

    Assert.assertEquals(statuses.size(), 3);
    Assert.assertEquals(statuses.get(new CustomLong(1L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
    Assert.assertEquals(statuses.get(new CustomLong(2L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
    Assert.assertEquals(statuses.get(new CustomLong(3L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
  }
View Full Code Here

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request2BuilderDataProvider")
  public void testCollectionBatchUpdate(RootBuilderWrapper<CustomLong, Greeting> builders) throws RemoteInvocationException
  {
    RequestBuilder<? extends Request<BatchKVResponse<CustomLong, UpdateStatus>>> request =
      builders.batchUpdate().input(new CustomLong(1L), new Greeting().setId(1)).input(new CustomLong(2L), new Greeting().setId(2)).getBuilder();
    Map<CustomLong, UpdateStatus> statuses = REST_CLIENT.sendRequest(request).getResponse().getEntity().getResults();

    Assert.assertEquals(statuses.size(), 2);
    Assert.assertEquals(statuses.get(new CustomLong(1L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
    Assert.assertEquals(statuses.get(new CustomLong(2L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
  }
View Full Code Here

  }

  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "request2BuilderDataProvider")
  public void testCollectionBatchPartialUpdate(RootBuilderWrapper<CustomLong, Greeting> builders) throws RemoteInvocationException
  {
    RequestBuilder<? extends Request<BatchKVResponse<CustomLong, UpdateStatus>>> request = builders.batchPartialUpdate().input(new CustomLong(1L),
                                                                                                                               new PatchRequest<Greeting>()).input(new CustomLong(2L), new PatchRequest<Greeting>()).getBuilder();
    Map<CustomLong, UpdateStatus> statuses = REST_CLIENT.sendRequest(request).getResponse().getEntity().getResults();

    Assert.assertEquals(statuses.size(), 2);
    Assert.assertEquals(statuses.get(new CustomLong(1L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
    Assert.assertEquals(statuses.get(new CustomLong(2L)).getStatus().intValue(), HttpStatus.S_204_NO_CONTENT.getCode());
  }
View Full Code Here

    Assert.assertEquals(response.getStatus(), HttpStatus.S_201_CREATED.getCode());

    @SuppressWarnings("unchecked")
    CreateResponse<CustomLong> createResponse = (CreateResponse<CustomLong>)response.getEntity();
    Assert.assertEquals(createResponse.getId(), new CustomLong(10L));
  }
View Full Code Here

TOP

Related Classes of com.linkedin.restli.examples.custom.types.CustomLong

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.