use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestCopyFormToContext method setUp.
/*
* @see TestCase#setUp()
*/
protected void setUp() throws Exception {
context = new MockActionContext();
ModuleConfigImpl moduleConfig = new ModuleConfigImpl("/");
context.setModuleConfig(moduleConfig);
FormBeanConfig fooFBC = new FormBeanConfig();
fooFBC.setName("foo");
fooFBC.setType("org.apache.struts.mock.MockFormBean");
moduleConfig.addFormBeanConfig(fooFBC);
FormBeanConfig barFBC = new FormBeanConfig();
barFBC.setName("bar");
// use a different type so we can verify lookups better
barFBC.setType("org.apache.struts.action.DynaActionForm");
FormPropertyConfig fpc = new FormPropertyConfig();
fpc.setName("property");
fpc.setType("java.lang.String");
fpc.setInitial("test");
barFBC.addFormPropertyConfig(fpc);
moduleConfig.addFormBeanConfig(barFBC);
ActionConfig testActionConfig = new ActionConfig();
testActionConfig.setPath("/Test");
testActionConfig.setName("foo");
testActionConfig.setScope("request");
moduleConfig.addActionConfig(testActionConfig);
// otherwise, ActionConfigMatcher will be null and we'll get an NPE...
moduleConfig.freeze();
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestAuthorizeAction method testAuthorizeNoRoles.
public void testAuthorizeNoRoles() throws Exception {
ActionConfig config = new ActionConfig();
config.setPath("/testAuthorizeNoRoles");
this.saContext.setActionConfig(config);
boolean result = command.execute(saContext);
assertFalse(result);
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestAuthorizeAction method testAuthorizeOneRole.
public void testAuthorizeOneRole() throws Exception {
ActionConfig config = new ActionConfig();
config.setPath("/testAuthorizeOneRole");
config.setRoles("administrator");
this.saContext.setActionConfig(config);
boolean result = command.execute(saContext);
assertFalse(result);
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestAuthorizeAction method testAuthorizeOneOfManyRoles.
public void testAuthorizeOneOfManyRoles() throws Exception {
ActionConfig config = new ActionConfig();
config.setPath("/testAuthorizeOneOfManyRoles");
config.setRoles("administrator,roustabout,memory");
this.saContext.setActionConfig(config);
boolean result = command.execute(saContext);
assertFalse(result);
}
use of org.apache.struts.config.ActionConfig in project sonarqube by SonarSource.
the class TestAuthorizeAction method testNotAuthorizedOneRole.
public void testNotAuthorizedOneRole() throws Exception {
ActionConfig config = new ActionConfig();
config.setPath("/testNotAuthorizedOneRole");
config.setRoles("roustabout");
this.saContext.setActionConfig(config);
try {
boolean result = command.execute(saContext);
} catch (UnauthorizedActionException ex) {
}
}
Aggregations