You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by mr...@apache.org on 2006/11/14 03:53:03 UTC

svn commit: r474633 - in /struts/struts2/trunk: apps/showcase/ apps/showcase/src/main/resources/ core/ core/src/main/java/org/apache/struts2/spring/ core/src/main/resources/ core/src/test/java/org/apache/struts2/spring/ core/src/test/java/org/apache/st...

Author: mrdon
Date: Mon Nov 13 18:53:02 2006
New Revision: 474633

URL: http://svn.apache.org/viewvc?view=rev&rev=474633
Log:
Creating a spring plugin, fixing a few problems with the plexus plugin
WW-1499

Added:
    struts/struts2/trunk/plugins/spring/
    struts/struts2/trunk/plugins/spring/pom.xml
    struts/struts2/trunk/plugins/spring/src/
    struts/struts2/trunk/plugins/spring/src/main/
    struts/struts2/trunk/plugins/spring/src/main/java/
    struts/struts2/trunk/plugins/spring/src/main/java/org/
    struts/struts2/trunk/plugins/spring/src/main/java/org/apache/
    struts/struts2/trunk/plugins/spring/src/main/java/org/apache/struts2/
    struts/struts2/trunk/plugins/spring/src/main/java/org/apache/struts2/spring/
      - copied from r474536, struts/struts2/trunk/core/src/main/java/org/apache/struts2/spring/
    struts/struts2/trunk/plugins/spring/src/main/resources/
    struts/struts2/trunk/plugins/spring/src/main/resources/struts-plugin.xml
    struts/struts2/trunk/plugins/spring/src/test/
    struts/struts2/trunk/plugins/spring/src/test/java/
    struts/struts2/trunk/plugins/spring/src/test/java/org/
    struts/struts2/trunk/plugins/spring/src/test/java/org/apache/
    struts/struts2/trunk/plugins/spring/src/test/java/org/apache/struts2/
    struts/struts2/trunk/plugins/spring/src/test/java/org/apache/struts2/spring/
      - copied from r474536, struts/struts2/trunk/core/src/test/java/org/apache/struts2/spring/
    struts/struts2/trunk/plugins/spring/src/test/resources/
    struts/struts2/trunk/plugins/spring/src/test/resources/org/
    struts/struts2/trunk/plugins/spring/src/test/resources/org/apache/
    struts/struts2/trunk/plugins/spring/src/test/resources/org/apache/struts2/
    struts/struts2/trunk/plugins/spring/src/test/resources/org/apache/struts2/spring/
      - copied from r474536, struts/struts2/trunk/core/src/test/resources/org/apache/struts2/spring/
Removed:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/spring/
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/spring/
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/spring/
Modified:
    struts/struts2/trunk/apps/showcase/pom.xml
    struts/struts2/trunk/apps/showcase/src/main/resources/struts.properties
    struts/struts2/trunk/core/pom.xml
    struts/struts2/trunk/core/src/main/resources/struts-default.xml
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java
    struts/struts2/trunk/plugins/plexus/src/main/resources/struts-plugin.xml
    struts/struts2/trunk/plugins/spring/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java

