use of com.linkedin.restli.client.Request in project rest.li by linkedin.
the class TestCustomDocumentationHandler method testOptionsJson.
@Test
public void testOptionsJson() throws RemoteInvocationException {
Request<OptionsResponse> optionsRequest = new GreetingsRequestBuilders().options().addParam("format", RestLiDocumentationRenderer.DocumentationFormat.JSON.toString().toLowerCase()).build();
OptionsResponse optionsResponse = getClient().sendRequest(optionsRequest).getResponse().getEntity();
Assert.assertEquals(1, optionsResponse.getResourceSchemas().size());
Assert.assertNotNull(optionsResponse.getResourceSchemas().get("com.linkedin.restli.examples.greetings.client.greetings"));
Assert.assertEquals(optionsResponse.getDataSchemas().size(), 10);
List<String> expectedModels = new ArrayList<>(Arrays.asList("com.linkedin.restli.examples.greetings.api.Greeting", "com.linkedin.restli.examples.greetings.api.SearchMetadata", "com.linkedin.restli.examples.groups.api.TransferOwnershipRequest", "com.linkedin.restli.examples.greetings.api.Empty", "com.linkedin.restli.examples.greetings.api.Tone"));
List<String> expectedCustomModels = expectedModels.stream().map(name -> name + CUSTOM_SUFFIX).collect(Collectors.toList());
expectedModels.addAll(expectedCustomModels);
Assert.assertTrue(optionsResponse.getDataSchemas().keySet().containsAll(expectedModels));
for (String schema : expectedModels) {
NamedDataSchema dataSchema = (NamedDataSchema) optionsResponse.getDataSchemas().get(schema);
Assert.assertEquals(dataSchema.getFullName(), schema);
}
}
Aggregations