You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by jo...@apache.org on 2015/06/07 21:04:23 UTC
[4/6] struts git commit: WW-4510 Upgrade spring plugin dependencies
to spring version 4.x
WW-4510 Upgrade spring plugin dependencies to spring version 4.x
- Replace deprecated singleton="false" with scope="prototype"
- The boundary parameter needs to be in the header request
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/8aa389e3
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/8aa389e3
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/8aa389e3
Branch: refs/heads/master
Commit: 8aa389e3761e86eeb90ebfc3164fd2c56251a44d
Parents: c951b15
Author: Johannes Geppert <jo...@gmail.com>
Authored: Sun Jun 7 18:33:18 2015 +0200
Committer: Johannes Geppert <jo...@gmail.com>
Committed: Sun Jun 7 18:33:18 2015 +0200
----------------------------------------------------------------------
core/pom.xml | 14 ++++++++++++++
.../interceptor/FileUploadInterceptorTest.java | 10 ++++------
.../xwork2/spring/actionContext-spring.xml | 15 ++++++++-------
3 files changed, 26 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/8aa389e3/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 15fd2c5..34a1c55 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -303,5 +303,19 @@
<optional>true</optional>
</dependency>
+ <!-- The Servlet API mocks in Spring Framework 4.x only supports Servlet 3.0 and higher.
+ This is only necessary in tests-->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/struts/blob/8aa389e3/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java b/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
index 9dbb114..870a600 100644
--- a/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
+++ b/core/src/test/java/org/apache/struts2/interceptor/FileUploadInterceptorTest.java
@@ -213,7 +213,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
MockHttpServletRequest req = new MockHttpServletRequest();
req.setCharacterEncoding("text/html");
- req.setContentType("multipart/form-data; boundary=---1234");
+ req.addHeader("Content-type", "multipart/form-data");
req.setContent(null); // there is no content
MyFileupAction action = new MyFileupAction();
@@ -224,7 +224,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
Map param = new HashMap();
ActionContext.getContext().setParameters(param);
- ActionContext.getContext().put(ServletActionContext.HTTP_REQUEST, createMultipartRequest((HttpServletRequest) req, 2000));
+ ActionContext.getContext().put(ServletActionContext.HTTP_REQUEST, createMultipartRequest(req, 2000));
interceptor.intercept(mai);
@@ -234,8 +234,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
public void testSuccessUploadOfATextFileMultipartRequest() throws Exception {
MockHttpServletRequest req = new MockHttpServletRequest();
req.setCharacterEncoding("text/html");
- req.setContentType("multipart/form-data; boundary=---1234");
- req.addHeader("Content-type", "multipart/form-data");
+ req.addHeader("Content-type", "multipart/form-data; boundary=---1234");
// inspired by the unit tests for jakarta commons fileupload
String content = ("-----1234\r\n" +
@@ -291,8 +290,7 @@ public class FileUploadInterceptorTest extends StrutsInternalTestCase {
MockHttpServletRequest req = new MockHttpServletRequest();
req.setCharacterEncoding("text/html");
req.setMethod("POST");
- req.setContentType("multipart/form-data; boundary=" + bondary);
- req.addHeader("Content-type", "multipart/form-data");
+ req.addHeader("Content-type", "multipart/form-data; boundary=" + bondary);
StringBuilder content = new StringBuilder(128);
content.append(encodeTextFile(bondary, endline, "file", "test.html", "text/plain", plainContent));
content.append(encodeTextFile(bondary, endline, "file", "test1.html", "text/html", htmlContent));
http://git-wip-us.apache.org/repos/asf/struts/blob/8aa389e3/xwork-core/src/test/resources/com/opensymphony/xwork2/spring/actionContext-spring.xml
----------------------------------------------------------------------
diff --git a/xwork-core/src/test/resources/com/opensymphony/xwork2/spring/actionContext-spring.xml b/xwork-core/src/test/resources/com/opensymphony/xwork2/spring/actionContext-spring.xml
index 4cc2284..02a4f33 100644
--- a/xwork-core/src/test/resources/com/opensymphony/xwork2/spring/actionContext-spring.xml
+++ b/xwork-core/src/test/resources/com/opensymphony/xwork2/spring/actionContext-spring.xml
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
-<beans>
- <bean id="simple-action" class="com.opensymphony.xwork2.SimpleAction" singleton="false"/>
+ <bean id="simple-action" class="com.opensymphony.xwork2.SimpleAction" scope="prototype"/>
- <bean id="dependency-action" class="com.opensymphony.xwork2.SimpleAction" singleton="false">
+ <bean id="dependency-action" class="com.opensymphony.xwork2.SimpleAction" scope="prototype">
<property name="blah"><value>injected</value></property>
</bean>
@@ -23,7 +25,7 @@
</property>
</bean>
- <bean id="auto-proxied-action" class="com.opensymphony.xwork2.SimpleAction" singleton="false"/>
+ <bean id="auto-proxied-action" class="com.opensymphony.xwork2.SimpleAction" scope="prototype"/>
<bean id="xwork-actions-proxy-creator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="proxyTargetClass"><value>true</value></property>
@@ -35,8 +37,7 @@
<property name="beanNames"><value>auto-proxied-action</value></property>
</bean>
- <bean id="springResult" class="com.opensymphony.xwork2.spring.SpringResult"
- init-method="initialize">
+ <bean id="springResult" class="com.opensymphony.xwork2.spring.SpringResult" init-method="initialize">
<property name="stringParameter" value="my string"/>
</bean>
</beans>