From a22db3e117a754da54be653de11fc8ee56cd53d2 Mon Sep 17 00:00:00 2001 From: Musachy Barroso Date: Mon, 30 Mar 2009 18:57:28 +0000 Subject: [PATCH] WW-2996 Fix emory Leak when SlashesInActionNames is enabled and wildcards are used in actionnames git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@760103 13f79535-47bb-0310-9956-ffa450edef68 --- .../validation/AnnotationValidationInterceptorTest.java | 7 +++++-- .../validation/JSONValidationInterceptorTest.java | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptorTest.java index a8173aa67..d7a9f292c 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/validation/AnnotationValidationInterceptorTest.java @@ -27,6 +27,7 @@ import com.mockobjects.dynamic.Mock; import com.opensymphony.xwork2.ActionInvocation; import com.opensymphony.xwork2.ActionProxy; import com.opensymphony.xwork2.Validateable; +import com.opensymphony.xwork2.config.entities.ActionConfig; public class AnnotationValidationInterceptorTest extends StrutsTestCase { @@ -34,12 +35,14 @@ public class AnnotationValidationInterceptorTest extends StrutsTestCase { private Mock mockActionInvocation; private Mock mockActionProxy; private TestAction test; + private ActionConfig config; public void setUp() throws Exception { super.setUp(); test = new TestAction(); interceptor = new AnnotationValidationInterceptor(); container.inject(interceptor); + config = new ActionConfig.Builder("", "foo", "").build(); mockActionInvocation = new Mock(ActionInvocation.class); mockActionProxy = new Mock(ActionProxy.class); mockActionInvocation.matchAndReturn("getProxy", (ActionProxy) mockActionProxy.proxy()); @@ -49,7 +52,7 @@ public class AnnotationValidationInterceptorTest extends StrutsTestCase { public void testShouldNotSkip() throws Exception { mockActionProxy.expectAndReturn("getMethod", "execute"); - mockActionProxy.expectAndReturn("getActionName", "foo"); + mockActionProxy.expectAndReturn("getConfig", config); mockActionProxy.expectAndReturn("getMethod", "execute"); interceptor.doIntercept((ActionInvocation)mockActionInvocation.proxy()); mockActionProxy.verify(); @@ -81,7 +84,7 @@ public class AnnotationValidationInterceptorTest extends StrutsTestCase { public void testShouldNotSkipBase() throws Exception { mockActionProxy.expectAndReturn("getMethod", "dontSkipMeBase"); - mockActionProxy.expectAndReturn("getActionName", "foo"); + mockActionProxy.expectAndReturn("getConfig", config); mockActionProxy.expectAndReturn("getMethod", "dontSkipMeBase"); interceptor.doIntercept((ActionInvocation)mockActionInvocation.proxy()); mockActionProxy.verify(); diff --git a/core/src/test/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptorTest.java index c3935c6b6..e6dddcdd2 100644 --- a/core/src/test/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptorTest.java +++ b/core/src/test/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptorTest.java @@ -38,6 +38,7 @@ import org.apache.struts2.views.jsp.StrutsMockServletContext; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; +import com.opensymphony.xwork2.config.entities.ActionConfig; import com.opensymphony.xwork2.mock.MockActionInvocation; import com.opensymphony.xwork2.mock.MockActionProxy; import com.opensymphony.xwork2.util.ValueStack; @@ -128,6 +129,7 @@ public class JSONValidationInterceptorTest extends StrutsTestCase { protected void setUp() throws Exception { super.setUp(); + ActionConfig config = new ActionConfig.Builder("", "name", "").build(); this.action = new TestAction(); this.interceptor = new JSONValidationInterceptor(); this.validationInterceptor = new AnnotationValidationInterceptor(); @@ -152,6 +154,7 @@ public class JSONValidationInterceptorTest extends StrutsTestCase { MockActionProxy proxy = new MockActionProxy(); proxy.setMethod("execute"); proxy.setAction(action); + proxy.setConfig(config); invocation.setProxy(proxy); }