From 3513e0841ca9d90123afce0552e521f68e3fe893 Mon Sep 17 00:00:00 2001 From: "Donald J. Brown" Date: Tue, 14 Nov 2006 02:53:02 +0000 Subject: [PATCH] Creating a spring plugin, fixing a few problems with the plexus plugin WW-1499 git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@474633 13f79535-47bb-0310-9956-ffa450edef68 --- apps/showcase/pom.xml | 6 ++ .../src/main/resources/struts.properties | 1 - core/pom.xml | 25 +------- core/src/main/resources/struts-default.xml | 1 - .../struts2/views/xslt/XSLTResultTest.java | 3 +- .../src/main/resources/struts-plugin.xml | 2 +- plugins/spring/pom.xml | 62 +++++++++++++++++++ .../spring/StrutsSpringObjectFactory.java | 0 .../src/main/resources/struts-plugin.xml | 19 ++++++ .../spring/StrutsSpringObjectFactoryTest.java | 4 +- ...ngObjectFactoryTest-applicationContext.xml | 0 11 files changed, 94 insertions(+), 29 deletions(-) create mode 100644 plugins/spring/pom.xml rename {core => plugins/spring}/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java (100%) create mode 100644 plugins/spring/src/main/resources/struts-plugin.xml rename {core => plugins/spring}/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java (95%) rename {core => plugins/spring}/src/test/resources/org/apache/struts2/spring/StrutsSpringObjectFactoryTest-applicationContext.xml (100%) diff --git a/apps/showcase/pom.xml b/apps/showcase/pom.xml index 03bbdd3bf..72ac4a5e0 100644 --- a/apps/showcase/pom.xml +++ b/apps/showcase/pom.xml @@ -61,6 +61,12 @@ struts2-tiles-plugin ${pom.version} + + + org.apache.struts + struts2-spring-plugin + ${pom.version} + javax.servlet diff --git a/apps/showcase/src/main/resources/struts.properties b/apps/showcase/src/main/resources/struts.properties index 6352045a4..a495cf1ea 100644 --- a/apps/showcase/src/main/resources/struts.properties +++ b/apps/showcase/src/main/resources/struts.properties @@ -2,7 +2,6 @@ struts.i18n.reload=true struts.devMode = true struts.configuration.xml.reload=true struts.continuations.package = org.apache.struts2.showcase -struts.objectFactory = spring struts.custom.i18n.resources=globalMessages #struts.action.extension=jspa struts.url.http.port = 8080 diff --git a/core/pom.xml b/core/pom.xml index d0465562a..d8e5b91d1 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -152,10 +152,10 @@ true - + org.springframework - spring-beans + spring-mock 1.2.8 true @@ -164,30 +164,11 @@ org.springframework spring-core 1.2.8 - true + test - - org.springframework - spring-context - 1.2.8 - true - - - org.springframework - spring-web - 1.2.8 - true - - - org.springframework - spring-mock - 1.2.8 - true - - junit diff --git a/core/src/main/resources/struts-default.xml b/core/src/main/resources/struts-default.xml index 334101125..fb85b3dd8 100644 --- a/core/src/main/resources/struts-default.xml +++ b/core/src/main/resources/struts-default.xml @@ -7,7 +7,6 @@ - diff --git a/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java b/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java index 4bd7e9337..7e7608489 100644 --- a/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java +++ b/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java @@ -27,7 +27,6 @@ import javax.xml.transform.TransformerException; import org.apache.struts2.ServletActionContext; import org.apache.struts2.StrutsTestCase; -import org.springframework.core.io.DefaultResourceLoader; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletContext; @@ -120,7 +119,7 @@ public class XSLTResultTest extends StrutsTestCase { protected void setUp() throws Exception { request = new MockHttpServletRequest(); response = new MockHttpServletResponse(); - servletContext = new MockServletContext(new DefaultResourceLoader()); + servletContext = new MockServletContext(); result = new XSLTResult(); stack = ValueStackFactory.getFactory().createValueStack(); diff --git a/plugins/plexus/src/main/resources/struts-plugin.xml b/plugins/plexus/src/main/resources/struts-plugin.xml index dc55670a1..4f99ac07f 100644 --- a/plugins/plexus/src/main/resources/struts-plugin.xml +++ b/plugins/plexus/src/main/resources/struts-plugin.xml @@ -5,7 +5,7 @@ "http://struts.apache.org/dtds/struts-2.0.dtd"> - + diff --git a/plugins/spring/pom.xml b/plugins/spring/pom.xml new file mode 100644 index 000000000..cb1953f69 --- /dev/null +++ b/plugins/spring/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + org.apache.struts + struts2-plugins + 2.0.2-SNAPSHOT + + org.apache.struts + struts2-spring-plugin + jar + Struts 2 Spring Plugin + + + scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/spring/ + scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/spring/ + http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/plugins/spring/ + + + + + org.springframework + spring-beans + 1.2.8 + + + + org.springframework + spring-core + 1.2.8 + + + + org.springframework + spring-context + 1.2.8 + + + + org.springframework + spring-web + 1.2.8 + + + + org.springframework + spring-mock + 1.2.8 + test + + + + junit + junit + test + 3.8.1 + + + + + diff --git a/core/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java b/plugins/spring/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java similarity index 100% rename from core/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java rename to plugins/spring/src/main/java/org/apache/struts2/spring/StrutsSpringObjectFactory.java diff --git a/plugins/spring/src/main/resources/struts-plugin.xml b/plugins/spring/src/main/resources/struts-plugin.xml new file mode 100644 index 000000000..61849018e --- /dev/null +++ b/plugins/spring/src/main/resources/struts-plugin.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + diff --git a/core/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java b/plugins/spring/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java similarity index 95% rename from core/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java rename to plugins/spring/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java index b5e825068..283c8723e 100644 --- a/core/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java +++ b/plugins/spring/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java @@ -22,8 +22,8 @@ package org.apache.struts2.spring; import javax.servlet.ServletContext; +import junit.framework.TestCase; import org.apache.struts2.StrutsConstants; -import org.apache.struts2.StrutsTestCase; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.mock.web.MockServletContext; import org.springframework.web.context.ConfigurableWebApplicationContext; @@ -34,7 +34,7 @@ import org.springframework.web.context.support.XmlWebApplicationContext; * Unit test for {@link StrutsSpringObjectFactory}. * */ -public class StrutsSpringObjectFactoryTest extends StrutsTestCase { +public class StrutsSpringObjectFactoryTest extends TestCase { public void testNoSpringContext() throws Exception { // to cover situations where there will be logged an error diff --git a/core/src/test/resources/org/apache/struts2/spring/StrutsSpringObjectFactoryTest-applicationContext.xml b/plugins/spring/src/test/resources/org/apache/struts2/spring/StrutsSpringObjectFactoryTest-applicationContext.xml similarity index 100% rename from core/src/test/resources/org/apache/struts2/spring/StrutsSpringObjectFactoryTest-applicationContext.xml rename to plugins/spring/src/test/resources/org/apache/struts2/spring/StrutsSpringObjectFactoryTest-applicationContext.xml