Search in sources :

Example 1 with AddBeanParamV1

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

the class TestJaxrs method addBeanParam.

@Test
public void addBeanParam() {
    SwaggerProducer swaggerProducer = new SwaggerEnvironment().createProducer(new JaxrsAddBeanParamV1(), null);
    ProducerArgumentsMapper mapper = swaggerProducer.findOperation("add").getArgumentsMapper();
    Map<String, Object> arguments = new HashMap<>();
    arguments.put("x", 1);
    arguments.put("y", 2);
    SwaggerInvocation invocation = new SwaggerInvocation();
    Map<String, Object> result = mapper.swaggerArgumentToInvocationArguments(invocation, arguments);
    Assert.assertEquals(1, result.size());
    AddBeanParamV1 paramV1 = (AddBeanParamV1) result.get("wrapper");
    Assert.assertEquals(1, paramV1.getX());
    Assert.assertEquals(2, paramV1.y);
}
Also used : SwaggerInvocation(org.apache.servicecomb.swagger.invocation.SwaggerInvocation) JaxrsAddBeanParamV1(org.apache.servicecomb.swagger.invocation.schemas.JaxrsAddBeanParamV1) SwaggerProducer(org.apache.servicecomb.swagger.engine.SwaggerProducer) HashMap(java.util.HashMap) JaxrsAddBeanParamV1(org.apache.servicecomb.swagger.invocation.schemas.JaxrsAddBeanParamV1) AddBeanParamV1(org.apache.servicecomb.swagger.invocation.schemas.models.AddBeanParamV1) 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 JaxrsAddBeanParamV1 (org.apache.servicecomb.swagger.invocation.schemas.JaxrsAddBeanParamV1)1 AddBeanParamV1 (org.apache.servicecomb.swagger.invocation.schemas.models.AddBeanParamV1)1 Test (org.junit.Test)1