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
This commit is contained in:
Musachy Barroso
2009-03-30 18:57:28 +00:00
parent cc39485416
commit a22db3e117
2 changed files with 8 additions and 2 deletions
@@ -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();
@@ -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);
}