use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method shouldPrepareAPIFromSwaggerV3WithNoServer.
@Test
public void shouldPrepareAPIFromSwaggerV3WithNoServer() throws IOException {
final SwaggerApiEntity api = prepareInline("io/gravitee/rest/api/management/service/mock/openapi-noserver.yaml", true);
assertEquals("noserver", api.getProxy().getVirtualHosts().get(0).getPath());
final List<String> endpoints = api.getProxy().getGroups().iterator().next().getEndpoints().stream().map(Endpoint::getTarget).collect(Collectors.toList());
assertEquals(1, endpoints.size());
assertTrue(endpoints.contains("/"));
}
use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method shouldPrepareAPIFromSwaggerV3WithExample.
@Test
public void shouldPrepareAPIFromSwaggerV3WithExample() throws IOException {
final SwaggerApiEntity api = prepareInline("io/gravitee/rest/api/management/service/mock/uspto.yaml", true, true);
assertEquals("1.0.0", api.getVersion());
assertEquals("USPTO Data Set API", api.getName());
assertEquals("/ds-api", api.getProxy().getVirtualHosts().get(0).getPath());
final List<String> endpoints = api.getProxy().getGroups().iterator().next().getEndpoints().stream().map(Endpoint::getTarget).collect(Collectors.toList());
assertEquals(2, 4, endpoints.size());
assertTrue(endpoints.contains("http://developer.uspto.gov/ds-api"));
assertTrue(endpoints.contains("https://developer.uspto.gov/ds-api"));
validatePolicies(api, 3, 3, asList("/", "/:dataset/:version/fields", "/:dataset/:version/records"));
}
use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method shouldPrepareAPIFromSwaggerV3WithLinks.
@Test
public void shouldPrepareAPIFromSwaggerV3WithLinks() throws IOException {
final SwaggerApiEntity api = prepareInline("io/gravitee/rest/api/management/service/mock/link-example.yaml", true, true);
assertEquals("1.0.0", api.getVersion());
assertEquals("Link Example", api.getName());
assertEquals("linkexample", api.getProxy().getVirtualHosts().get(0).getPath());
assertEquals("/", api.getProxy().getGroups().iterator().next().getEndpoints().iterator().next().getTarget());
validatePolicies(api, 6, 6, asList("/2.0/users/:username", "/2.0/repositories/:username/:slug", "/2.0/repositories/:username/:slug/pullrequests", "/2.0/repositories/:username/:slug/pullrequests/:pid", "/2.0/repositories/:username/:slug/pullrequests/:pid/merge"));
}
use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method shouldPrepareAPIFromSwaggerV3WithVariablesInServer.
@Test
public void shouldPrepareAPIFromSwaggerV3WithVariablesInServer() throws IOException {
final SwaggerApiEntity api = prepareInline("io/gravitee/rest/api/management/service/mock/openapi-variables-in-server.yaml", true);
assertEquals("/v2", api.getProxy().getVirtualHosts().get(0).getPath());
final List<String> endpoints = api.getProxy().getGroups().iterator().next().getEndpoints().stream().map(Endpoint::getTarget).collect(Collectors.toList());
assertEquals(2, endpoints.size());
assertTrue(endpoints.contains("https://demo.gigantic-server.com:443/v2"));
assertTrue(endpoints.contains("https://demo.gigantic-server.com:8443/v2"));
}
Aggregations