Search in sources :

Example 1 with PojoAddBodyV1

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

the class TestPojo method addBody.

@Test
public void addBody() {
    SwaggerProducer swaggerProducer = new SwaggerEnvironment().createProducer(new PojoAddBodyV1(), 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(1, result.size());
    Assert.assertSame(addBody, result.get("addBody"));
}
Also used : SwaggerInvocation(org.apache.servicecomb.swagger.invocation.SwaggerInvocation) SwaggerProducer(org.apache.servicecomb.swagger.engine.SwaggerProducer) HashMap(java.util.HashMap) PojoAddBodyV1(org.apache.servicecomb.swagger.invocation.schemas.PojoAddBodyV1) SwaggerEnvironment(org.apache.servicecomb.swagger.engine.SwaggerEnvironment) Test(org.junit.Test)

Example 2 with PojoAddBodyV1

use of org.apache.servicecomb.swagger.invocation.schemas.PojoAddBodyV1 in project incubator-servicecomb-java-chassis by apache.

the class TestPojo method addBody.

@Test
public void addBody() {
    SwaggerProducer swaggerProducer = new SwaggerEnvironment().createProducer(new PojoAddBodyV1(), 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(1, result.size());
    Assert.assertSame(addBody, result.get("addBody"));
}
Also used : SwaggerInvocation(org.apache.servicecomb.swagger.invocation.SwaggerInvocation) SwaggerProducer(org.apache.servicecomb.swagger.engine.SwaggerProducer) HashMap(java.util.HashMap) PojoAddBodyV1(org.apache.servicecomb.swagger.invocation.schemas.PojoAddBodyV1) SwaggerEnvironment(org.apache.servicecomb.swagger.engine.SwaggerEnvironment) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)2 SwaggerEnvironment (org.apache.servicecomb.swagger.engine.SwaggerEnvironment)2 SwaggerProducer (org.apache.servicecomb.swagger.engine.SwaggerProducer)2 SwaggerInvocation (org.apache.servicecomb.swagger.invocation.SwaggerInvocation)2 PojoAddBodyV1 (org.apache.servicecomb.swagger.invocation.schemas.PojoAddBodyV1)2 Test (org.junit.Test)2