use of com.linkedin.restli.examples.greetings.client.ManualProjections in project rest.li by linkedin.
the class TestParseqBasedFluentClientApiWithProjections method testGetWithProjectionDisabled.
// Test using optional parameter that disables projection
@Test
public void testGetWithProjectionDisabled() throws Exception {
ManualProjections projections = new ManualProjectionsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
CompletionStage<Greeting> result = projections.get(1L, optionalParams -> optionalParams.withMask(mask -> mask.withMessage()).setIgnoreProjection(true));
CompletableFuture<Greeting> future = result.toCompletableFuture();
Greeting greeting = future.get(5000, TimeUnit.MILLISECONDS);
// these fields would have been excluded by the framework if automatic projection was enabled
Assert.assertTrue(greeting.hasId());
Assert.assertTrue(greeting.hasTone());
}
use of com.linkedin.restli.examples.greetings.client.ManualProjections in project rest.li by linkedin.
the class TestParseqBasedFluentClientApiWithProjections method testGetWithProjection.
// Test Get request with simple projection
@Test
public void testGetWithProjection() throws Exception {
ManualProjections projections = new ManualProjectionsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
CompletionStage<Greeting> result = projections.get(1L, optionalParams -> optionalParams.withMask(mask -> mask.withMessage()));
CompletableFuture<Greeting> future = result.toCompletableFuture();
Greeting greeting = future.get(5000, TimeUnit.MILLISECONDS);
Assert.assertFalse(greeting.hasId());
Assert.assertFalse(greeting.hasTone());
Assert.assertTrue(greeting.hasMessage());
}
use of com.linkedin.restli.examples.greetings.client.ManualProjections in project rest.li by linkedin.
the class TestParseqBasedFluentClientApiWithProjections method testGetFull.
// Test Get request without projection
@Test
public void testGetFull() throws Exception {
ManualProjections projections = new ManualProjectionsFluentClient(_parSeqRestliClient, _parSeqUnitTestHelper.getEngine());
CompletionStage<Greeting> result = projections.get(1L);
CompletableFuture<Greeting> future = result.toCompletableFuture();
Greeting greeting = future.get(5000, TimeUnit.MILLISECONDS);
Assert.assertTrue(greeting.hasId());
Assert.assertTrue(greeting.hasTone());
Assert.assertTrue(greeting.hasMessage());
}
Aggregations