Search in sources :

Example 1 with Actions

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

the class TestParseqBasedFluentClientApi method testActionSetActionWithTypeRef.

@Test
public void testActionSetActionWithTypeRef() throws Exception {
    // This end point use typeref for both ActionParam and Action methods' return value
    Actions actionsFluentClient = new ActionsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
    Assert.assertEquals(actionsFluentClient.customTypeRef(new CustomLong(500L)).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS), new CustomLong(500L));
}
Also used : ActionsFluentClient(com.linkedin.restli.examples.greetings.client.ActionsFluentClient) Actions(com.linkedin.restli.examples.greetings.client.Actions) CustomLong(com.linkedin.restli.examples.custom.types.CustomLong) Test(org.testng.annotations.Test)

Example 2 with Actions

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

the class TestParseqBasedFluentClientApi method testActionSetActionWithReturn.

@Test
public void testActionSetActionWithReturn() throws Exception {
    Actions actionsFluentClient = new ActionsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
    Assert.assertTrue(actionsFluentClient.ultimateAnswer().toCompletableFuture().get(5000, TimeUnit.MILLISECONDS) == 42);
}
Also used : ActionsFluentClient(com.linkedin.restli.examples.greetings.client.ActionsFluentClient) Actions(com.linkedin.restli.examples.greetings.client.Actions) Test(org.testng.annotations.Test)

Example 3 with Actions

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

the class TestParseqBasedFluentClientApi method testActionSetActionWithNoReturn.

@Test
public void testActionSetActionWithNoReturn() throws Exception {
    Actions actionsFluentClient = new ActionsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
    Assert.assertNull(actionsFluentClient.returnVoid().toCompletableFuture().get(5000, TimeUnit.MILLISECONDS));
}
Also used : ActionsFluentClient(com.linkedin.restli.examples.greetings.client.ActionsFluentClient) Actions(com.linkedin.restli.examples.greetings.client.Actions) Test(org.testng.annotations.Test)

Example 4 with Actions

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

the class TestParseqBasedFluentClientApi method testCollectionEntityActionWithReturn.

