use of com.linkedin.restli.client.ParSeqRestliClientConfigBuilder in project parseq by linkedin.
the class TestRequestConfigProvider method testFromEmptyMap.
@Test
public void testFromEmptyMap() throws RequestConfigKeyParsingException {
RequestConfigProvider provider = RequestConfigProvider.build(new ParSeqRestliClientConfigBuilder().build(), () -> Optional.empty());
RequestConfig rc = provider.apply(new GreetingsBuilders().get().id(0L).build());
assertNotNull(rc);
assertEquals(rc.getTimeoutMs().getValue(), Long.valueOf(DEFAULT_TIMEOUT));
assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(false));
assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(1024));
rc = provider.apply(new AssociationsSubBuilders().get().srcKey("a").destKey("b").id("x").build());
assertNotNull(rc);
assertEquals(rc.getTimeoutMs().getValue(), Long.valueOf(DEFAULT_TIMEOUT));
assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(false));
assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(1024));
}
use of com.linkedin.restli.client.ParSeqRestliClientConfigBuilder in project rest.li by linkedin.
the class TestParseqBasedFluentClientApiWithProjections method setUp.
@BeforeClass
void setUp() throws Exception {
super.init(Arrays.asList(new RestLiValidationFilter()));
_parSeqUnitTestHelper = new ParSeqUnitTestHelper();
_parSeqUnitTestHelper.setUp();
_parSeqRestliClient = new ParSeqRestliClientBuilder().setClient(getClient()).setConfig(new ParSeqRestliClientConfigBuilder().build()).build();
}
use of com.linkedin.restli.client.ParSeqRestliClientConfigBuilder in project rest.li by linkedin.
the class TestParSeqBasedFluentClientApiWithExecutionGroup method setUp.
@BeforeClass
void setUp() throws Exception {
super.init(Arrays.asList(new RestLiValidationFilter()));
ParSeqRestliClientConfig config = new ParSeqRestliClientConfigBuilder().addBatchingEnabled("*.*/*.*", Boolean.TRUE).addMaxBatchSize("*.*/*.*", TEST_BATCH_SIZE).build();
BatchingSupport batchingSupport = new BatchingSupport();
_parSeqUnitTestHelper = new ParSeqUnitTestHelper(engineBuilder -> {
engineBuilder.setPlanDeactivationListener(batchingSupport);
});
_parSeqUnitTestHelper.setUp();
_parSeqRestliClient = // RestClient Registered Strategy
new ParSeqRestliClientBuilder().setBatchingSupport(batchingSupport).setClient(getClient()).setConfig(config).build();
}
use of com.linkedin.restli.client.ParSeqRestliClientConfigBuilder in project parseq by linkedin.
the class TestRequestConfigProvider method testPrioritiesWithHttpInboundAndOutboundMatch.
@Test
public void testPrioritiesWithHttpInboundAndOutboundMatch() throws RequestConfigKeyParsingException {
ParSeqRestliClientConfigBuilder configBuilder = new ParSeqRestliClientConfigBuilder();
configBuilder.addTimeoutMs("*.*/*.GET", 1000L);
configBuilder.addTimeoutMs("x.GET/*.GET", 1000L);
configBuilder.addTimeoutMs("y.GET/x1.GET", 1000L);
configBuilder.addTimeoutMs("y.GET/x2.GET", 1000L);
configBuilder.addTimeoutMs("*.GET/x.GET", 1000L);
configBuilder.addTimeoutMs("*.GET/x2.GET", 1000L);
configBuilder.addTimeoutMs("*.GET/greetings.GET", 1000L);
configBuilder.addTimeoutMs("greetings.GET/*.GET", 1000L);
configBuilder.addTimeoutMs("greetings.POST/greetings.GET", 100L);
configBuilder.addTimeoutMs("*.*/greetings.DELETE", 1000L);
configBuilder.addTimeoutMs("greetings.*/greetings.DELETE", 1000L);
configBuilder.addTimeoutMs("*.GET/greetings.DELETE", 1000L);
configBuilder.addTimeoutMs("greetings.POST/greetings.DELETE", 500L);
RequestConfigProvider provider = RequestConfigProvider.build(configBuilder.build(), requestContextFinder("greetings", "POST", Optional.empty(), Optional.empty()));
RequestConfig rc = provider.apply(new GreetingsBuilders().get().id(0L).build());
assertNotNull(rc);
assertEquals(rc.getTimeoutMs().getValue(), Long.valueOf(100L));
assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(false));
assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(1024));
rc = provider.apply(new GreetingsBuilders().delete().id(0L).build());
assertNotNull(rc);
assertEquals(rc.getTimeoutMs().getValue(), Long.valueOf(500L));
assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(false));
assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(1024));
}
use of com.linkedin.restli.client.ParSeqRestliClientConfigBuilder in project parseq by linkedin.
the class TestRequestConfigProvider method testPrioritiesWithInboundAndOutboundMatchSubresource2.
@Test
public void testPrioritiesWithInboundAndOutboundMatchSubresource2() throws RequestConfigKeyParsingException {
ParSeqRestliClientConfigBuilder configBuilder = new ParSeqRestliClientConfigBuilder();
configBuilder.addTimeoutMs("*.*/*.GET", 1000L);
configBuilder.addTimeoutMs("x.GET/*.GET", 1001L);
configBuilder.addTimeoutMs("y.GET/x1.GET", 1002L);
configBuilder.addTimeoutMs("y.GET/x2.GET", 1003L);
configBuilder.addTimeoutMs("*.GET/x.GET", 1004L);
configBuilder.addTimeoutMs("*.GET/x2.GET", 1005L);
configBuilder.addTimeoutMs("*.GET/greetings.GET", 1006L);
configBuilder.addTimeoutMs("greetings.GET/*.GET", 1007L);
configBuilder.addTimeoutMs("greetings:associationsSub.GET/greetings.GET", 1008L);
RequestConfigProvider provider = RequestConfigProvider.build(configBuilder.build(), requestContextFinder("greetings:associationsSub", ResourceMethod.GET.toString().toUpperCase(), Optional.empty(), Optional.empty()));
RequestConfig rc = provider.apply(new GreetingsBuilders().get().id(0L).build());
assertNotNull(rc);
assertEquals(rc.getTimeoutMs().getValue(), Long.valueOf(1008L));
assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(false));
assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(1024));
}
Aggregations