Search in sources :

Example 16 with AddWrapperV2

use of org.apache.servicecomb.swagger.invocation.schemas.models.AddWrapperV2 in project java-chassis by ServiceComb.

the class TestSpringmvcV2V2 method addBody_addBody.

@Test
public void addBody_addBody() {
    SwaggerEnvironment environment = new SwaggerEnvironment();
    Swagger swagger = SwaggerGenerator.generate(SpringmvcAddBodyV2.class);
    SwaggerConsumer swaggerConsumer = environment.createConsumer(ConsumerAddBodyV2.class, swagger);
    ArgumentsMapper mapper = swaggerConsumer.findOperation("add").getArgumentsMapper();
    Map<String, Object> arguments = new HashMap<>();
    arguments.put("addBody", new AddWrapperV2(1, 2, 3));
    SwaggerInvocation invocation = new SwaggerInvocation();
    Map<String, Object> result = mapper.invocationArgumentToSwaggerArguments(invocation, arguments);
    Assert.assertSame(result.get("addBody"), arguments.get("addBody"));
}
Also used : SwaggerInvocation(org.apache.servicecomb.swagger.invocation.SwaggerInvocation) SpringmvcAddWrapperV2(org.apache.servicecomb.swagger.invocation.schemas.SpringmvcAddWrapperV2) AddWrapperV2(org.apache.servicecomb.swagger.invocation.schemas.models.AddWrapperV2) SwaggerConsumer(org.apache.servicecomb.swagger.engine.SwaggerConsumer) HashMap(java.util.HashMap) Swagger(io.swagger.models.Swagger) SwaggerEnvironment(org.apache.servicecomb.swagger.engine.SwaggerEnvironment) ArgumentsMapper(org.apache.servicecomb.swagger.invocation.arguments.ArgumentsMapper) Test(org.junit.Test)

Aggregations

Swagger (io.swagger.models.Swagger)16 HashMap (java.util.HashMap)16 SwaggerConsumer (org.apache.servicecomb.swagger.engine.SwaggerConsumer)16 SwaggerEnvironment (org.apache.servicecomb.swagger.engine.SwaggerEnvironment)16 SwaggerInvocation (org.apache.servicecomb.swagger.invocation.SwaggerInvocation)16 ArgumentsMapper (org.apache.servicecomb.swagger.invocation.arguments.ArgumentsMapper)16 AddWrapperV2 (org.apache.servicecomb.swagger.invocation.schemas.models.AddWrapperV2)16 Test (org.junit.Test)16 LinkedHashMap (java.util.LinkedHashMap)5 SpringmvcAddWrapperV2 (org.apache.servicecomb.swagger.invocation.schemas.SpringmvcAddWrapperV2)3