// ----- Tests with actions ------
@Test
public void testCollectionEntityActionWithReturn() throws Exception {
    Greetings greetings = new GreetingsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
    Greeting newGreeting;
    newGreeting = greetings.updateTone(1L, param -> param.setNewTone(Tone.SINCERE).setDelOld(false)).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
    Assert.assertNotNull(newGreeting);
    Assert.assertEquals(newGreeting.getId().longValue(), 1L);
    Assert.assertEquals(newGreeting.getTone(), Tone.SINCERE);
    newGreeting = greetings.updateTone(1L, param -> param.setNewTone(Tone.INSULTING)).toCompletableFuture().get(5000, TimeUnit.MILLISECONDS);
    Assert.assertNotNull(newGreeting);
    Assert.assertEquals(newGreeting.getId().longValue(), 1L);
    Assert.assertEquals(newGreeting.getTone(), Tone.INSULTING);
}
Also used : ComplexKeysSubFluentClient(com.linkedin.restli.examples.greetings.client.ComplexKeysSubFluentClient) Arrays(java.util.Arrays) CollectionResponse(com.linkedin.restli.common.CollectionResponse) Date(java.util.Date) UpdateStatus(com.linkedin.restli.common.UpdateStatus) Test(org.testng.annotations.Test) AssociationsSubFluentClient(com.linkedin.restli.examples.greetings.client.AssociationsSubFluentClient) GreetingFluentClient(com.linkedin.restli.examples.greetings.client.GreetingFluentClient) AssociationsAssociationsSubFluentClient(com.linkedin.restli.examples.greetings.client.AssociationsAssociationsSubFluentClient) TransferOwnershipRequest(com.linkedin.restli.examples.groups.api.TransferOwnershipRequest) Groups(com.linkedin.restli.examples.groups.client.Groups) PatchGenerator(com.linkedin.restli.client.util.PatchGenerator) EntityResponse(com.linkedin.restli.common.EntityResponse) Map(java.util.Map) CreateIdEntityStatus(com.linkedin.restli.common.CreateIdEntityStatus) CustomLong(com.linkedin.restli.examples.custom.types.CustomLong) CreateIdStatus(com.linkedin.restli.common.CreateIdStatus) BatchfindersFluentClient(com.linkedin.restli.examples.greetings.client.BatchfindersFluentClient) AssociationAltKey(com.linkedin.restli.examples.greetings.client.AssociationAltKey) MessageCriteriaArray(com.linkedin.restli.examples.greetings.api.MessageCriteriaArray) ComplexResourceKey(com.linkedin.restli.common.ComplexResourceKey) Greetings(com.linkedin.restli.examples.greetings.client.Greetings) BeforeClass(org.testng.annotations.BeforeClass) Set(java.util.Set) Collectors(java.util.stream.Collectors) Associations(com.linkedin.restli.examples.greetings.client.Associations) GroupsFluentClient(com.linkedin.restli.examples.groups.client.GroupsFluentClient) ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) List(java.util.List) CompletionStage(java.util.concurrent.CompletionStage) ParSeqRestliClientBuilder(com.linkedin.restli.client.ParSeqRestliClientBuilder) Actions(com.linkedin.restli.examples.greetings.client.Actions) CreateGreeting(com.linkedin.restli.examples.greetings.client.CreateGreeting) SubgreetingsFluentClient(com.linkedin.restli.examples.greetings.client.SubgreetingsFluentClient) ComplexKeys(com.linkedin.restli.examples.greetings.client.ComplexKeys) TwoPartKey(com.linkedin.restli.examples.greetings.api.TwoPartKey) AssociationsAssociationsFluentClient(com.linkedin.restli.examples.greetings.client.AssociationsAssociationsFluentClient) MessageCriteria(com.linkedin.restli.examples.greetings.api.MessageCriteria) AssociationsFluentClient(com.linkedin.restli.examples.greetings.client.AssociationsFluentClient) GreetingsFluentClient(com.linkedin.restli.examples.greetings.client.GreetingsFluentClient) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) BooleanArray(com.linkedin.data.template.BooleanArray) ArrayList(java.util.ArrayList) CustomTypes2(com.linkedin.restli.examples.greetings.client.CustomTypes2) HashSet(java.util.HashSet) PatchRequest(com.linkedin.restli.common.PatchRequest) CustomTypes3(com.linkedin.restli.examples.greetings.client.CustomTypes3) CustomTypes3FluentClient(com.linkedin.restli.examples.greetings.client.CustomTypes3FluentClient) CustomTypes2FluentClient(com.linkedin.restli.examples.greetings.client.CustomTypes2FluentClient) Assert(org.testng.Assert) UpdateEntityStatus(com.linkedin.restli.common.UpdateEntityStatus) StringMap(com.linkedin.data.template.StringMap) RestLiResponseException(com.linkedin.restli.client.RestLiResponseException) Greeting(com.linkedin.restli.examples.greetings.api.Greeting) ParSeqUnitTestHelper(com.linkedin.parseq.ParSeqUnitTestHelper) ComplexKeysFluentClient(com.linkedin.restli.examples.greetings.client.ComplexKeysFluentClient) Tone(com.linkedin.restli.examples.greetings.api.Tone) PartialUpdateGreetingFluentClient(com.linkedin.restli.examples.greetings.client.PartialUpdateGreetingFluentClient) IdEntityResponse(com.linkedin.restli.common.IdEntityResponse) AfterClass(org.testng.annotations.AfterClass) ActionsFluentClient(com.linkedin.restli.examples.greetings.client.ActionsFluentClient) BatchFinderCriteriaResult(com.linkedin.restli.common.BatchFinderCriteriaResult) PartialUpdateGreeting(com.linkedin.restli.examples.greetings.client.PartialUpdateGreeting) GreetingCriteria(com.linkedin.restli.examples.greetings.api.GreetingCriteria) CompoundKey(com.linkedin.restli.common.CompoundKey) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) CreateGreetingFluentClient(com.linkedin.restli.examples.greetings.client.CreateGreetingFluentClient) ParSeqRestliClient(com.linkedin.restli.client.ParSeqRestliClient) BatchCollectionResponse(com.linkedin.restli.common.BatchCollectionResponse) HttpStatus(com.linkedin.restli.common.HttpStatus) AssociationAltKeyFluentClient(com.linkedin.restli.examples.greetings.client.AssociationAltKeyFluentClient) Message(com.linkedin.restli.examples.greetings.api.Message) Batchfinders(com.linkedin.restli.examples.greetings.client.Batchfinders) Sets(org.testng.collections.Sets) CreateGreeting(com.linkedin.restli.examples.greetings.client.CreateGreeting) Greeting(com.linkedin.restli.examples.greetings.api.Greeting) PartialUpdateGreeting(com.linkedin.restli.examples.greetings.client.PartialUpdateGreeting) Greetings(com.linkedin.restli.examples.greetings.client.Greetings) GreetingsFluentClient(com.linkedin.restli.examples.greetings.client.GreetingsFluentClient) Test(org.testng.annotations.Test)

Aggregations

Actions (com.linkedin.restli.examples.greetings.client.Actions)4 ActionsFluentClient (com.linkedin.restli.examples.greetings.client.ActionsFluentClient)4 Test (org.testng.annotations.Test)4 CustomLong (com.linkedin.restli.examples.custom.types.CustomLong)2 BooleanArray (com.linkedin.data.template.BooleanArray)1 StringMap (com.linkedin.data.template.StringMap)1 ParSeqUnitTestHelper (com.linkedin.parseq.ParSeqUnitTestHelper)1 ParSeqRestliClient (com.linkedin.restli.client.ParSeqRestliClient)1 ParSeqRestliClientBuilder (com.linkedin.restli.client.ParSeqRestliClientBuilder)1 ParSeqRestliClientConfigBuilder (com.linkedin.restli.client.ParSeqRestliClientConfigBuilder)1 RestLiResponseException (com.linkedin.restli.client.RestLiResponseException)1 PatchGenerator (com.linkedin.restli.client.util.PatchGenerator)1 BatchCollectionResponse (com.linkedin.restli.common.BatchCollectionResponse)1 BatchFinderCriteriaResult (com.linkedin.restli.common.BatchFinderCriteriaResult)1 CollectionResponse (com.linkedin.restli.common.CollectionResponse)1 ComplexResourceKey (com.linkedin.restli.common.ComplexResourceKey)1 CompoundKey (com.linkedin.restli.common.CompoundKey)1 CreateIdEntityStatus (com.linkedin.restli.common.CreateIdEntityStatus)1 CreateIdStatus (com.linkedin.restli.common.CreateIdStatus)1 EntityResponse (com.linkedin.restli.common.EntityResponse)1