@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());
}