Skip to content

Commit

Permalink
XW-641 XWork ParameterInterceptors bypass (OGNL statement execution)
Browse files Browse the repository at this point in the history
Update tests

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@682411 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Musachy Barroso committed Aug 4, 2008
1 parent 9e5c404 commit 73df90c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -188,6 +189,7 @@ protected void setUp() throws Exception {
request.setSession(httpSession);
request.setParameterMap(params);
context.put(ServletActionContext.HTTP_REQUEST, request);
container.inject(parametersInterceptor);
}

protected void tearDown() throws Exception {
Expand All @@ -206,7 +208,7 @@ public void destroy() {
public boolean needsReload() {
return false;
}

public void init(Configuration configuration) throws ConfigurationException {
this.configuration = configuration;
}
Expand All @@ -216,12 +218,12 @@ public void loadPackages() throws ConfigurationException {

// 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
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;
Expand Down Expand Up @@ -74,6 +76,9 @@ public void testActionTagWithNamespace() {
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");
Expand Down Expand Up @@ -109,6 +114,9 @@ public void testSimpleWithoutServletActionContext() {
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");
Expand Down

0 comments on commit 73df90c

Please sign in to comment.