Search in sources :

Example 1 with AssociationsSubBuilders

use of com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders in project parseq by linkedin.

the class TestRequestConfigProvider method testOutboundName.

@Test
public void testOutboundName() throws RequestConfigKeyParsingException {
    ParSeqRestliClientConfigBuilder configBuilder = new ParSeqRestliClientConfigBuilder();
    configBuilder.addTimeoutMs("*.*/greetings.*", 1000L);
    configBuilder.addTimeoutMs("*.*/associations:foo.*", 1001L);
    configBuilder.addTimeoutMs("*.*/associations.*", 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(1000L));
    assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(false));
    assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(1024));
    rc = provider.apply(new GroupsBuilders().get().id(10).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(1000L));
    assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(false));
    assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(1024));
}
Also used : ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) GreetingsBuilders(com.linkedin.restli.examples.greetings.client.GreetingsBuilders) GroupsBuilders(com.linkedin.restli.examples.groups.client.GroupsBuilders) AssociationsSubBuilders(com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders) Test(org.testng.annotations.Test)

Example 2 with AssociationsSubBuilders

use of com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders in project parseq by linkedin.

the class TestRequestConfigProvider method testOutboundOp.

@Test
public void testOutboundOp() throws RequestConfigKeyParsingException {
    ParSeqRestliClientConfigBuilder configBuilder = new ParSeqRestliClientConfigBuilder();
    configBuilder.addTimeoutMs("*.*/*.GET", 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(1000L));
    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(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(1000L));
    assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(false));
    assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(1024));
}
Also used : ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) GreetingsBuilders(com.linkedin.restli.examples.greetings.client.GreetingsBuilders) AssociationsSubBuilders(com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders) Test(org.testng.annotations.Test)

Example 3 with AssociationsSubBuilders

use of com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders in project parseq by linkedin.

the class TestRequestConfigProvider method testFromEmptyMapOverrideDefault.

@Test
public void testFromEmptyMapOverrideDefault() throws RequestConfigKeyParsingException {
    ParSeqRestliClientConfigBuilder configBuilder = new ParSeqRestliClientConfigBuilder();
    configBuilder.addTimeoutMs("*.*/*.*", 1000L);
    configBuilder.addMaxBatchSize("*.*/*.*", 4096);
    configBuilder.addBatchingEnabled("*.*/*.*", true);
    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(1000L));
    assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(true));
    assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(4096));
    rc = provider.apply(new AssociationsSubBuilders().get().srcKey("a").destKey("b").id("x").build());
    assertNotNull(rc);
    assertEquals(rc.getTimeoutMs().getValue(), Long.valueOf(1000L));
    assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(true));
    assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(4096));
}
Also used : ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) GreetingsBuilders(com.linkedin.restli.examples.greetings.client.GreetingsBuilders) AssociationsSubBuilders(com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders) Test(org.testng.annotations.Test)

Example 4 with AssociationsSubBuilders

use of com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders 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));
}
Also used : ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) GreetingsBuilders(com.linkedin.restli.examples.greetings.client.GreetingsBuilders) AssociationsSubBuilders(com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders) Test(org.testng.annotations.Test)

Example 5 with AssociationsSubBuilders

use of com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders in project parseq by linkedin.

the class TestRequestConfigProvider method testPrioritiesOutboundNameSubResource.

@Test
public void testPrioritiesOutboundNameSubResource() throws RequestConfigKeyParsingException {
    ParSeqRestliClientConfigBuilder configBuilder = new ParSeqRestliClientConfigBuilder();
    configBuilder.addTimeoutMs("*.*/associations:foo.*", 1000L);
    configBuilder.addTimeoutMs("*.*/associations.*", 1001L);
    configBuilder.addTimeoutMs("*.*/associations:associationsSub.*", 1002L);
    RequestConfigProvider provider = RequestConfigProvider.build(configBuilder.build(), () -> Optional.empty());
    RequestConfig rc = provider.apply(new AssociationsSubBuilders().get().srcKey("a").destKey("b").id("x").build());
    assertNotNull(rc);
    assertEquals(rc.getTimeoutMs().getValue(), Long.valueOf(1002L));
    assertEquals(rc.isBatchingEnabled().getValue(), Boolean.valueOf(false));
    assertEquals(rc.getMaxBatchSize().getValue(), Integer.valueOf(1024));
}
Also used : ParSeqRestliClientConfigBuilder(com.linkedin.restli.client.ParSeqRestliClientConfigBuilder) AssociationsSubBuilders(com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders) Test(org.testng.annotations.Test)

Aggregations

ParSeqRestliClientConfigBuilder (com.linkedin.restli.client.ParSeqRestliClientConfigBuilder)5 AssociationsSubBuilders (com.linkedin.restli.examples.greetings.client.AssociationsSubBuilders)5 Test (org.testng.annotations.Test)5 GreetingsBuilders (com.linkedin.restli.examples.greetings.client.GreetingsBuilders)4 GroupsBuilders (com.linkedin.restli.examples.groups.client.GroupsBuilders)1