Package com.linkedin.restli.common

Examples of com.linkedin.restli.common.CompoundKey


  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
  public void testAssociationBatchGetKVCompoundKeyResponse(RestliRequestOptions requestOptions)
    throws RemoteInvocationException
  {
    CompoundKey key1 = buildCompoundKey(1, 1);
    CompoundKey key2 = buildCompoundKey(2, 1);
    Set<CompoundKey> allRequestedKeys = new HashSet<CompoundKey>(Arrays.asList(key1, key2));

    Request<BatchKVResponse<CompoundKey, GroupMembership>> request = new GroupMembershipsBuilders(requestOptions).batchGet()
                    .ids(key1, key2)
                    .fields(GroupMembership.fields().contactEmail())
View Full Code Here


  @Test(dataProvider = com.linkedin.restli.internal.common.TestConstants.RESTLI_PROTOCOL_1_2_PREFIX + "requestOptionsDataProvider")
  public void testAssociationBatchGetEntityCompoundKeyResponse(RestliRequestOptions requestOptions)
    throws RemoteInvocationException
  {
    CompoundKey key1 = buildCompoundKey(1, 1);
    CompoundKey key2 = buildCompoundKey(2, 1);
    Set<CompoundKey> allRequestedKeys = new HashSet<CompoundKey>(Arrays.asList(key1, key2));

    Request<BatchKVResponse<CompoundKey, EntityResponse<GroupMembership>>> request = new GroupMembershipsRequestBuilders(requestOptions).batchGet()
      .ids(key1, key2)
      .fields(GroupMembership.fields().contactEmail())
View Full Code Here

    return complexKey;
  }

  private static CompoundKey buildCompoundKey(int memberID, int groupID)
  {
    CompoundKey compoundKey = new CompoundKey();
    compoundKey.append("memberID", memberID);
    compoundKey.append("groupID", groupID);
    return compoundKey;
  }
View Full Code Here

            },
            {
                associationResourceParams,
                new Key("myComplexKeyAssociationId", CompoundKey.class, null),
                "myComplexKeyAssociationId",
                new CompoundKey().append("string1", "apples").append("string2", "oranges")
            }
        };
  }
View Full Code Here

  {
    BatchGetRequestBuilder<CompoundKey, TestRecord> builder = new BatchGetRequestBuilder<CompoundKey, TestRecord>(TEST_URI,
                                                                                                                  TestRecord.class,
                                                                                                                  _ASSOC_SPEC,
                                                                                                                  RestliRequestOptions.DEFAULT_OPTIONS);
    CompoundKey key1 = new CompoundKey();
    key1.append("equals", "=");
    key1.append("ampersand", "&");
    CompoundKey key2 = new CompoundKey();
    key2.append("equals", "==");
    key2.append("ampersand", "&&");

    BatchGetKVRequest<CompoundKey, TestRecord> request =
        builder.ids(key1,key2).fields(TestRecord.fields().id(), TestRecord.fields().message()).buildKV();

    testBaseUriGeneration(request);
View Full Code Here

                      version);
  }

  private CompoundKey buildCompoundKey()
  {
    return new CompoundKey().append("part1", 1L).append("part2", "2");
  }
View Full Code Here

  public void testGetCompoundKeyRequestBuilder(ProtocolVersion version, String expectedUri)
  {
    GetRequestBuilder<CompoundKey, TestRecord> builder =
        new GetRequestBuilder<CompoundKey, TestRecord>(TEST_URI, TestRecord.class, _ASSOC_SPEC, RestliRequestOptions.DEFAULT_OPTIONS);

    CompoundKey key = buildCompoundKey();

    GetRequest<TestRecord> request = builder.id(key).build();

    testBaseUriGeneration(request);
    Assert.assertEquals(request.isSafe(), true);
View Full Code Here

  {
    BatchUpdateRequestBuilder<CompoundKey, TestRecord> builder =
        new BatchUpdateRequestBuilder<CompoundKey, TestRecord>(TEST_URI, TestRecord.class, _ASSOC_SPEC, RestliRequestOptions.DEFAULT_OPTIONS);

    Map<CompoundKey, TestRecord> inputs = new HashMap<CompoundKey, TestRecord>();
    CompoundKey key1 = new CompoundKey().append("part1", 1L).append("part2", "2");
    CompoundKey key2 = new CompoundKey().append("part1", 11L).append("part2", "22");
    TestRecord t1 = new TestRecord().setId(1L).setMessage("1");
    TestRecord t2 = new TestRecord().setId(2L);
    inputs.put(key1, t1);
    inputs.put(key2, t2);
View Full Code Here

  {
    BatchPartialUpdateRequestBuilder<CompoundKey, TestRecord> builder =
        new BatchPartialUpdateRequestBuilder<CompoundKey, TestRecord>(TEST_URI, TestRecord.class, _ASSOC_SPEC, RestliRequestOptions.DEFAULT_OPTIONS);

    Map<CompoundKey, PatchRequest<TestRecord>> inputs = new HashMap<CompoundKey, PatchRequest<TestRecord>>();
    CompoundKey key1 = new CompoundKey().append("part1", 1L).append("part2", "2");
    CompoundKey key2 = new CompoundKey().append("part1", 11L).append("part2", "22");
    TestRecord t1 = new TestRecord().setId(1L).setMessage("1");
    TestRecord t2 = new TestRecord().setId(2L);
    TestRecord t3 = new TestRecord().setMessage("3");
    PatchRequest<TestRecord> patch1 = PatchGenerator.diff(t1, t2);
    PatchRequest<TestRecord> patch2 = PatchGenerator.diff(t2, t3);
View Full Code Here

    finder.name(finderSchema.getName());

    if (finderSchema.hasAssocKeys())
    {
      CompoundKey key = (CompoundKey)generateKey();
      for (String partKey : finderSchema.getAssocKeys())
      {
        finder.assocKey(partKey, key.getPart(partKey));
      }
    }
    else if (finderSchema.hasAssocKey()) // why do we have a separate field for the singular form?  assocKeys and assocKey.
    {
      String partKey = finderSchema.getAssocKey();
      CompoundKey key = (CompoundKey)generateKey();
      finder.assocKey(partKey, key.getPart(partKey));
    }

    if (finderSchema.hasParameters() && !finderSchema.getParameters().isEmpty())
    {
      addParams(finder, finderSchema.getParameters());
View Full Code Here

TOP

Related Classes of com.linkedin.restli.common.CompoundKey

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.