@Autowired
private CommandDispatcher dispatcher;
@Test
public void testLog() throws Exception {
LogRequest request = new LogRequest();
request.setLevel(LogRequest.LEVEL_INFO);
request.setStatement("Test log command");
CommandResponse response = dispatcher.execute(LogRequest.COMMAND, request, null, "en");
if (response.isError()) {
response.getErrors().get(0).printStackTrace();
}
Assert.assertFalse(response.isError());
request.setLevel(LogRequest.LEVEL_DEBUG);
request.setStatement("Test debug log command");
response = dispatcher.execute(LogRequest.COMMAND, request, null, "en");
if (response.isError()) {
response.getErrors().get(0).printStackTrace();
}
Assert.assertFalse(response.isError());
request.setLevel(LogRequest.LEVEL_WARN);
request.setStatement("Test warn log command");
response = dispatcher.execute(LogRequest.COMMAND, request, null, "en");
if (response.isError()) {
response.getErrors().get(0).printStackTrace();
}
Assert.assertFalse(response.isError());
request.setLevel(LogRequest.LEVEL_ERROR);
request.setStatement("Test error log command");
response = dispatcher.execute(LogRequest.COMMAND, request, null, "en");
if (response.isError()) {
response.getErrors().get(0).printStackTrace();
}
Assert.assertFalse(response.isError());