Package com.linkedin.restli.client.test

Examples of com.linkedin.restli.client.test.TestRecord


  {
    UpdateRequestBuilder<Long, TestRecord> builder = new UpdateRequestBuilder<Long, TestRecord>(TEST_URI,
                                                                                                TestRecord.class,
                                                                                                _COLL_SPEC,
                                                                                                RestliRequestOptions.DEFAULT_OPTIONS);
    UpdateRequest<TestRecord> request = builder.id(1L).input(new TestRecord()).build();
    Assert.assertEquals(request.isSafe(), false);
    Assert.assertEquals(request.isIdempotent(), true);

    checkBasicRequest(request,
                      expectedUri,
                      ResourceMethod.UPDATE,
                      new TestRecord(),
                      Collections.<String, String>emptyMap(),
                      version);
  }
View Full Code Here


  {
    UpdateRequestBuilder<Void, TestRecord> builder = new UpdateRequestBuilder<Void, TestRecord>(TEST_URI,
                                                                                                TestRecord.class,
                                                                                                _SIMPLE_RESOURCE_SPEC,
                                                                                                RestliRequestOptions.DEFAULT_OPTIONS);
    UpdateRequest<TestRecord> request = builder.input(new TestRecord()).build();
    Assert.assertEquals(request.isSafe(), false);
    Assert.assertEquals(request.isIdempotent(), true);

    checkBasicRequest(request,
                      expectedUri,
                      ResourceMethod.UPDATE,
                      new TestRecord(),
                      Collections.<String, String>emptyMap(),
                      version);
  }
View Full Code Here

    ComplexResourceKey<TestRecord, TestRecord> id1 =
        buildComplexKey(1L, "KeyMessage1", 10L, "ParamMessage1");
    ComplexResourceKey<TestRecord, TestRecord> id2 =
        buildComplexKey(2L, "KeyMessage2", 20L, "ParamMessage2");
    RecordTemplate param = buildComplexParam(123, "ParamMessage");
    TestRecord t1 = new TestRecord().setMessage("foo");
    TestRecord t2 = new TestRecord().setMessage("bar");

    BatchUpdateRequest<ComplexResourceKey<TestRecord, TestRecord>, TestRecord> request =
        builder.input(id1, t1).input(id2, t2).setParam("testParam", param).build();

    // using toStringFull (which is deprecated) because this is only used to check v1
View Full Code Here

                                                                                         TestRecord.class,
                                                                                         _COMPLEX_KEY_SPEC,
                                                                                         RestliRequestOptions.DEFAULT_OPTIONS);
    ComplexResourceKey<TestRecord, TestRecord> key = buildComplexKey(1L, "keyMessage", 2L, "paramMessage");

    UpdateRequest<TestRecord> request = builder.id(key).input(new TestRecord()).build();

    testBaseUriGeneration(request);
    Assert.assertEquals(request.isSafe(), false);
    Assert.assertEquals(request.isIdempotent(), true);
    checkBasicRequest(request,
                      expectedUri,
                      ResourceMethod.UPDATE,
                      new TestRecord(),
                      Collections.<String, String> emptyMap(),
                      version);
  }
View Full Code Here

    CreateRequestBuilder<ComplexResourceKey<TestRecord, TestRecord>, TestRecord> builder =
        new CreateRequestBuilder<ComplexResourceKey<TestRecord, TestRecord>, TestRecord>(TEST_URI,
                                                                                         TestRecord.class,
                                                                                         _COMPLEX_KEY_SPEC,
                                                                                         RestliRequestOptions.DEFAULT_OPTIONS);
    CreateRequest<TestRecord> request = builder.input(new TestRecord()).build();

    testBaseUriGeneration(request);
    Assert.assertEquals(request.isSafe(), false);
    Assert.assertEquals(request.isIdempotent(), false);
    checkBasicRequest(request,
                      expectedUri,
                      ResourceMethod.CREATE,
                      new TestRecord(),
                      Collections.<String, String> emptyMap(),
                      version);
  }
View Full Code Here

                                                                                                     RestliRequestOptions.DEFAULT_OPTIONS);
    Map<ComplexResourceKey<TestRecord, TestRecord>, PatchRequest<TestRecord>> inputs =
        new HashMap<ComplexResourceKey<TestRecord, TestRecord>, PatchRequest<TestRecord>>();
    ComplexResourceKey<TestRecord, TestRecord> key1 = buildComplexKey(1L, "keyMessage1", 2L, "paramMessage1");
    ComplexResourceKey<TestRecord, TestRecord> key2 = buildComplexKey(3L, "keyMessage2", 4L, "paramMessage2");
    TestRecord t1 = new TestRecord().setId(1L);
    TestRecord t2 = new TestRecord().setId(2L).setMessage("foo");
    TestRecord t3 = new TestRecord().setMessage("bar");
    PatchRequest<TestRecord> patch1 = PatchGenerator.diff(t1, t2);
    PatchRequest<TestRecord> patch2 = PatchGenerator.diff(t2, t3);
    inputs.put(key1, patch1);
    inputs.put(key2, patch2);
View Full Code Here

  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "noEntityWithParam")
  public void testCrudBuilderParams8(ProtocolVersion version, String expectedUri)
  {
    Request<CollectionResponse<CreateStatus>> request = new BatchCreateRequestBuilder<Long, TestRecord>(TEST_URI, TestRecord.class, _COLL_SPEC, RestliRequestOptions.DEFAULT_OPTIONS)
        .input(new TestRecord()).setParam("foo", "bar").build();
    testUriGeneration(request, expectedUri, version);
  }
View Full Code Here

  @Test(dataProvider = TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "batchSingleWithParam")
  public void testCrudBuilderParams10(ProtocolVersion version, String expectedUri)
  {
    Request<BatchKVResponse<Long, UpdateStatus>> request = new BatchUpdateRequestBuilder<Long, TestRecord>(TEST_URI, TestRecord.class, _COLL_SPEC, RestliRequestOptions.DEFAULT_OPTIONS)
        .input(1L, new TestRecord()).setParam("foo", "bar").build();
    testUriGeneration(request, expectedUri, version);
  }
View Full Code Here

   * Helper method to build complex key instance
   */
  private ComplexResourceKey<TestRecord, TestRecord> buildComplexKey(long keyId, String keyMessage, long paramId, String paramMessage)
  {
    ComplexResourceKey<TestRecord, TestRecord> id =
      new ComplexResourceKey<TestRecord, TestRecord>(new TestRecord(),
                                                     new TestRecord());
    id.getKey().setId(keyId);
    id.getKey().setMessage(keyMessage);
    id.getParams().setId(paramId);
    id.getParams().setMessage(paramMessage);
    return id;
View Full Code Here

  /**
   * Helper method to build complex param instance
   */
  private RecordTemplate buildComplexParam(int id, String message)
  {
    TestRecord result = new TestRecord();
    result.setId(id);
    result.setMessage(message);
    return result;
  }
View Full Code Here

TOP

Related Classes of com.linkedin.restli.client.test.TestRecord

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.