use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPIV2Test method validateRules.
@Override
protected void validateRules(SwaggerApiEntity api, String path, int expectedRuleSize, List<HttpMethod> firstRuleMethods, String firstRuleDescription) {
List<Flow> flows = api.getFlows().stream().filter(flow1 -> flow1.getPath().equals(path)).collect(Collectors.toList());
// assertEquals(1, flows.size());
assertEquals(expectedRuleSize, flows.get(0).getPre().size());
assertTrue(flows.get(0).getMethods().containsAll(firstRuleMethods));
Step step = flows.get(0).getPre().get(0);
assertNotNull(step);
assertEquals(firstRuleDescription, step.getDescription());
}
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_yaml_extensions.
@Test
public void shouldPrepareAPIFromSwaggerV2_URL_yaml_extensions() throws IOException {
final SwaggerApiEntity swaggerApiEntity = prepareUrl("io/gravitee/rest/api/management/service/swagger-withExtensions-v2.yaml");
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 shouldPrepareAPIFromSwaggerV3_URL_json_extensions.
@Test
public void shouldPrepareAPIFromSwaggerV3_URL_json_extensions() throws IOException {
final SwaggerApiEntity swaggerApiEntity = prepareUrl("io/gravitee/rest/api/management/service/openapi-withExtensions.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 shouldPrepareAPIFromSwaggerV3WithPetstore.
@Test
public void shouldPrepareAPIFromSwaggerV3WithPetstore() throws IOException {
final SwaggerApiEntity api = prepareInline("io/gravitee/rest/api/management/service/mock/petstore.yaml", true, true);
assertEquals("1.0.0", api.getVersion());
assertEquals("/v1", api.getProxy().getVirtualHosts().get(0).getPath());
assertEquals("Swagger Petstore", api.getName());
assertEquals("http://petstore.swagger.io/v1", api.getProxy().getGroups().iterator().next().getEndpoints().iterator().next().getTarget());
validatePolicies(api, 2, 3, asList("/pets", "/pets/:petId"));
}
use of io.gravitee.rest.api.model.api.SwaggerApiEntity in project gravitee-management-rest-api by gravitee-io.
the class SwaggerService_CreateAPITest method shouldPrepareAPIFromSwaggerV3_URL_yaml_extensions.
@Test
public void shouldPrepareAPIFromSwaggerV3_URL_yaml_extensions() throws IOException {
final SwaggerApiEntity swaggerApiEntity = prepareUrl("io/gravitee/rest/api/management/service/openapi-withExtensions.yaml");
validate(swaggerApiEntity);
validateExtensions(swaggerApiEntity);
}
Aggregations