diff --git a/core/pom.xml b/core/pom.xml
index bca4f9993..f5ea6dd6d 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -334,18 +334,8 @@
junit
junit
- compile
+ test
3.8.2
-
- true
-
-
-
- org.testng
- testng
- 5.1
- true
- jdk15
diff --git a/core/src/main/java/org/apache/struts2/StrutsTestCase.java b/core/src/test/java/org/apache/struts2/StrutsTestCase.java
similarity index 100%
rename from core/src/main/java/org/apache/struts2/StrutsTestCase.java
rename to core/src/test/java/org/apache/struts2/StrutsTestCase.java
diff --git a/plugins/codebehind/pom.xml b/plugins/codebehind/pom.xml
index 1b6b19871..cd87800ef 100644
--- a/plugins/codebehind/pom.xml
+++ b/plugins/codebehind/pom.xml
@@ -41,6 +41,12 @@
+
+ ${pom.groupId}
+ struts2-junit-plugin
+ ${pom.version}
+ test
+
junit
junit
diff --git a/plugins/dojo/pom.xml b/plugins/dojo/pom.xml
index 7cc4a9584..898255365 100644
--- a/plugins/dojo/pom.xml
+++ b/plugins/dojo/pom.xml
@@ -128,6 +128,7 @@
+
org.apache.struts
@@ -155,20 +156,15 @@
junit
junit
- compile
+ test
3.8.2
-
- true
-
- org.testng
- testng
- 5.1
- true
- jdk15
+ ${pom.groupId}
+ struts2-junit-plugin
+ ${pom.version}
+ test
-
jmock
jmock
@@ -242,7 +238,7 @@
org.springframework
spring-mock
2.0.8
- true
+ test
diff --git a/plugins/junit/pom.xml b/plugins/junit/pom.xml
new file mode 100644
index 000000000..9c9a84bd1
--- /dev/null
+++ b/plugins/junit/pom.xml
@@ -0,0 +1,60 @@
+
+
+
+ 4.0.0
+
+ org.apache.struts
+ struts2-plugins
+ 2.1.1-SNAPSHOT
+
+ org.apache.struts
+ struts2-junit-plugin
+ jar
+ Struts 2 JUnit Plugin
+
+
+ scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/junit/
+ scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/junit/
+ http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/plugins/junit/
+
+
+
+
+ junit
+ junit
+ 3.8.2
+
+
+ org.springframework
+ spring-mock
+ 2.0.8
+
+
+ org.springframework
+ spring-core
+ 2.0.8
+
+
+
diff --git a/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java b/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java
new file mode 100644
index 000000000..6a208edf4
--- /dev/null
+++ b/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java
@@ -0,0 +1,96 @@
+/*
+ * $Id: StrutsTestCase.java 588186 2007-10-25 10:01:04Z mrdon $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Formatter;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+
+import org.apache.struts2.dispatcher.Dispatcher;
+import org.apache.struts2.util.StrutsTestCaseHelper;
+
+import com.opensymphony.xwork2.XWorkTestCase;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
+import com.opensymphony.xwork2.util.logging.jdk.JdkLoggerFactory;
+
+/**
+ * Base test case for JUnit testing Struts.
+ */
+public abstract class StrutsTestCase extends XWorkTestCase {
+
+ static {
+ ConsoleHandler handler = new ConsoleHandler();
+ final SimpleDateFormat df = new SimpleDateFormat("mm:ss.SSS");
+ Formatter formatter = new Formatter() {
+ @Override
+ public String format(LogRecord record) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(record.getLevel());
+ sb.append(':');
+ for (int x=9-record.getLevel().toString().length(); x>0; x--) {
+ sb.append(' ');
+ }
+ sb.append('[');
+ sb.append(df.format(new Date(record.getMillis())));
+ sb.append("] ");
+ sb.append(formatMessage(record));
+ sb.append('\n');
+ return sb.toString();
+ }
+ };
+ handler.setFormatter(formatter);
+ Logger logger = Logger.getLogger("");
+ if (logger.getHandlers().length > 0)
+ logger.removeHandler(logger.getHandlers ()[0]);
+ logger.addHandler(handler);
+ logger.setLevel(Level.WARNING);
+ LoggerFactory.setLoggerFactory(new JdkLoggerFactory());
+ }
+
+ /**
+ * Sets up the configuration settings, XWork configuration, and
+ * message resources
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ initDispatcher(null);
+ }
+
+ protected Dispatcher initDispatcher(Map params) {
+ Dispatcher du = StrutsTestCaseHelper.initDispatcher(params);
+ configurationManager = du.getConfigurationManager();
+ configuration = configurationManager.getConfiguration();
+ container = configuration.getContainer();
+ return du;
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ StrutsTestCaseHelper.tearDown();
+ }
+
+}
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 22f57526f..6e68cfdb4 100644
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -56,6 +56,8 @@
dojo
rest
portlet
+ junit
+ testng
@@ -72,8 +74,6 @@
junit
compile
3.8.2
-
- true
diff --git a/plugins/portlet/pom.xml b/plugins/portlet/pom.xml
index 4404091b6..36b004f5a 100644
--- a/plugins/portlet/pom.xml
+++ b/plugins/portlet/pom.xml
@@ -47,6 +47,12 @@
test
3.8.2
+
+ ${pom.groupId}
+ struts2-junit-plugin
+ ${pom.version}
+ test
+
javax.servlet
@@ -81,7 +87,7 @@
portlet-api
portlet-api
1.0
- true
+ provided
diff --git a/plugins/sitegraph/pom.xml b/plugins/sitegraph/pom.xml
index c13c1817e..3680dfd77 100644
--- a/plugins/sitegraph/pom.xml
+++ b/plugins/sitegraph/pom.xml
@@ -58,6 +58,12 @@
+
+ ${pom.groupId}
+ struts2-junit-plugin
+ ${pom.version}
+ test
+
javax.servlet
diff --git a/plugins/struts1/pom.xml b/plugins/struts1/pom.xml
index 28a4726b7..b4da9d6ef 100644
--- a/plugins/struts1/pom.xml
+++ b/plugins/struts1/pom.xml
@@ -46,6 +46,12 @@
struts-core
1.3.5
+
+ ${pom.groupId}
+ struts2-junit-plugin
+ ${pom.version}
+ test
+
mockobjects
@@ -59,7 +65,7 @@
org.springframework
spring-mock
2.0.8
- true
+ test
diff --git a/plugins/testng/pom.xml b/plugins/testng/pom.xml
new file mode 100644
index 000000000..210058157
--- /dev/null
+++ b/plugins/testng/pom.xml
@@ -0,0 +1,78 @@
+
+
+
+ 4.0.0
+
+ org.apache.struts
+ struts2-plugins
+ 2.1.1-SNAPSHOT
+
+ org.apache.struts
+ struts2-testng-plugin
+ jar
+ Struts 2 TestNG Plugin
+
+
+ scm:svn:http://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/testng/
+ scm:svn:https://svn.apache.org/repos/asf/struts/struts2/trunk/plugins/testng/
+ http://svn.apache.org/viewcvs.cgi/struts/struts2/trunk/plugins/testng/
+
+
+
+
+ org.testng
+ testng
+ 5.1
+ jdk15
+
+
+ org.springframework
+ spring-mock
+ 2.0.8
+
+
+ org.springframework
+ spring-core
+ 2.0.8
+
+
+
+ javax.servlet
+ servlet-api
+ 2.4
+ provided
+
+
+
+ javax.servlet
+ jsp-api
+ 2.0
+ provided
+
+
+
+
+
+
diff --git a/core/src/main/java/org/apache/struts2/TestNGStrutsTestCase.java b/plugins/testng/src/main/java/org/apache/struts2/StrutsTestCase.java
similarity index 93%
rename from core/src/main/java/org/apache/struts2/TestNGStrutsTestCase.java
rename to plugins/testng/src/main/java/org/apache/struts2/StrutsTestCase.java
index 10681068c..d75610bee 100644
--- a/core/src/main/java/org/apache/struts2/TestNGStrutsTestCase.java
+++ b/plugins/testng/src/main/java/org/apache/struts2/StrutsTestCase.java
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: TestNGStrutsTestCase.java 502294 2007-02-01 17:28:00Z niallp $
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -33,7 +33,7 @@ import com.opensymphony.xwork2.TestNGXWorkTestCase;
* Base test class for TestNG unit tests. Provides common Struts variables
* and performs Struts setup and teardown processes
*/
-public class TestNGStrutsTestCase extends TestNGXWorkTestCase {
+public class StrutsTestCase extends TestNGXWorkTestCase {
@BeforeTest
protected void setUp() throws Exception {
diff --git a/plugins/testng/src/main/java/org/apache/struts2/TestNGStrutsTestCase.java b/plugins/testng/src/main/java/org/apache/struts2/TestNGStrutsTestCase.java
new file mode 100644
index 000000000..f21ca8b8a
--- /dev/null
+++ b/plugins/testng/src/main/java/org/apache/struts2/TestNGStrutsTestCase.java
@@ -0,0 +1,30 @@
+/*
+ * $Id: TestNGStrutsTestCase.java 502294 2007-02-01 17:28:00Z niallp $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.struts2;
+
+/**
+ * Base test class for TestNG unit tests. Provides common Struts variables
+ * and performs Struts setup and teardown processes
+ * @deprecated since 2.1.1, use StrutsTestCase instead
+ */
+public class TestNGStrutsTestCase extends StrutsTestCase {
+}
+
diff --git a/core/src/test/java/org/apache/struts2/TestNGStrutsTestCaseTest.java b/plugins/testng/src/test/java/org/apache/struts2/TestNGStrutsTestCaseTest.java
similarity index 93%
rename from core/src/test/java/org/apache/struts2/TestNGStrutsTestCaseTest.java
rename to plugins/testng/src/test/java/org/apache/struts2/TestNGStrutsTestCaseTest.java
index 34d6dd902..53df36b89 100644
--- a/core/src/test/java/org/apache/struts2/TestNGStrutsTestCaseTest.java
+++ b/plugins/testng/src/test/java/org/apache/struts2/TestNGStrutsTestCaseTest.java
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: TestNGStrutsTestCaseTest.java 502294 2007-02-01 17:28:00Z niallp $
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -49,12 +49,12 @@ public class TestNGStrutsTestCaseTest extends TestCase {
}
}
- @Test
- public static class RunTest extends TestNGStrutsTestCase {
+ public static class RunTest extends StrutsTestCase {
public static boolean ran = false;
public static ConfigurationManager mgr;
public static Dispatcher du;
-
+
+ @Test
public void testRun() {
ran = true;
mgr = this.configurationManager;