Search in sources :

Example 1 with Associations

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

the class TestParseqBasedFluentClientApi method testAssociateResourceGet.

@Test
public void testAssociateResourceGet() throws Exception {
    Associations associations = new AssociationsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
    Message response = associations.get(getAssociateResourceUrlKey(associations)).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
    Assert.assertTrue(response.hasId());
}
Also used : Message(com.linkedin.restli.examples.greetings.api.Message) 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 2 with Associations

use of com.linkedin.restli.examples.greetings.client.Associations 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 3 with Associations

use of com.linkedin.restli.examples.greetings.client.Associations 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 4 with Associations

use of com.linkedin.restli.examples.greetings.client.Associations 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

Associations (com.linkedin.restli.examples.greetings.client.Associations)4 AssociationsAssociationsFluentClient (com.linkedin.restli.examples.greetings.client.AssociationsAssociationsFluentClient)4 AssociationsFluentClient (com.linkedin.restli.examples.greetings.client.AssociationsFluentClient)4 Test (org.testng.annotations.Test)4 CompoundKey (com.linkedin.restli.common.CompoundKey)3 UpdateStatus (com.linkedin.restli.common.UpdateStatus)2 Message (com.linkedin.restli.examples.greetings.api.Message)2 EntityResponse (com.linkedin.restli.common.EntityResponse)1 IdEntityResponse (com.linkedin.restli.common.IdEntityResponse)1 PatchRequest (com.linkedin.restli.common.PatchRequest)1 HashMap (java.util.HashMap)1