use of org.apache.servicecomb.common.rest.definition.RestOperationMeta in project incubator-servicecomb-java-chassis by apache.
the class TestMicroservicePaths method testPrintPaths.
@Test
public void testPrintPaths() {
RestOperationMeta staticRes = UnitTestRestUtils.createRestOperationMeta("POST", "/static");
RestOperationMeta dynamicRes = UnitTestRestUtils.createRestOperationMeta("POST", "/dynamic/{id}");
MicroservicePaths paths = new MicroservicePaths();
paths.addResource(staticRes);
paths.addResource(dynamicRes);
WriterAppender appender = new WriterAppender();
Writer writer = new StringWriter();
appender.setWriter(writer);
appender.setLayout(new SimpleLayout());
Logger.getRootLogger().addAppender(appender);
paths.printPaths();
String[] lines = writer.toString().split("\n");
Assert.assertEquals("INFO - Swagger mapped \"{[/static], method=[POST], produces=[application/json]}\" onto null", lines[0].trim());
Assert.assertEquals("INFO - Swagger mapped \"{[/dynamic/{id}], method=[POST], produces=[application/json]}\" onto null", lines[1].trim());
Logger.getRootLogger().removeAppender(appender);
}
use of org.apache.servicecomb.common.rest.definition.RestOperationMeta in project incubator-servicecomb-java-chassis by apache.
the class TestOperationLocator method testLocateDynamicFound.
@Test
public void testLocateDynamicFound() {
RestOperationMeta rom = addRestOperationMeta("GET", "/dynamic/{id}");
locator.locate("ms", "/dynamic/1/", "GET", paths);
Assert.assertSame(rom, locator.getOperation());
Assert.assertEquals("1", locator.getPathVarMap().get("id"));
}
use of org.apache.servicecomb.common.rest.definition.RestOperationMeta in project incubator-servicecomb-java-chassis by apache.
the class ServerRestArgsFilter method afterReceiveRequest.
@Override
public Response afterReceiveRequest(Invocation invocation, HttpServletRequestEx requestEx) {
OperationMeta operationMeta = invocation.getOperationMeta();
RestOperationMeta restOperationMeta = operationMeta.getExtData(RestConst.SWAGGER_REST_OPERATION);
Object[] args = RestCodec.restToArgs(requestEx, restOperationMeta);
invocation.setSwaggerArguments(args);
return null;
}
use of org.apache.servicecomb.common.rest.definition.RestOperationMeta in project incubator-servicecomb-java-chassis by apache.
the class TestRequestMeta method testGetSwaggerRestOperation.
@Test
public void testGetSwaggerRestOperation() {
RestOperationMeta value = requestmeta.getSwaggerRestOperation();
Assert.assertNotNull(value);
}
Aggregations