mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
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:
+5
-2
@@ -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();
|
||||
|
||||
+3
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user