use of org.apache.struts.chain.contexts.MockActionContext 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.chain.contexts.MockActionContext in project sonar-java 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();
}
Aggregations