mirror of
https://github.com/apache/struts.git
synced 2026-08-31 19:35:40 +00:00
XW-641 XWork ParameterInterceptors bypass (OGNL statement execution)
Update tests git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@682411 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
+5
-3
@@ -64,6 +64,7 @@ public class ExecuteAndWaitInterceptorTest extends StrutsTestCase {
|
||||
private Map params;
|
||||
private Map session;
|
||||
private ExecuteAndWaitInterceptor waitInterceptor;
|
||||
private ParametersInterceptor parametersInterceptor;
|
||||
|
||||
public void testOneWait() throws Exception {
|
||||
waitInterceptor.setDelay(0);
|
||||
@@ -188,6 +189,7 @@ public class ExecuteAndWaitInterceptorTest extends StrutsTestCase {
|
||||
request.setSession(httpSession);
|
||||
request.setParameterMap(params);
|
||||
context.put(ServletActionContext.HTTP_REQUEST, request);
|
||||
container.inject(parametersInterceptor);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
@@ -206,7 +208,7 @@ public class ExecuteAndWaitInterceptorTest extends StrutsTestCase {
|
||||
public boolean needsReload() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void init(Configuration configuration) throws ConfigurationException {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
@@ -216,12 +218,12 @@ public class ExecuteAndWaitInterceptorTest extends StrutsTestCase {
|
||||
|
||||
// interceptors
|
||||
waitInterceptor = new ExecuteAndWaitInterceptor();
|
||||
|
||||
parametersInterceptor = new ParametersInterceptor();
|
||||
PackageConfig wait = new PackageConfig.Builder("")
|
||||
.addActionConfig("action1", new ActionConfig.Builder("", "action1", ExecuteAndWaitDelayAction.class.getName())
|
||||
.addResultConfig(new ResultConfig.Builder(Action.SUCCESS, MockResult.class.getName()).build())
|
||||
.addResultConfig(new ResultConfig.Builder(ExecuteAndWaitInterceptor.WAIT, MockResult.class.getName()).build())
|
||||
.addInterceptor(new InterceptorMapping("params", new ParametersInterceptor()))
|
||||
.addInterceptor(new InterceptorMapping("params", parametersInterceptor))
|
||||
.addInterceptor(new InterceptorMapping("execAndWait", waitInterceptor))
|
||||
.build())
|
||||
.build();
|
||||
|
||||
@@ -37,6 +37,8 @@ import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionContext;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.ActionProxy;
|
||||
import com.opensymphony.xwork2.config.entities.ActionConfig;
|
||||
import com.opensymphony.xwork2.config.providers.MockConfigurationProvider;
|
||||
import com.opensymphony.xwork2.util.ValueStack;
|
||||
import com.opensymphony.xwork2.util.ValueStackFactory;
|
||||
import com.mockobjects.dynamic.Mock;
|
||||
@@ -74,6 +76,9 @@ public class ActionTagTest extends AbstractTagTest {
|
||||
public void testSimple() {
|
||||
request.setupGetServletPath("/foo.action");
|
||||
|
||||
ActionConfig config = configuration.getRuntimeConfiguration().getActionConfig("", "testAction");
|
||||
container.inject(config.getInterceptors().get(0).getInterceptor());
|
||||
|
||||
ActionTag tag = new ActionTag();
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setName("testAction");
|
||||
@@ -109,6 +114,9 @@ public class ActionTagTest extends AbstractTagTest {
|
||||
public void testSimpleWithctionMethodInOriginalURI() {
|
||||
request.setupGetServletPath("/foo!foo.action");
|
||||
|
||||
ActionConfig config = configuration.getRuntimeConfiguration().getActionConfig("", "testAction");
|
||||
container.inject(config.getInterceptors().get(0).getInterceptor());
|
||||
|
||||
ActionTag tag = new ActionTag();
|
||||
tag.setPageContext(pageContext);
|
||||
tag.setName("testAction");
|
||||
|
||||
Reference in New Issue
Block a user