Search in sources :

Example 6 with AssociationsFluentClient

use of com.linkedin.restli.examples.greetings.client.AssociationsFluentClient in project rest.li by linkedin.

the class TestParseqBasedFluentClientApi method testAssociateResourceBatchUpdate.

@Test
public void testAssociateResourceBatchUpdate() throws Exception {
    Associations associations = new AssociationsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
    Map<CompoundKey, UpdateStatus> ids = associations.batchUpdate(getAssociateResourceMockDB(associations)).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
    Assert.assertEquals(ids.size(), 2);
    for (CompoundKey id : ids.keySet()) {
        Assert.assertEquals(ids.get(id).getStatus().intValue(), 204);
    }
}
Also used : UpdateStatus(com.linkedin.restli.common.UpdateStatus) CompoundKey(com.linkedin.restli.common.CompoundKey) Associations(com.linkedin.restli.examples.greetings.client.Associations) AssociationsAssociationsFluentClient(com.linkedin.restli.examples.greetings.client.AssociationsAssociationsFluentClient) AssociationsFluentClient(com.linkedin.restli.examples.greetings.client.AssociationsFluentClient) Test(org.testng.annotations.Test)

Example 7 with AssociationsFluentClient

use of com.linkedin.restli.examples.greetings.client.AssociationsFluentClient in project rest.li by linkedin.

the class TestParseqBasedFluentClientApi method testAssociateResourceBatchPartialUpdate.

@Test
public void testAssociateResourceBatchPartialUpdate() throws Exception {
    Associations associations = new AssociationsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
    Map<CompoundKey, PatchRequest<Message>> patches = new HashMap<>();
    patches.put(getAssociateResourceUrlKey(associations), new PatchRequest<>());
    patches.put(getAssociateResourceSimpleKey(associations), new PatchRequest<>());
    Map<CompoundKey, UpdateStatus> ids = associations.batchPartialUpdate(patches).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
    for (CompoundKey id : ids.keySet()) {
        Assert.assertEquals(ids.get(id).getStatus().intValue(), 204);
    }
}
Also used : UpdateStatus(com.linkedin.restli.common.UpdateStatus) CompoundKey(com.linkedin.restli.common.CompoundKey) HashMap(java.util.HashMap) Associations(com.linkedin.restli.examples.greetings.client.Associations) PatchRequest(com.linkedin.restli.common.PatchRequest) AssociationsAssociationsFluentClient(com.linkedin.restli.examples.greetings.client.AssociationsAssociationsFluentClient) AssociationsFluentClient(com.linkedin.restli.examples.greetings.client.AssociationsFluentClient) Test(org.testng.annotations.Test)

Example 8 with AssociationsFluentClient

use of com.linkedin.restli.examples.greetings.client.AssociationsFluentClient in project rest.li by linkedin.

the class TestParseqBasedFluentClientApi method testAssociateResourceBatchGet.

@Test
public void testAssociateResourceBatchGet() throws Exception {
    Associations associations = new AssociationsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
    Map<CompoundKey, EntityResponse<Message>> entityResponse = associations.batchGet(getAssociateResourceMockDB(associations).keySet()).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
    for (CompoundKey id : getAssociateResourceMockDB(associations).keySet()) {
        Assert.assertTrue(entityResponse.containsKey(id));
        EntityResponse<Message> single = entityResponse.get(id);
        Assert.assertEquals(single.getEntity(), getAssociateResourceMockDB(associations).get(id));
    }
}
Also used : Message(com.linkedin.restli.examples.greetings.api.Message) CompoundKey(com.linkedin.restli.common.CompoundKey) EntityResponse(com.linkedin.restli.common.EntityResponse) IdEntityResponse(com.linkedin.restli.common.IdEntityResponse) Associations(com.linkedin.restli.examples.greetings.client.Associations) AssociationsAssociationsFluentClient(com.linkedin.restli.examples.greetings.client.AssociationsAssociationsFluentClient) AssociationsFluentClient(com.linkedin.restli.examples.greetings.client.AssociationsFluentClient) Test(org.testng.annotations.Test)

Aggregations

AssociationsAssociationsFluentClient (com.linkedin.restli.examples.greetings.client.AssociationsAssociationsFluentClient)8 AssociationsFluentClient (com.linkedin.restli.examples.greetings.client.AssociationsFluentClient)8 Test (org.testng.annotations.Test)8 Message (com.linkedin.restli.examples.greetings.api.Message)6 CompoundKey (com.linkedin.restli.common.CompoundKey)5 Associations (com.linkedin.restli.examples.greetings.client.Associations)5 ComplexResourceKey (com.linkedin.restli.common.ComplexResourceKey)2 UpdateStatus (com.linkedin.restli.common.UpdateStatus)2 TwoPartKey (com.linkedin.restli.examples.greetings.api.TwoPartKey)2 AssociationAltKey (com.linkedin.restli.examples.greetings.client.AssociationAltKey)2 AssociationsAssociationsSubFluentClient (com.linkedin.restli.examples.greetings.client.AssociationsAssociationsSubFluentClient)2 EntityResponse (com.linkedin.restli.common.EntityResponse)1 IdEntityResponse (com.linkedin.restli.common.IdEntityResponse)1 PatchRequest (com.linkedin.restli.common.PatchRequest)1 MessageCriteria (com.linkedin.restli.examples.greetings.api.MessageCriteria)1 MessageCriteriaArray (com.linkedin.restli.examples.greetings.api.MessageCriteriaArray)1 AssociationsSubFluentClient (com.linkedin.restli.examples.greetings.client.AssociationsSubFluentClient)1 HashMap (java.util.HashMap)1