Search in sources :

Example 16 with ParSeqRestliClientConfigBuilder

use of com.linkedin.restli.client.ParSeqRestliClientConfigBuilder in project parseq by linkedin.

the class TestRequestConfigProvider method testNoMatchInTheMiddleOfHierarchy.

/**
 * Default values are specified only at the top of the config hierarchy.
 * It means that when RequestConfigTree is traversing configuration it is
 * not guaranteed that it will return a full Optional for parameter Optional.empty.
 * It is guaranteed only at the root level.
 * This unit test tests case when while traversing configuration tree there is no match
 * in the middle of the hierarchy. More specifically, the outbound name will match but then
 * operation name will not match: config tree contains only entry for DELETE but test is
 * trying to find entry for GET.
 */
@Test
public void testNoMatchInTheMiddleOfHierarchy() throws RequestConfigKeyParsingException {
    ParSeqRestliClientConfigBuilder configBuilder = new ParSeqRestliClientConfigBuilder();
    configBuilder.addTimeoutMs("*.*/greetings.DELETE", 1000L);
    RequestConfigProvider provider = RequestConfigProvider.build(configBuilder.build(), () -> Optional.empty());
    RequestConfig rc = provider.apply(new GreetingsBuilders().get().id(0L).build());
    assertNotNull(rc);
    assertEquals(rc.getTimeoutMs().getValue(), Long.valueOf(RequestConfigProviderImpl.DEFAULT_TIMEOUT));
    assertEquals(rc.isBatchingEnabled().getValue(), RequestConfigProviderImpl.DEFAULT_BATCHING_ENABLED);
    assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(RequestConfigProviderImpl.DEFAULT_MAX_BATCH_SIZE));
}
Also used : ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) GreetingsBuilders(com.linkedin.restli.examples.greetings.client.GreetingsBuilders) Test(org.testng.annotations.Test)

Example 17 with ParSeqRestliClientConfigBuilder

use of com.linkedin.restli.client.ParSeqRestliClientConfigBuilder in project rest.li by linkedin.

the class TestParseqBasedFluentClientApi method setUp.

@BeforeClass
void setUp() throws Exception {
    super.init();
    _parSeqUnitTestHelper = new ParSeqUnitTestHelper();
    _parSeqUnitTestHelper.setUp();
    _parSeqRestliClient = new ParSeqRestliClientBuilder().setClient(getClient()).setConfig(new ParSeqRestliClientConfigBuilder().build()).build();
}
Also used : ParSeqUnitTestHelper(com.linkedin.parseq.ParSeqUnitTestHelper) ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) ParSeqRestliClientBuilder(com.linkedin.restli.client.ParSeqRestliClientBuilder) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

ParSeqRestliClientConfigBuilder (com.linkedin.restli.client.ParSeqRestliClientConfigBuilder)17 Test (org.testng.annotations.Test)14 GreetingsBuilders (com.linkedin.restli.examples.greetings.client.GreetingsBuilders)12 AssociationsSubBuilders (com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders)5 ParSeqUnitTestHelper (com.linkedin.parseq.ParSeqUnitTestHelper)3 ParSeqRestliClientBuilder (com.linkedin.restli.client.ParSeqRestliClientBuilder)3 BeforeClass (org.testng.annotations.BeforeClass)3 RestLiValidationFilter (com.linkedin.restli.server.validation.RestLiValidationFilter)2 Task (com.linkedin.parseq.Task)1 BatchingSupport (com.linkedin.parseq.batching.BatchingSupport)1 Trace (com.linkedin.parseq.trace.Trace)1 ExecutionGroup (com.linkedin.restli.client.ExecutionGroup)1 ParSeqBasedCompletionStage (com.linkedin.restli.client.ParSeqBasedCompletionStage)1 ParSeqRestliClient (com.linkedin.restli.client.ParSeqRestliClient)1 ParSeqRestliClientConfig (com.linkedin.restli.client.ParSeqRestliClientConfig)1 Greeting (com.linkedin.restli.examples.greetings.api.Greeting)1 GreetingsFluentClient (com.linkedin.restli.examples.greetings.client.GreetingsFluentClient)1 GroupsBuilders (com.linkedin.restli.examples.groups.client.GroupsBuilders)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1