Search in sources :

Example 1 with PojoAddWithContextV1

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

the class TestPojo method addWithContext_add.

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