Search in sources :

Example 1 with SpringmvcAddBodyV1

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

the class TestSpringmvc method addBody.

@Test
public void addBody() {
    SwaggerProducer swaggerProducer = new SwaggerEnvironment().createProducer(new SpringmvcAddBodyV1(), null);
    ProducerArgumentsMapper mapper = swaggerProducer.findOperation("add").getArgumentsMapper();
    AddWrapperV1 addBody = new AddWrapperV1();
    Map<String, Object> arguments = new HashMap<>();
    arguments.put("addBody", addBody);
    SwaggerInvocation invocation = new SwaggerInvocation();
    Map<String, Object> result = mapper.swaggerArgumentToInvocationArguments(invocation, arguments);
    Assert.assertEquals(1, result.size());
    Assert.assertSame(addBody, result.get("addBody"));
}
Also used : SpringmvcAddWrapperV1(org.apache.servicecomb.swagger.invocation.schemas.SpringmvcAddWrapperV1) AddWrapperV1(org.apache.servicecomb.swagger.invocation.schemas.models.AddWrapperV1) SwaggerInvocation(org.apache.servicecomb.swagger.invocation.SwaggerInvocation) SwaggerProducer(org.apache.servicecomb.swagger.engine.SwaggerProducer) HashMap(java.util.HashMap) SpringmvcAddBodyV1(org.apache.servicecomb.swagger.invocation.schemas.SpringmvcAddBodyV1) SwaggerEnvironment(org.apache.servicecomb.swagger.engine.SwaggerEnvironment) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 SwaggerEnvironment (org.apache.servicecomb.swagger.engine.SwaggerEnvironment)1 SwaggerProducer (org.apache.servicecomb.swagger.engine.SwaggerProducer)1 SwaggerInvocation (org.apache.servicecomb.swagger.invocation.SwaggerInvocation)1 SpringmvcAddBodyV1 (org.apache.servicecomb.swagger.invocation.schemas.SpringmvcAddBodyV1)1 SpringmvcAddWrapperV1 (org.apache.servicecomb.swagger.invocation.schemas.SpringmvcAddWrapperV1)1 AddWrapperV1 (org.apache.servicecomb.swagger.invocation.schemas.models.AddWrapperV1)1 Test (org.junit.Test)1