Examples of CommandResponse


Examples of org.geomajas.command.CommandResponse

    GetLocationForStringRequest request = new GetLocationForStringRequest();
    request.setCrs("EPSG:900913");
    request.setLocation("bla");
    request.setServicePattern("a");

    CommandResponse commandResponse = commandDispatcher.execute(GetLocationForStringRequest.COMMAND, request, null,
        "en");
    Assert.assertNotNull(commandResponse);
    Assert.assertTrue(commandResponse instanceof GetLocationForStringResponse);
    GetLocationForStringResponse response = (GetLocationForStringResponse)commandResponse;
    Assert.assertFalse(response.isLocationFound());
View Full Code Here

Examples of org.geomajas.command.CommandResponse

  // assure we are logged in as a specific user to set correct authorizations
  public void login(String name) {
    LoginRequest request = new LoginRequest();
    request.setLogin(name);
    request.setPassword(name);
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof LoginResponse);
    securityManager.createSecurityContext(((LoginResponse)response).getToken());
  }
View Full Code Here

Examples of org.geomajas.command.CommandResponse

  // assure we are logged in as a specific user to set correct authorizations
  public void login(String name) {
    LoginRequest request = new LoginRequest();
    request.setLogin(name);
    request.setPassword(name);
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof LoginResponse);
    securityManager.createSecurityContext(((LoginResponse)response).getToken());
  }
View Full Code Here

Examples of org.geomajas.command.CommandResponse

  @Test
  public void testLogAllowed() throws Exception {
    LoginRequest request = new LoginRequest();
    request.setLogin("luc");
    request.setPassword("luc");
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, null);
    Assert.assertTrue(response instanceof LoginResponse);
    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).
    response = commandDispatcher.execute("command.MarinoLoggedIn", null, token, "en");
    Assert.assertTrue(response.isError());
    Assert.assertTrue(response.getErrors().get(0) instanceof GeomajasException);
    Assert.assertEquals(ExceptionCode.TEST, ((GeomajasException)response.getErrors().get(0)).getExceptionCode());
    Assert.assertNull(securityContext.getToken());
  }
View Full Code Here

Examples of org.geomajas.command.CommandResponse

  @Test
  public void testLogNotAllowed() throws Exception {
    LoginRequest request = new LoginRequest();
    request.setLogin("marino");
    request.setPassword("marino");
    CommandResponse response = commandDispatcher.execute(LoginRequest.COMMAND, request, null, null);
    Assert.assertTrue(response instanceof LoginResponse);
    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());

    response = commandDispatcher.execute("command.MarinoLoggedIn", null, token, "en");
    Assert.assertFalse(response.isError());
    Assert.assertNull(securityContext.getToken());
  }
View Full Code Here

Examples of org.geomajas.command.CommandResponse

  // assure we are logged in as a specific user to set correct authorizations
  public void login(String name) {
    LoginRequest request = new LoginRequest();
    request.setLogin(name);
    request.setPassword(name);
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof LoginResponse);
    securityManager.createSecurityContext(((LoginResponse)response).getToken());
  }
View Full Code Here

Examples of org.geomajas.command.CommandResponse

  // assure we are logged in as a specific user to set correct authorizations
  public void login(String name) {
    LoginRequest request = new LoginRequest();
    request.setLogin(name);
    request.setPassword(name);
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof LoginResponse);
    securityManager.createSecurityContext(((LoginResponse)response).getToken());
  }
View Full Code Here

Examples of org.geomajas.command.CommandResponse

  // assure we are logged in as a specific user to set correct authorizations
  public void login(String name) {
    LoginRequest request = new LoginRequest();
    request.setLogin(name);
    request.setPassword(name);
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof LoginResponse);
    securityManager.createSecurityContext(((LoginResponse)response).getToken());
  }
View Full Code Here

Examples of org.geomajas.command.CommandResponse

  // assure we are logged in as a specific user to set correct authorizations
  public void login(String name) {
    LoginRequest request = new LoginRequest();
    request.setLogin(name);
    request.setPassword(name);
    CommandResponse response = commandDispatcher.execute("command.staticsecurity.Login", request, null, "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof LoginResponse);
    securityManager.createSecurityContext(((LoginResponse)response).getToken());
  }
View Full Code Here

Examples of org.geomajas.command.CommandResponse

  public void testGetConfigurationFilterToolsAndInvisibleLayers() throws Exception {
    login("luc");
    GetMapConfigurationRequest request = new GetMapConfigurationRequest();
    request.setApplicationId(APP_ID);
    request.setMapId(MAP_ID);
    CommandResponse response = commandDispatcher.execute(GetMapConfigurationRequest.COMMAND, request,
        securityContext.getToken(), "en");
    Assert.assertFalse(response.isError());
    Assert.assertTrue(response instanceof GetMapConfigurationResponse);
    ClientMapInfo mapInfo = ((GetMapConfigurationResponse)response).getMapInfo();

    Assert.assertEquals(MAP_ID, mapInfo.getId());
    Assert.assertEquals("EPSG:4326", mapInfo.getCrs());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.