more tests now extend StrutsTestCase like they should; StrutsTestCase resets more stuff like it should; refactored maven build to reduce version number repetition

git-svn-id: https://svn.apache.org/repos/asf/incubator/webwork2@396345 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Lightbody
2006-04-23 23:48:36 +00:00
parent 08e666d594
commit 9bdb2615d1
22 changed files with 132 additions and 262 deletions
-1
View File
@@ -8,7 +8,6 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>action</artifactId>
<packaging>jar</packaging>
<name>Struts Action Framework 2.0</name>
@@ -18,7 +18,9 @@
package org.apache.struts.action2;
import org.apache.struts.action2.config.Configuration;
import org.apache.struts.action2.dispatcher.DispatcherUtils;
import com.opensymphony.xwork.XWorkTestCase;
import com.opensymphony.xwork.util.LocalizedTextUtil;
/**
* Base test case for unit testing WebWork.
@@ -27,7 +29,9 @@ public abstract class StrutsTestCase extends XWorkTestCase {
protected void setUp() throws Exception {
super.setUp();
DispatcherUtils.setInstance(null);
Configuration.reset();
LocalizedTextUtil.clearDefaultResourceBundles();
}
protected void tearDown() throws Exception {
@@ -20,6 +20,7 @@ package org.apache.struts.action2.dispatcher;
import java.util.Locale;
import org.springframework.mock.web.MockServletContext;
import org.apache.struts.action2.StrutsTestCase;
import com.opensymphony.xwork.util.LocalizedTextUtil;
@@ -29,7 +30,7 @@ import junit.framework.TestCase;
* Test case for DispatcherUtils.
*
*/
public class DispatcherUtilsTest extends TestCase {
public class DispatcherUtilsTest extends StrutsTestCase {
public void testDefaultResurceBundlePropertyLoaded() throws Exception {
Locale.setDefault(Locale.US); // force to US locale as we also have _de and _da properties
@@ -20,6 +20,7 @@ package org.apache.struts.action2.dispatcher;
import com.mockobjects.dynamic.C;
import com.mockobjects.dynamic.Mock;
import org.apache.struts.action2.ServletActionContext;
import org.apache.struts.action2.StrutsTestCase;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.XWorkTestCase;
@@ -34,7 +35,7 @@ import java.util.Map;
* HttpHeaderResultTest
*
*/
public class HttpHeaderResultTest extends XWorkTestCase {
public class HttpHeaderResultTest extends StrutsTestCase {
ActionInvocation invocation;
HttpHeaderResult result;
@@ -19,6 +19,7 @@ package org.apache.struts.action2.interceptor;
import org.apache.struts.action2.ServletActionContext;
import org.apache.struts.action2.TestConfigurationProvider;
import org.apache.struts.action2.StrutsTestCase;
import org.apache.struts.action2.util.TokenHelper;
import org.apache.struts.action2.views.jsp.StrutsMockHttpServletRequest;
import org.apache.struts.action2.views.jsp.StrutsMockHttpSession;
@@ -40,7 +41,7 @@ import java.util.Map;
* TokenInterceptorTest
*
*/
public class TokenInterceptorTest extends TestCase {
public class TokenInterceptorTest extends StrutsTestCase {
ActionContext oldContext;
HttpSession httpSession;
@@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
import org.easymock.MockControl;
import org.apache.struts.action2.ServletActionContext;
import org.apache.struts.action2.StrutsTestCase;
import junit.framework.TestCase;
@@ -33,7 +34,7 @@ import junit.framework.TestCase;
* Test for the {@link PreparatorServletTest}
*
*/
public class PreparatorServletTest extends TestCase {
public class PreparatorServletTest extends StrutsTestCase {
/**
* Test that the service method stores the request, response and servlet context
@@ -29,6 +29,7 @@ import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockRequestDispatcher;
import org.apache.struts.action2.TestAction;
import org.apache.struts.action2.StrutsTestCase;
import org.apache.struts.action2.util.ListEntry;
import org.apache.struts.action2.util.StrutsUtil;
import com.opensymphony.xwork.util.OgnlValueStack;
@@ -39,7 +40,7 @@ import junit.framework.TestCase;
* Test case for StrutsUtil.
*
*/
public class StrutsUtilTest extends TestCase {
public class StrutsUtilTest extends StrutsTestCase {
protected OgnlValueStack stack = null;
protected InternalMockHttpServletRequest request = null;
@@ -18,6 +18,7 @@
package org.apache.struts.action2.spring;
import org.apache.struts.action2.StrutsConstants;
import org.apache.struts.action2.StrutsTestCase;
import org.apache.struts.action2.config.Configuration;
import junit.framework.TestCase;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
@@ -32,7 +33,7 @@ import javax.servlet.ServletContext;
* Unit test for {@link StrutsSpringObjectFactory}.
*
*/
public class StrutsSpringObjectFactoryTest extends TestCase {
public class StrutsSpringObjectFactoryTest extends StrutsTestCase {
public void testNoSpringContext() throws Exception {
// to cover situations where there will be logged an error
@@ -20,6 +20,7 @@ package org.apache.struts.action2.views.jsp;
import com.mockobjects.servlet.MockJspWriter;
import com.mockobjects.servlet.MockPageContext;
import org.apache.struts.action2.ServletActionContext;
import org.apache.struts.action2.StrutsTestCase;
import org.apache.struts.action2.components.If;
import com.opensymphony.xwork.util.OgnlValueStack;
import junit.framework.TestCase;
@@ -30,7 +31,7 @@ import javax.servlet.jsp.tagext.TagSupport;
/**
*/
public class ElseTagTest extends TestCase {
public class ElseTagTest extends StrutsTestCase {
ElseTag elseTag;
MockPageContext pageContext;
@@ -18,6 +18,7 @@
package org.apache.struts.action2.views.xslt;
import org.apache.struts.action2.ServletActionContext;
import org.apache.struts.action2.StrutsTestCase;
import com.opensymphony.xwork.Action;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.mock.MockActionInvocation;
@@ -36,7 +37,7 @@ import java.util.ArrayList;
* Unit test for {@link XSLTResult}.
*
*/
public class XSLTResultTest extends TestCase {
public class XSLTResultTest extends StrutsTestCase {
private XSLTResult result;
private MockHttpServletResponse response;
+111 -3
View File
@@ -133,7 +133,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<configuration>
<jdkName>1.4</jdkName>
<jdkName>1.5</jdkName>
<exclude>target,test-output,.clover</exclude>
<useShortDependencyNames>true</useShortDependencyNames>
<libraries>
@@ -151,8 +151,8 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
@@ -173,4 +173,112 @@
<developerConnection>scm:svn:http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</developerConnection>
<url>http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</url>
</scm>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.struts.action2</groupId>
<artifactId>action</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts.action2</groupId>
<version>${project.version}</version>
<artifactId>action-jasperreports</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts.action2</groupId>
<version>${project.version}</version>
<artifactId>action-jfreechart</artifactId>
</dependency>
<dependency>
<groupId>org.apache.struts.action2</groupId>
<version>${project.version}</version>
<artifactId>action-pell-file-upload</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>mockobjects</groupId>
<artifactId>mockobjects-core</artifactId>
<version>0.09</version>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>pell-multipart</artifactId>
<version>2.1.5</version>
</dependency>
<dependency>
<groupId>portlet-api</groupId>
<artifactId>portlet-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>cewolf</groupId>
<artifactId>cewolf</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
-75
View File
@@ -8,93 +8,18 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>action-jasperreports</artifactId>
<packaging>jar</packaging>
<name>JasperReports</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</connection>
<developerConnection>scm:svn:http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</developerConnection>
<url>http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</url>
</scm>
<profiles>
<profile>
<activation>
<jdk>1.4</jdk>
</activation>
<dependencies>
<!-- should have the org.w3c.dom dependency here -->
</dependencies>
</profile>
</profiles>
<repositories>
<repository>
<id>opensymphony</id>
<name>opensymphony</name>
<layout>legacy</layout>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
<url>http://maven.opensymphony.com</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<configuration>
<jdkName>1.4</jdkName>
<exclude>target,test-output,.clover</exclude>
<useShortDependencyNames>true</useShortDependencyNames>
<libraries>
<library>
<name>xwork</name>
<sources>file://$xwork$/src/java</sources>
</library>
<library>
<name>xwork-tiger</name>
<sources>file://$xwork$/tiger/src/java</sources>
</library>
</libraries>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/TestBean.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
-75
View File
@@ -8,87 +8,13 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>action-jfreechart</artifactId>
<packaging>jar</packaging>
<name>JFree Chart</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</connection>
<developerConnection>scm:svn:http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</developerConnection>
<url>http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</url>
</scm>
<profiles>
<profile>
<activation>
<jdk>1.4</jdk>
</activation>
<dependencies>
<!-- should have the org.w3c.dom dependency here -->
</dependencies>
</profile>
</profiles>
<repositories>
<repository>
<id>opensymphony</id>
<name>opensymphony</name>
<layout>legacy</layout>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
<url>http://maven.opensymphony.com</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<configuration>
<jdkName>1.4</jdkName>
<exclude>target,test-output,.clover</exclude>
<useShortDependencyNames>true</useShortDependencyNames>
<libraries>
<library>
<name>xwork</name>
<sources>file://$xwork$/src/java</sources>
</library>
<library>
<name>xwork-tiger</name>
<sources>file://$xwork$/tiger/src/java</sources>
</library>
</libraries>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/TestBean.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.0</version>
<optional>true</optional>
<exclusions>
<exclusion>
@@ -101,7 +27,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
-76
View File
@@ -8,95 +8,19 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>action-pell-file-upload</artifactId>
<packaging>jar</packaging>
<name>Pell File Upload</name>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</connection>
<developerConnection>scm:svn:http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</developerConnection>
<url>http://svn.apache.org/repos/asf/incubator/webwork2/trunk/</url>
</scm>
<profiles>
<profile>
<activation>
<jdk>1.4</jdk>
</activation>
<dependencies>
<!-- should have the org.w3c.dom dependency here -->
</dependencies>
</profile>
</profiles>
<repositories>
<repository>
<id>opensymphony</id>
<name>opensymphony</name>
<layout>legacy</layout>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
<url>http://maven.opensymphony.com</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<configuration>
<jdkName>1.4</jdkName>
<exclude>target,test-output,.clover</exclude>
<useShortDependencyNames>true</useShortDependencyNames>
<libraries>
<library>
<name>xwork</name>
<sources>file://$xwork$/src/java</sources>
</library>
<library>
<name>xwork-tiger</name>
<sources>file://$xwork$/tiger/src/java</sources>
</library>
</libraries>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<excludes>
<exclude>**/TestBean.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>pell-multipart</artifactId>
<!-- webwork's ivy dependency reports mentions v1.19 ? -->
<version>2.1.5</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
-2
View File
@@ -8,7 +8,6 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>thirdparty</artifactId>
<packaging>pom</packaging>
<name>Third Party Modules</name>
@@ -21,7 +20,6 @@
<dependency>
<groupId>org.apache.struts.action2</groupId>
<artifactId>action</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
+1 -6
View File
@@ -8,7 +8,6 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>action-all</artifactId>
<packaging>pom</packaging>
<name>Uber Jar</name>
@@ -38,24 +37,20 @@
<dependency>
<groupId>org.apache.struts.action2</groupId>
<artifactId>action</artifactId>
<version>2.0-SNAPSHOT</version>
<scope>provided</scope>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>action-jasperreports</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>action-jfreechart</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>action-pell-file-upload</artifactId>
<scope>test</scope>
</dependency>
-1
View File
@@ -8,7 +8,6 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>webapp-blank</artifactId>
<packaging>war</packaging>
<name>Blank Webapp</name>
-3
View File
@@ -8,7 +8,6 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>webapps</artifactId>
<packaging>pom</packaging>
<name>Webapps</name>
@@ -23,13 +22,11 @@
<dependency>
<groupId>org.apache.struts.action2</groupId>
<artifactId>action</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
-3
View File
@@ -8,7 +8,6 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>webapp-portlet</artifactId>
<packaging>war</packaging>
<name>Portet Webapp</name>
@@ -16,14 +15,12 @@
<dependency>
<groupId>portlet-api</groupId>
<artifactId>portlet-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.0</version>
</dependency>
<dependency>
-1
View File
@@ -8,7 +8,6 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>webapp-shopping-cart</artifactId>
<packaging>war</packaging>
<name>Shopping Cart Webapp</name>
-7
View File
@@ -8,7 +8,6 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>webapp-showcase</artifactId>
<packaging>war</packaging>
<name>Showcase Webapp</name>
@@ -16,37 +15,31 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</project>
-1
View File
@@ -8,7 +8,6 @@
<version>2.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.struts.action2</groupId>
<version>2.0-SNAPSHOT</version>
<artifactId>webapp-starter</artifactId>
<packaging>war</packaging>
<name>Starter Webapp</name>