use of org.apache.servicecomb.swagger.invocation.schemas.models.AddWrapperV1 in project java-chassis by ServiceComb.
the class TestPojoV1V2 method addBody_add.
@Test
public void addBody_add() {
SwaggerEnvironment environment = new SwaggerEnvironment();
Swagger swagger = SwaggerGenerator.generate(PojoAddV2.class);
SwaggerConsumer swaggerConsumer = environment.createConsumer(ConsumerAddBodyV1.class, swagger);
ArgumentsMapper mapper = swaggerConsumer.findOperation("add").getArgumentsMapper();
Map<String, Object> arguments = new HashMap<>();
arguments.put("addBody", new AddWrapperV1(1, 2));
SwaggerInvocation invocation = new SwaggerInvocation();
Map<String, Object> result = mapper.invocationArgumentToSwaggerArguments(invocation, arguments);
Assert.assertSame(arguments.get("addBody"), result.get("addBody"));
}
use of org.apache.servicecomb.swagger.invocation.schemas.models.AddWrapperV1 in project java-chassis by ServiceComb.
the class TestJaxrsV1V2 method addBody_add.
@Test
public void addBody_add() {
SwaggerEnvironment environment = new SwaggerEnvironment();
Swagger swagger = SwaggerGenerator.generate(JaxrsAddV2.class);
SwaggerConsumer swaggerConsumer = environment.createConsumer(ConsumerAddBodyV1.class, swagger);
ArgumentsMapper mapper = swaggerConsumer.findOperation("add").getArgumentsMapper();
Map<String, Object> arguments = new HashMap<>();
arguments.put("addBody", new AddWrapperV1(1, 2));
SwaggerInvocation invocation = new SwaggerInvocation();
Map<String, Object> result = mapper.invocationArgumentToSwaggerArguments(invocation, arguments);
Assert.assertEquals(2, result.size());
Assert.assertEquals(1, (int) result.get("x"));
Assert.assertEquals(2, (int) result.get("y"));
Assert.assertEquals(null, result.get("x-z"));
}
use of org.apache.servicecomb.swagger.invocation.schemas.models.AddWrapperV1 in project java-chassis by ServiceComb.
the class TestPojoV1V1 method addBody_addBody.
@Test
public void addBody_addBody() {
SwaggerEnvironment environment = new SwaggerEnvironment();
Swagger swagger = SwaggerGenerator.generate(PojoAddBodyV1.class);
SwaggerConsumer swaggerConsumer = environment.createConsumer(ConsumerAddBodyV1.class, swagger);
ArgumentsMapper mapper = swaggerConsumer.findOperation("add").getArgumentsMapper();
Map<String, Object> arguments = new HashMap<>();
arguments.put("addBody", new AddWrapperV1(1, 2));
SwaggerInvocation invocation = new SwaggerInvocation();
Map<String, Object> result = mapper.invocationArgumentToSwaggerArguments(invocation, arguments);
Assert.assertEquals(1, result.size());
AddWrapperV1 wrapperV1 = (AddWrapperV1) result.get("addBody");
Assert.assertEquals(1, wrapperV1.getX());
Assert.assertEquals(2, wrapperV1.y);
Assert.assertSame(arguments.get("addBody"), result.get("addBody"));
}
use of org.apache.servicecomb.swagger.invocation.schemas.models.AddWrapperV1 in project java-chassis by ServiceComb.
the class TestPojoV1V1 method addBody_add.
@Test
public void addBody_add() {
SwaggerEnvironment environment = new SwaggerEnvironment();
Swagger swagger = SwaggerGenerator.generate(PojoAddV1.class);
SwaggerConsumer swaggerConsumer = environment.createConsumer(ConsumerAddBodyV1.class, swagger);
ArgumentsMapper mapper = swaggerConsumer.findOperation("add").getArgumentsMapper();
Map<String, Object> arguments = new HashMap<>();
arguments.put("addBody", new AddWrapperV1(1, 2));
SwaggerInvocation invocation = new SwaggerInvocation();
Map<String, Object> result = mapper.invocationArgumentToSwaggerArguments(invocation, arguments);
Assert.assertSame(arguments.get("addBody"), result.get("addBody"));
}
Aggregations