Modified: struts/struts2/trunk/apps/showcase/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/pom.xml?view=diff&rev=474633&r1=474632&r2=474633
==============================================================================
--- struts/struts2/trunk/apps/showcase/pom.xml (original)
+++ struts/struts2/trunk/apps/showcase/pom.xml Mon Nov 13 18:53:02 2006
@@ -61,6 +61,12 @@
             <artifactId>struts2-tiles-plugin</artifactId>
             <version>${pom.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.struts</groupId>
+            <artifactId>struts2-spring-plugin</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
  
         <dependency>
            <groupId>javax.servlet</groupId>

Modified: struts/struts2/trunk/apps/showcase/src/main/resources/struts.properties
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/resources/struts.properties?view=diff&rev=474633&r1=474632&r2=474633
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/resources/struts.properties (original)
+++ struts/struts2/trunk/apps/showcase/src/main/resources/struts.properties Mon Nov 13 18:53:02 2006
@@ -2,7 +2,6 @@
 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

Modified: struts/struts2/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/pom.xml?view=diff&rev=474633&r1=474632&r2=474633
==============================================================================
--- struts/struts2/trunk/core/pom.xml (original)
+++ struts/struts2/trunk/core/pom.xml Mon Nov 13 18:53:02 2006
@@ -152,10 +152,10 @@
             <optional>true</optional>
         </dependency>
 
-        <!-- Spring -->
+        <!-- Mocks for unit testing (by Spring) -->
         <dependency>
             <groupId>org.springframework</groupId>
-            <artifactId>spring-beans</artifactId>
+            <artifactId>spring-mock</artifactId>
             <version>1.2.8</version>
             <optional>true</optional>
         </dependency>
@@ -164,30 +164,11 @@
             <groupId>org.springframework</groupId>
             <artifactId>spring-core</artifactId>
             <version>1.2.8</version>
-            <optional>true</optional>
+            <scope>test</scope>
         </dependency>
 
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
-            <version>1.2.8</version>
-            <optional>true</optional>
-        </dependency>
 
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-web</artifactId>
-            <version>1.2.8</version>
-            <optional>true</optional>
-        </dependency>
 
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-mock</artifactId>
-            <version>1.2.8</version>
-            <optional>true</optional>
-        </dependency>
-        
         <!-- Test dependencies -->
         <dependency>
             <groupId>junit</groupId>

Modified: struts/struts2/trunk/core/src/main/resources/struts-default.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/struts-default.xml?view=diff&rev=474633&r1=474632&r2=474633
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/struts-default.xml (original)
+++ struts/struts2/trunk/core/src/main/resources/struts-default.xml Mon Nov 13 18:53:02 2006
@@ -7,7 +7,6 @@
 <struts>
 	<bean class="com.opensymphony.xwork2.ObjectFactory" name="xwork" />
 	<bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" class="org.apache.struts2.impl.StrutsObjectFactory" />
-	<bean type="com.opensymphony.xwork2.ObjectFactory" name="spring" class="org.apache.struts2.spring.StrutsSpringObjectFactory" optional="true"/>
 	
 	<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="xwork" class="com.opensymphony.xwork2.DefaultActionProxyFactory"/>
 	<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="struts" class="org.apache.struts2.impl.StrutsActionProxyFactory"/>

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java?view=diff&rev=474633&r1=474632&r2=474633
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/xslt/XSLTResultTest.java Mon Nov 13 18:53:02 2006
@@ -27,7 +27,6 @@
 
 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 @@
     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();

Modified: struts/struts2/trunk/plugins/plexus/src/main/resources/struts-plugin.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/plexus/src/main/resources/struts-plugin.xml?view=diff&rev=474633&r1=474632&r2=474633
==============================================================================
--- struts/struts2/trunk/plugins/plexus/src/main/resources/struts-plugin.xml (original)
+++ struts/struts2/trunk/plugins/plexus/src/main/resources/struts-plugin.xml Mon Nov 13 18:53:02 2006
@@ -5,7 +5,7 @@
     "http://struts.apache.org/dtds/struts-2.0.dtd">
     
 <struts>
-    <bean type="com.opensymphony.xwork.ObjectFactory" name="plexus" class="org.apache.struts2.plexus.PlexusObjectFactory" />
+    <bean type="com.opensymphony.xwork2.ObjectFactory" name="plexus" class="org.apache.struts2.plexus.PlexusObjectFactory" />
     
     <!--  Make the Plexus object factory the automatic default -->
     <constant name="struts.objectFactory" value="plexus" />

Added: struts/struts2/trunk/plugins/spring/pom.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/spring/pom.xml?view=auto&rev=474633
==============================================================================
--- struts/struts2/trunk/plugins/spring/pom.xml (added)
+++ struts/struts2/trunk/plugins/spring/pom.xml Mon Nov 13 18:53:02 2006
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.struts</groupId>
+        <artifactId>struts2-plugins</artifactId>
+        <version>2.0.2-SNAPSHOT</version>
+    </parent>
+    <groupId>org.apache.struts</groupId>
+    <artifactId>struts2-spring-plugin</artifactId>
+    <packaging>jar</packaging>
+    <name>Struts 2 Spring Plugin</name>
+    
+    <scm>
+       <connection>scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/spring/</connection>
+       <developerConnection>scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/spring/</developerConnection>
+       <url>http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/plugins/spring/</url>
+    </scm>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>1.2.8</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>1.2.8</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>1.2.8</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <version>1.2.8</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-mock</artifactId>
+            <version>1.2.8</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+            <version>3.8.1</version>
+        </dependency>
+
+
+   </dependencies>
+</project>

Added: struts/struts2/trunk/plugins/spring/src/main/resources/struts-plugin.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/spring/src/main/resources/struts-plugin.xml?view=auto&rev=474633
==============================================================================
--- struts/struts2/trunk/plugins/spring/src/main/resources/struts-plugin.xml (added)
+++ struts/struts2/trunk/plugins/spring/src/main/resources/struts-plugin.xml Mon Nov 13 18:53:02 2006
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!DOCTYPE struts PUBLIC
+    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+    "http://struts.apache.org/dtds/struts-2.0.dtd">
+    
+<struts>
+    <bean type="com.opensymphony.xwork2.ObjectFactory" name="spring" class="org.apache.struts2.spring.StrutsSpringObjectFactory" />
+    
+    <!--  Make the Spring object factory the automatic default -->
+    <constant name="struts.objectFactory" value="spring" />
+
+    <package name="spring-default">
+        <interceptors>
+            <interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/>
+            <interceptor name="sessionAutowiring" class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor"/>
+        </interceptors>
+    </package>    
+</struts>

Modified: struts/struts2/trunk/plugins/spring/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/spring/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java?view=diff&rev=474633&r1=474536&r2=474633
==============================================================================
--- struts/struts2/trunk/plugins/spring/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java (original)
+++ struts/struts2/trunk/plugins/spring/src/test/java/org/apache/struts2/spring/StrutsSpringObjectFactoryTest.java Mon Nov 13 18:53:02 2006
@@ -22,8 +22,8 @@
 
 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 @@
  * 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