use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method shouldPrepareAPIFromSwaggerV2_URL_json_extensions.
@Test
public void shouldPrepareAPIFromSwaggerV2_URL_json_extensions() throws IOException {
final SwaggerApiEntity swaggerApiEntity = prepareUrl("io/gravitee/rest/api/management/service/swagger-withExtensions-v2.json");
validate(swaggerApiEntity);
validateExtensions(swaggerApiEntity);
}
use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method shouldPrepareAPIFromSwaggerV3WithEnumExample.
@Test
public void shouldPrepareAPIFromSwaggerV3WithEnumExample() throws IOException {
final SwaggerApiEntity api = prepareInline("io/gravitee/rest/api/management/service/mock/enum-example.yml", true, true);
assertEquals("v1", api.getVersion());
assertEquals("Gravitee Import Mock Example", api.getName());
assertEquals("graviteeimportmockexample", 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("/"));
validatePolicies(api, 1, 1, asList("/"));
}
use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method shouldPrepareAPIFromSwaggerV3WithComplexReferences.
@Test
public void shouldPrepareAPIFromSwaggerV3WithComplexReferences() throws IOException {
final SwaggerApiEntity api = prepareInline("io/gravitee/rest/api/management/service/mock/json-api.yml", true, true);
validatePolicies(api, 2, 5, asList("/drives"));
}
use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method shouldPrepareAPIFromSwaggerV3WithExamples.
@Test
public void shouldPrepareAPIFromSwaggerV3WithExamples() throws IOException {
final SwaggerApiEntity api = prepareInline("io/gravitee/rest/api/management/service/mock/api-with-examples.yaml", true, true);
assertEquals("2.0.0", api.getVersion());
assertEquals("Simple API overview", api.getName());
assertEquals("simpleapioverview", api.getProxy().getVirtualHosts().get(0).getPath());
assertEquals("/", api.getProxy().getGroups().iterator().next().getEndpoints().iterator().next().getTarget());
validatePolicies(api, 2, 2, asList("/", "/v2"));
validateRules(api, "/", 2, asList(HttpMethod.GET), "List API versions");
}
use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method shouldPrepareAPIFromSwaggerV3WithSimpleTypedExamples.
@Test
public void shouldPrepareAPIFromSwaggerV3WithSimpleTypedExamples() throws IOException {
final SwaggerApiEntity api = prepareInline("io/gravitee/rest/api/management/service/mock/callback-example.yaml", true, true);
assertEquals("1.0.0", api.getVersion());
assertEquals("Callback Example", api.getName());
assertEquals("callbackexample", api.getProxy().getVirtualHosts().get(0).getPath());
assertEquals("/", api.getProxy().getGroups().iterator().next().getEndpoints().iterator().next().getTarget());
validatePolicies(api, 1, 1, asList("/streams"));
validateRules(api, "/streams", 2, asList(HttpMethod.POST), "subscribes a client to receive out-of-band data");
}
Aggregations