use of org.apache.servicecomb.swagger.generator.core.model.SwaggerOperation in project incubator-servicecomb-java-chassis by apache.
the class TestApiResponse method checkMulti.
@Test
public void checkMulti() {
SwaggerOperation swaggerOperation = swaggerOperations.findOperation("testMulti");
Assert.assertEquals("/testMulti", swaggerOperation.getPath());
Response response = swaggerOperation.getOperation().getResponses().get("200");
Assert.assertEquals("integer", ((ModelImpl) response.getResponseSchema()).getType());
Assert.assertEquals("int32", ((ModelImpl) response.getResponseSchema()).getFormat());
response = swaggerOperation.getOperation().getResponses().get("301");
Assert.assertEquals("string", ((ModelImpl) response.getResponseSchema()).getType());
Assert.assertNull(((ModelImpl) response.getResponseSchema()).getFormat());
}
use of org.apache.servicecomb.swagger.generator.core.model.SwaggerOperation in project incubator-servicecomb-java-chassis by apache.
the class TestOperationGenerator method noApiOperation.
@Test
public void noApiOperation() {
SwaggerOperation operation = swaggerOperations.findOperation("noApiOperation");
List<String> tags = operation.getOperation().getTags();
assertThat(tags, contains("default0", "default1"));
assertNull(operation.getOperation().getSummary());
}
use of org.apache.servicecomb.swagger.generator.core.model.SwaggerOperation in project incubator-servicecomb-java-chassis by apache.
the class TestOperationGenerator method responseThenApiOperation.
@Test
public void responseThenApiOperation() {
SwaggerOperation swaggerOperation = swaggerOperations.findOperation("responseThenApiOperation");
List<String> tags = swaggerOperation.getOperation().getTags();
assertThat(tags, contains("tag1", "tag2"));
Response response = swaggerOperation.getOperation().getResponses().get("200");
assertEquals("200 is ok............", response.getDescription());
Assert.assertNotNull(response.getHeaders().get("x-user-domain"));
Assert.assertNull(response.getHeaders().get("x-user-name"));
Assert.assertNotNull(swaggerOperation.getOperation().getVendorExtensions().get("x-class-name"));
}
use of org.apache.servicecomb.swagger.generator.core.model.SwaggerOperation in project incubator-servicecomb-java-chassis by apache.
the class ApiProcessorTest method process.
@Test
public void process() {
SwaggerOperations swaggerOperations = SwaggerOperations.generate(SwaggerTestTarget.class);
SwaggerOperation swaggerOperation = swaggerOperations.findOperation("op");
assertThat(swaggerOperation.getOperation().getTags(), contains("tag1", "tag2"));
assertThat(swaggerOperation.getSwagger().getConsumes(), Matchers.contains(MediaType.APPLICATION_JSON));
assertThat(swaggerOperation.getSwagger().getProduces(), Matchers.contains(MediaType.APPLICATION_JSON));
}
use of org.apache.servicecomb.swagger.generator.core.model.SwaggerOperation in project java-chassis by ServiceComb.
the class TestApiResponse method checkSingle.
@Test
public void checkSingle() {
SwaggerOperation swaggerOperation = swaggerOperations.findOperation("testSingle");
Assert.assertEquals("/testSingle", swaggerOperation.getPath());
Response response = swaggerOperation.getOperation().getResponses().get("200");
Assert.assertEquals("integer", ((ModelImpl) response.getResponseSchema()).getType());
Assert.assertEquals("int32", ((ModelImpl) response.getResponseSchema()).getFormat());
}
Aggregations