Package org.geomajas.command.dto

Examples of org.geomajas.command.dto.LogRequest


  @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());
View Full Code Here


    Assert.assertFalse(response.isError());
    String token = ((LoginResponse)response).getToken();
    Assert.assertNotNull(token);
    Assert.assertNull(securityContext.getToken());

    LogRequest logRequest = new LogRequest();
    logRequest.setStatement("test log command access");
    response = commandDispatcher.execute(LogRequest.COMMAND, logRequest, token, "en");
    Assert.assertFalse(response.isError());
    Assert.assertNull(securityContext.getToken());

    // this test to verify the command itself (should fail here as "luc" should be logged in).
View Full Code Here

    Assert.assertFalse(response.isError());
    String token = ((LoginResponse)response).getToken();
    Assert.assertNotNull(token);
    Assert.assertNull(securityContext.getToken());

    LogRequest logRequest = new LogRequest();
    logRequest.setStatement("test log command access");
    response = commandDispatcher.execute("command.general.Log", logRequest, token, "en");
    Assert.assertTrue(response.isError());
    Assert.assertEquals("User marino is not authorized to use the command command.general.Log.",
        response.getErrorMessages().get(0)); // needs to be updated when messages file is changed
    Assert.assertNull(securityContext.getToken());
View Full Code Here

TOP

Related Classes of org.geomajas.command.dto.LogRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.