You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2006/01/21 01:21:00 UTC
svn commit: r370938 [23/50] - in /struts: action/trunk/
action/trunk/conf/java/ action/trunk/src/java/org/apache/struts/
action/trunk/src/java/org/apache/struts/action/
action/trunk/src/java/org/apache/struts/chain/
action/trunk/src/java/org/apache/str...
Modified: struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestSetOriginalURI.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestSetOriginalURI.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestSetOriginalURI.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/chain/commands/servlet/TestSetOriginalURI.java Fri Jan 20 16:19:02 2006
@@ -1,63 +1,66 @@
-package org.apache.struts.chain.commands.servlet;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.chain.web.servlet.ServletWebContext;
-import org.apache.struts.Globals;
-import org.apache.struts.chain.commands.UnauthorizedActionException;
-import org.apache.struts.chain.contexts.ServletActionContext;
-import org.apache.struts.config.ActionConfig;
-import org.apache.struts.mock.MockActionServlet;
-import org.apache.struts.mock.MockHttpServletRequest;
-import org.apache.struts.mock.MockHttpServletResponse;
-import org.apache.struts.mock.MockPrincipal;
-import org.apache.struts.mock.MockServletConfig;
-import org.apache.struts.mock.MockServletContext;
-
-/* JUnitTest case for class: org.apache.struts.chain.commands.servlet.SetOriginalURI */
-public class TestSetOriginalURI extends TestCase {
-
- SetOriginalURI command = null;
-
- public TestSetOriginalURI(String _name) {
- super(_name);
- }
-
-
- /* setUp method for test case */
- protected void setUp() throws Exception {
- this.command = new SetOriginalURI();
- }
-
- /* tearDown method for test case */
- protected void tearDown() {
- }
-
- public void testSetOriginalURI() throws Exception {
- MockHttpServletRequest request = new MockHttpServletRequest("foo/", "bar.do", null, null);
- MockServletConfig servletConfig = new MockServletConfig();
- MockServletContext servletContext = new MockServletContext();
- MockActionServlet servlet = new MockActionServlet(servletContext, servletConfig);
- servlet.initInternal();
- ServletActionContext saContext = new ServletActionContext(servletContext, request, new MockHttpServletResponse());
- saContext.setActionServlet(servlet);
-
-
- boolean result = command.execute(saContext);
- assertTrue(!result);
- String uri = (String)request.getAttribute(Globals.ORIGINAL_URI_KEY);
- assertTrue("Original uri not correct: "+uri, "bar.do".equals(uri));
-
-
- request.setPathElements("foo/", "bar2.do", null, null);
- uri = (String)request.getAttribute(Globals.ORIGINAL_URI_KEY);
- assertTrue("Original uri not correct: "+uri, "bar.do".equals(uri));
-
- }
-
- /* Executes the test case */
- public static void main(String[] argv) {
- String[] testCaseList = {TestSetOriginalURI.class.getName()};
- junit.textui.TestRunner.main(testCaseList);
- }
-}
+package org.apache.struts.chain.commands.servlet;
+
+import junit.framework.TestCase;
+import org.apache.struts.Globals;
+import org.apache.struts.chain.contexts.ServletActionContext;
+import org.apache.struts.mock.MockActionServlet;
+import org.apache.struts.mock.MockHttpServletRequest;
+import org.apache.struts.mock.MockHttpServletResponse;
+import org.apache.struts.mock.MockServletConfig;
+import org.apache.struts.mock.MockServletContext;
+
+/* JUnitTest case for class: org.apache.struts.chain.commands.servlet.SetOriginalURI */
+
+public class TestSetOriginalURI extends TestCase {
+ SetOriginalURI command = null;
+
+ public TestSetOriginalURI(String _name) {
+ super(_name);
+ }
+
+ /* setUp method for test case */
+ protected void setUp() throws Exception {
+ this.command = new SetOriginalURI();
+ }
+
+ /* tearDown method for test case */
+ protected void tearDown() {
+ }
+
+ public void testSetOriginalURI()
+ throws Exception {
+ MockHttpServletRequest request = new MockHttpServletRequest("foo/",
+ "bar.do", null, null);
+ MockServletConfig servletConfig = new MockServletConfig();
+ MockServletContext servletContext = new MockServletContext();
+ MockActionServlet servlet = new MockActionServlet(servletContext,
+ servletConfig);
+
+ servlet.initInternal();
+
+ ServletActionContext saContext =
+ new ServletActionContext(servletContext,
+ request, new MockHttpServletResponse());
+
+ saContext.setActionServlet(servlet);
+
+ boolean result = command.execute(saContext);
+
+ assertTrue(!result);
+
+ String uri = (String) request.getAttribute(Globals.ORIGINAL_URI_KEY);
+
+ assertTrue("Original uri not correct: " + uri, "bar.do".equals(uri));
+
+ request.setPathElements("foo/", "bar2.do", null, null);
+ uri = (String) request.getAttribute(Globals.ORIGINAL_URI_KEY);
+ assertTrue("Original uri not correct: " + uri, "bar.do".equals(uri));
+ }
+
+ /* Executes the test case */
+ public static void main(String[] argv) {
+ String[] testCaseList = {TestSetOriginalURI.class.getName()};
+
+ junit.textui.TestRunner.main(testCaseList);
+ }
+}
Modified: struts/action/trunk/src/test/org/apache/struts/config/CustomMappingTest.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/config/CustomMappingTest.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/config/CustomMappingTest.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/config/CustomMappingTest.java Fri Jan 20 16:19:02 2006
@@ -1,31 +1,28 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.struts.config;
import org.apache.struts.action.ActionMapping;
/**
- * Custom action mapping used by TestModuleConfing
- *
+ * Custom action mapping used by TestModuleConfing
*/
public class CustomMappingTest extends ActionMapping {
-
private boolean pub = false;
public void setPublic(boolean val) {
@@ -34,6 +31,5 @@
public boolean getPublic() {
return pub;
- }
+ }
}
-
Modified: struts/action/trunk/src/test/org/apache/struts/config/TestActionConfig.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/config/TestActionConfig.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/config/TestActionConfig.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/config/TestActionConfig.java Fri Jan 20 16:19:02 2006
@@ -1,56 +1,50 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.struts.config;
import junit.framework.Test;
-import junit.framework.TestSuite;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import java.lang.reflect.InvocationTargetException;
/**
- * Unit tests for the <code>org.apache.struts.config.ActionConfig</code>
+ * Unit tests for the <code>org.apache.struts.config.ActionConfig</code>
* class. Currently only contains code to test the methods that support
* configuration inheritance.
- *
- * @version $Rev$ $Date$
+ *
+ * @version $Rev$ $Date: 2005-05-25 19:35:00 -0400 (Wed, 25 May 2005)
+ * $
*/
-public class TestActionConfig
- extends TestCase {
-
+public class TestActionConfig extends TestCase {
// ----------------------------------------------------- Instance Variables
-
/**
* The ModuleConfig we'll use.
*/
protected ModuleConfig config = null;
-
/**
* The common base we'll use.
- */
+ */
protected ActionConfig baseConfig = null;
-
-
- // ----------------------------------------------------------- Constructors
+ // ----------------------------------------------------------- Constructors
/**
* Construct a new instance of this test case.
@@ -58,39 +52,38 @@
* @param name Name of the test case
*/
public TestActionConfig(String name) {
-
super(name);
-
}
-
// --------------------------------------------------------- Public Methods
-
/**
* Set up instance variables required by this test case.
*/
public void setUp() {
-
ModuleConfigFactory factoryObject =
- ModuleConfigFactory.createFactory();
+ ModuleConfigFactory.createFactory();
+
config = factoryObject.createModuleConfig("");
// setup the base form
baseConfig = new ActionConfig();
baseConfig.setPath("/base");
- baseConfig.setType("org.apache.struts.actions.DummyAction");
-
+ baseConfig.setType("org.apache.struts.actions.DummyAction");
+
// set up success and failure forward
- ForwardConfig forward = new ForwardConfig("success","/success.jsp",false);
+ ForwardConfig forward = new ForwardConfig("success", "/success.jsp",
+ false);
+
baseConfig.addForwardConfig(forward);
-
- forward = new ForwardConfig("failure","/failure.jsp",false);
+
+ forward = new ForwardConfig("failure", "/failure.jsp", false);
forward.setProperty("forwardCount", "10");
baseConfig.addForwardConfig(forward);
-
+
// setup an exception handler
ExceptionConfig exceptionConfig = new ExceptionConfig();
+
exceptionConfig.setType("java.sql.SQLException");
exceptionConfig.setKey("msg.exception.sql");
exceptionConfig.setProperty("exceptionCount", "10");
@@ -99,233 +92,234 @@
// set some arbitrary properties
baseConfig.setProperty("label", "base");
baseConfig.setProperty("version", "1a");
-
+
// register it to our config
config.addActionConfig(baseConfig);
}
-
/**
* Return the tests included in this test suite.
*/
public static Test suite() {
-
return (new TestSuite(TestActionConfig.class));
-
}
-
/**
* Tear down instance variables required by this test case.
*/
public void tearDown() {
-
config = null;
baseConfig = null;
-
}
-
-
// ------------------------------------------------------- Individual Tests
-
/**
* Basic check that shouldn't detect circular inheritance.
- */
+ */
public void testCheckCircularInheritance() {
ActionConfig child = new ActionConfig();
+
child.setPath("/child");
child.setExtends("/base");
-
+
ActionConfig grandChild = new ActionConfig();
+
grandChild.setPath("/grandChild");
grandChild.setExtends("/child");
-
+
config.addActionConfig(child);
config.addActionConfig(grandChild);
-
+
assertTrue("Circular inheritance shouldn't have been detected",
!grandChild.checkCircularInheritance(config));
}
-
-
+
/**
* Basic check that should detect circular inheritance.
- */
+ */
public void testCheckCircularInheritanceError() {
ActionConfig child = new ActionConfig();
+
child.setPath("/child");
child.setExtends("/base");
-
+
ActionConfig grandChild = new ActionConfig();
+
grandChild.setPath("/grandChild");
grandChild.setExtends("/child");
// establish the circular relationship with base
baseConfig.setExtends("/grandChild");
-
+
config.addActionConfig(child);
config.addActionConfig(grandChild);
-
+
assertTrue("Circular inheritance should've been detected",
grandChild.checkCircularInheritance(config));
}
-
-
+
/**
* Test that processExtends() makes sure that a base action's own
* extension has been processed.
- */
- public void testProcessExtendsActionExtends()
+ */
+ public void testProcessExtendsActionExtends()
throws Exception {
-
CustomActionConfig first = new CustomActionConfig();
+
first.setPath("/first");
-
+
CustomActionConfig second = new CustomActionConfig();
+
second.setPath("/second");
second.setExtends("/first");
-
+
config.addActionConfig(first);
config.addActionConfig(second);
-
+
// set baseConfig to extend second
baseConfig.setExtends("/second");
-
+
baseConfig.processExtends(config);
-
+
assertTrue("The first action's processExtends() wasn't called",
first.processExtendsCalled);
assertTrue("The second action's processExtends() wasn't called",
second.processExtendsCalled);
}
-
-
+
/**
* Make sure that correct exception is thrown if a base action can't be
* found.
- */
- public void testProcessExtendsMissingAction()
+ */
+ public void testProcessExtendsMissingAction()
throws Exception {
-
baseConfig.setExtends("/someMissingAction");
+
try {
baseConfig.processExtends(config);
- fail("An exception should be thrown if a super form can't be found.");
- } catch (NullPointerException e) {
+ fail(
+ "An exception should be thrown if a super form can't be found.");
+ }
+ catch (NullPointerException e) {
// succeed
- } catch (InstantiationException e) {
+ }
+ catch (InstantiationException e) {
fail("Unrecognized exception thrown.");
}
-
}
-
-
+
/**
- * Test a typical form bean configuration extension where various
- * forwards and exception handlers should be inherited from a base form.
- * This method checks all the subelements.
- */
- public void testInheritFrom()
+ * Test a typical form bean configuration extension where various forwards
+ * and exception handlers should be inherited from a base form. This
+ * method checks all the subelements.
+ */
+ public void testInheritFrom()
throws Exception {
-
// create a basic subform
ActionConfig subConfig = new ActionConfig();
String subConfigPath = "subConfig";
+
subConfig.setPath(subConfigPath);
subConfig.setExtends("/base");
-
+
// override success
ForwardConfig forward = new ForwardConfig();
+
forward.setName("success");
forward.setPath("/newSuccess.jsp");
forward.setRedirect(true);
subConfig.addForwardConfig(forward);
-
+
// add an exception handler
ExceptionConfig handler = new ExceptionConfig();
+
handler.setType("java.lang.NullPointerException");
handler.setKey("msg.exception.npe");
subConfig.addExceptionConfig(handler);
-
+
// override arbitrary "label" property
subConfig.setProperty("label", "sub");
-
+
config.addActionConfig(subConfig);
-
+
subConfig.inheritFrom(baseConfig);
-
+
// check that our subConfig is still the one in the config
- assertSame("subConfig no longer in ModuleConfig",
- subConfig, config.findActionConfig("subConfig"));
-
+ assertSame("subConfig no longer in ModuleConfig", subConfig,
+ config.findActionConfig("subConfig"));
+
// check our configured sub config
assertNotNull("Action type was not inherited", subConfig.getType());
assertEquals("Wrong config path", subConfigPath, subConfig.getPath());
- assertEquals("Wrong config type", baseConfig.getType(), subConfig.getType());
-
+ assertEquals("Wrong config type", baseConfig.getType(),
+ subConfig.getType());
+
// check our forwards
ForwardConfig[] forwards = subConfig.findForwardConfigs();
+
assertEquals("Wrong forwards count", 2, forwards.length);
-
+
forward = subConfig.findForwardConfig("success");
assertNotNull("'success' forward was not found", forward);
- assertEquals("Wrong path for success", "/newSuccess.jsp",
+ assertEquals("Wrong path for success", "/newSuccess.jsp",
forward.getPath());
-
+
forward = subConfig.findForwardConfig("failure");
+
ForwardConfig origForward = baseConfig.findForwardConfig("failure");
+
assertNotNull("'failure' forward was not inherited", forward);
- assertEquals("Wrong type for 'failure'", origForward.getPath(),
+ assertEquals("Wrong type for 'failure'", origForward.getPath(),
forward.getPath());
assertEquals("Arbitrary property not copied",
- origForward.getProperty("forwardCount"),
+ origForward.getProperty("forwardCount"),
forward.getProperty("forwardCount"));
-
- // check our exceptions
+
+ // check our exceptions
ExceptionConfig[] handlers = subConfig.findExceptionConfigs();
+
assertEquals("Wrong exception config count", 2, handlers.length);
-
+
handler = subConfig.findExceptionConfig("java.sql.SQLException");
- ExceptionConfig origHandler = baseConfig.findExceptionConfig("java.sql.SQLException");
+
+ ExceptionConfig origHandler = baseConfig.findExceptionConfig(
+ "java.sql.SQLException");
+
assertNotNull("'SQLException' handler was not found", handler);
- assertEquals("Wrong key for 'SQLException'", origHandler.getKey(),
+ assertEquals("Wrong key for 'SQLException'", origHandler.getKey(),
handler.getKey());
assertEquals("Arbitrary property not copied",
- origHandler.getProperty("exceptionCount"),
+ origHandler.getProperty("exceptionCount"),
handler.getProperty("exceptionCount"));
-
-
- handler = subConfig.findExceptionConfig("java.lang.NullPointerException");
- assertNotNull("'NullPointerException' handler disappeared",
- handler);
-
+
+ handler = subConfig.findExceptionConfig(
+ "java.lang.NullPointerException");
+ assertNotNull("'NullPointerException' handler disappeared", handler);
+
// check the arbitrary properties
String version = subConfig.getProperty("version");
- assertEquals("Arbitrary property 'version' wasn't inherited",
- "1a", version);
+
+ assertEquals("Arbitrary property 'version' wasn't inherited", "1a",
+ version);
String label = subConfig.getProperty("label");
- assertEquals("Arbitrary property 'label' shouldn't have changed",
+
+ assertEquals("Arbitrary property 'label' shouldn't have changed",
"sub", label);
}
-
-
+
/**
* Used to detect that ActionConfig is making the right calls.
- */
- public static class CustomActionConfig
- extends ActionConfig {
-
+ */
+ public static class CustomActionConfig extends ActionConfig {
boolean processExtendsCalled = false;
- public void processExtends(ModuleConfig moduleConfig)
- throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {
+ public void processExtends(ModuleConfig moduleConfig)
+ throws ClassNotFoundException, IllegalAccessException,
+ InstantiationException, InvocationTargetException {
super.processExtends(moduleConfig);
processExtendsCalled = true;
}
}
-
-
}
Modified: struts/action/trunk/src/test/org/apache/struts/config/TestActionConfigMatcher.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/config/TestActionConfigMatcher.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/config/TestActionConfigMatcher.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/config/TestActionConfigMatcher.java Fri Jan 20 16:19:02 2006
@@ -1,172 +1,176 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.struts.config;
-
import junit.framework.Test;
import junit.framework.TestSuite;
-
-import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
-import org.apache.struts.config.ForwardConfig;
-import org.apache.struts.config.ActionConfig;
+import org.apache.struts.action.ActionMapping;
import org.apache.struts.mock.TestMockBase;
-
/**
* <p>Unit tests for <code>org.apache.struts.util.ActionConfigMatcher</code>.</p>
*
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-10-27 23:25:01 -0400 (Thu, 27 Oct 2005)
+ * $
*/
-
public class TestActionConfigMatcher extends TestMockBase {
-
-
// ----------------------------------------------------------------- Basics
-
-
public TestActionConfigMatcher(String name) {
super(name);
}
-
- public static void main(String args[]) {
- junit.awtui.TestRunner.main
- (new String[] { TestActionConfigMatcher.class.getName() } );
+ public static void main(String[] args) {
+ junit.awtui.TestRunner.main(new String[]{
+ TestActionConfigMatcher.class.getName()
+ });
}
-
public static Test suite() {
return (new TestSuite(TestActionConfigMatcher.class));
}
-
// ----------------------------------------------------- Instance Variables
-
-
-
// ----------------------------------------------------- Setup and Teardown
-
-
public void setUp() {
-
super.setUp();
-
}
-
public void tearDown() {
-
super.tearDown();
-
}
-
// ------------------------------------------------------- Individual Tests
-
-
// ---------------------------------------------------------- match()
-
-
public void testNoMatch() {
ActionConfig[] configs = new ActionConfig[1];
ActionConfig mapping = buildActionConfig("/foo");
+
configs[0] = mapping;
+
ActionConfigMatcher matcher = new ActionConfigMatcher(configs);
-
- assertNull("ActionConfig shouldn't be matched", matcher.match("/test"));
+
+ assertNull("ActionConfig shouldn't be matched",
+ matcher.match("/test"));
}
-
+
public void testNoWildcardMatch() {
ActionConfig[] configs = new ActionConfig[1];
ActionConfig mapping = buildActionConfig("/fooBar");
+
configs[0] = mapping;
+
ActionConfigMatcher matcher = new ActionConfigMatcher(configs);
-
- assertNull("ActionConfig shouldn't be matched", matcher.match("/fooBar"));
+
+ assertNull("ActionConfig shouldn't be matched",
+ matcher.match("/fooBar"));
}
-
+
public void testShouldMatch() {
ActionConfig[] configs = new ActionConfig[1];
ActionConfig mapping = buildActionConfig("/foo*");
+
configs[0] = mapping;
+
ActionConfigMatcher matcher = new ActionConfigMatcher(configs);
-
+
ActionConfig matched = matcher.match("/fooBar");
+
assertNotNull("ActionConfig should be matched", matched);
- assertTrue("ActionConfig should have two action forward", matched.findForwardConfigs().length == 2);
- assertTrue("ActionConfig should have two exception forward", matched.findExceptionConfigs().length == 2);
- assertTrue("ActionConfig should have properties", matched.getProperties().size() == 2);
+ assertTrue("ActionConfig should have two action forward",
+ matched.findForwardConfigs().length == 2);
+ assertTrue("ActionConfig should have two exception forward",
+ matched.findExceptionConfigs().length == 2);
+ assertTrue("ActionConfig should have properties",
+ matched.getProperties().size() == 2);
}
-
+
public void testCheckSubstitutionsMatch() {
ActionConfig[] configs = new ActionConfig[1];
ActionConfig mapping = buildActionConfig("/foo*");
+
configs[0] = mapping;
+
ActionConfigMatcher matcher = new ActionConfigMatcher(configs);
ActionConfig m = matcher.match("/fooBar");
-
- assertTrue("Name hasn't been replaced", "name,Bar".equals(m.getName()));
- assertTrue("Path hasn't been replaced", "/fooBar".equals(m.getPath()));
+
+ assertTrue("Name hasn't been replaced",
+ "name,Bar".equals(m.getName()));
+ assertTrue("Path hasn't been replaced",
+ "/fooBar".equals(m.getPath()));
assertTrue("Scope isn't correct", "request".equals(m.getScope()));
assertTrue("Unknown isn't correct", !m.getUnknown());
assertTrue("Validate isn't correct", m.getValidate());
- assertTrue("Prefix hasn't been replaced", "foo,Bar".equals(m.getPrefix()));
- assertTrue("Suffix hasn't been replaced", "bar,Bar".equals(m.getSuffix()));
- assertTrue("Type hasn't been replaced", "foo.bar.BarAction".equals(m.getType()));
- assertTrue("Roles hasn't been replaced", "public,Bar".equals(m.getRoles()));
- assertTrue("Parameter hasn't been replaced", "param,Bar".equals(m.getParameter()));
- assertTrue("Attribute hasn't been replaced", "attrib,Bar".equals(m.getAttribute()));
- assertTrue("Forward hasn't been replaced", "fwd,Bar".equals(m.getForward()));
- assertTrue("Include hasn't been replaced", "include,Bar".equals(m.getInclude()));
- assertTrue("Input hasn't been replaced", "input,Bar".equals(m.getInput()));
-
- assertTrue("ActionConfig property not replaced", "testBar".equals(m.getProperty("testprop2")));
+ assertTrue("Prefix hasn't been replaced",
+ "foo,Bar".equals(m.getPrefix()));
+ assertTrue("Suffix hasn't been replaced",
+ "bar,Bar".equals(m.getSuffix()));
+ assertTrue("Type hasn't been replaced",
+ "foo.bar.BarAction".equals(m.getType()));
+ assertTrue("Roles hasn't been replaced",
+ "public,Bar".equals(m.getRoles()));
+ assertTrue("Parameter hasn't been replaced",
+ "param,Bar".equals(m.getParameter()));
+ assertTrue("Attribute hasn't been replaced",
+ "attrib,Bar".equals(m.getAttribute()));
+ assertTrue("Forward hasn't been replaced",
+ "fwd,Bar".equals(m.getForward()));
+ assertTrue("Include hasn't been replaced",
+ "include,Bar".equals(m.getInclude()));
+ assertTrue("Input hasn't been replaced",
+ "input,Bar".equals(m.getInput()));
+ assertTrue("ActionConfig property not replaced",
+ "testBar".equals(m.getProperty("testprop2")));
ForwardConfig[] fConfigs = m.findForwardConfigs();
boolean found = false;
- for (int x=0; x<fConfigs.length; x++) {
+
+ for (int x = 0; x < fConfigs.length; x++) {
ForwardConfig cfg = fConfigs[x];
+
if ("name".equals(cfg.getName())) {
found = true;
- assertTrue("Path hasn't been replaced", "path,Bar".equals(cfg.getPath()));
- assertTrue("Property foo hasn't been replaced", "bar,Bar".equals(cfg.getProperty("foo")));
+ assertTrue("Path hasn't been replaced",
+ "path,Bar".equals(cfg.getPath()));
+ assertTrue("Property foo hasn't been replaced",
+ "bar,Bar".equals(cfg.getProperty("foo")));
}
}
+
assertTrue("The forward config 'name' cannot be found", found);
}
-
+
public void testCheckMultipleSubstitutions() {
ActionMapping[] mapping = new ActionMapping[1];
+
mapping[0] = new ActionMapping();
mapping[0].setPath("/foo*");
mapping[0].setName("name,{1}-{1}");
ActionConfigMatcher matcher = new ActionConfigMatcher(mapping);
ActionConfig m = matcher.match("/fooBar");
-
- assertTrue("Name hasn't been replaced correctly: "+m.getName(), "name,Bar-Bar".equals(m.getName()));
+
+ assertTrue("Name hasn't been replaced correctly: " + m.getName(),
+ "name,Bar-Bar".equals(m.getName()));
}
-
+
private ActionConfig buildActionConfig(String path) {
ActionMapping mapping = new ActionMapping();
@@ -178,7 +182,7 @@
mapping.setPrefix("foo,{1}");
mapping.setSuffix("bar,{1}");
-
+
mapping.setType("foo.bar.{1}Action");
mapping.setRoles("public,{1}");
mapping.setParameter("param,{1}");
@@ -188,17 +192,19 @@
mapping.setInput("input,{1}");
ForwardConfig cfg = new ActionForward();
+
cfg.setName("name");
cfg.setPath("path,{1}");
cfg.setProperty("foo", "bar,{1}");
mapping.addForwardConfig(cfg);
-
+
cfg = new ActionForward();
cfg.setName("name2");
cfg.setPath("path2");
mapping.addForwardConfig(cfg);
-
+
ExceptionConfig excfg = new ExceptionConfig();
+
excfg.setKey("foo");
excfg.setType("foo.Bar");
excfg.setPath("path");
@@ -217,6 +223,4 @@
return mapping;
}
-
-
}
Modified: struts/action/trunk/src/test/org/apache/struts/config/TestFormBeanConfig.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/config/TestFormBeanConfig.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/config/TestFormBeanConfig.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/config/TestFormBeanConfig.java Fri Jan 20 16:19:02 2006
@@ -1,56 +1,50 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.struts.config;
import junit.framework.Test;
-import junit.framework.TestSuite;
import junit.framework.TestCase;
+import junit.framework.TestSuite;
import java.lang.reflect.InvocationTargetException;
/**
- * Unit tests for the <code>org.apache.struts.config.FormBeanConfig</code>
+ * Unit tests for the <code>org.apache.struts.config.FormBeanConfig</code>
* class. Currently only contains code to test the methods that support
* configuration inheritance.
- *
- * @version $Rev$ $Date$
+ *
+ * @version $Rev$ $Date: 2005-05-25 19:35:00 -0400 (Wed, 25 May 2005)
+ * $
*/
-public class TestFormBeanConfig
- extends TestCase {
-
+public class TestFormBeanConfig extends TestCase {
// ----------------------------------------------------- Instance Variables
-
/**
* The ModuleConfig we'll use.
*/
protected ModuleConfig config = null;
-
/**
* The common base we'll use.
- */
+ */
protected FormBeanConfig baseForm = null;
-
-
- // ----------------------------------------------------------- Constructors
+ // ----------------------------------------------------------- Constructors
/**
* Construct a new instance of this test case.
@@ -58,31 +52,28 @@
* @param name Name of the test case
*/
public TestFormBeanConfig(String name) {
-
super(name);
-
}
-
// --------------------------------------------------------- Public Methods
-
/**
* Set up instance variables required by this test case.
*/
public void setUp() {
-
ModuleConfigFactory factoryObject =
- ModuleConfigFactory.createFactory();
+ ModuleConfigFactory.createFactory();
+
config = factoryObject.createModuleConfig("");
// setup the base form
baseForm = new FormBeanConfig();
baseForm.setName("baseForm");
baseForm.setType("org.apache.struts.action.DynaActionForm");
-
+
// set up id, name, and score
FormPropertyConfig property = new FormPropertyConfig();
+
property.setName("id");
property.setType("java.lang.String");
baseForm.addFormPropertyConfig(property);
@@ -92,261 +83,260 @@
property.setType("java.lang.String");
property.setProperty("count", "10");
baseForm.addFormPropertyConfig(property);
-
+
property = new FormPropertyConfig();
property.setName("score");
property.setType("java.lang.String");
baseForm.addFormPropertyConfig(property);
-
+
property = new FormPropertyConfig();
property.setName("message");
property.setType("java.lang.String");
baseForm.addFormPropertyConfig(property);
-
+
// register it to our config
config.addFormBeanConfig(baseForm);
}
-
/**
* Return the tests included in this test suite.
*/
public static Test suite() {
-
return (new TestSuite(TestFormBeanConfig.class));
-
}
-
/**
* Tear down instance variables required by this test case.
*/
public void tearDown() {
-
config = null;
baseForm = null;
-
}
-
-
// ------------------------------------------------------- Individual Tests
-
/**
* Basic check that shouldn't detect an error.
- */
+ */
public void testCheckCircularInheritance() {
FormBeanConfig child = new FormBeanConfig();
+
child.setName("child");
child.setExtends("baseForm");
-
+
FormBeanConfig grandChild = new FormBeanConfig();
+
grandChild.setName("grandChild");
grandChild.setExtends("child");
-
+
config.addFormBeanConfig(child);
config.addFormBeanConfig(grandChild);
-
+
assertTrue("Circular inheritance shouldn't have been detected",
!grandChild.checkCircularInheritance(config));
}
-
-
+
/**
* Basic check that SHOULD detect an error.
- */
+ */
public void testCheckCircularInheritanceError() {
FormBeanConfig child = new FormBeanConfig();
+
child.setName("child");
child.setExtends("baseForm");
-
+
FormBeanConfig grandChild = new FormBeanConfig();
+
grandChild.setName("grandChild");
grandChild.setExtends("child");
-
+
// establish the circular relationship with base
baseForm.setExtends("grandChild");
-
+
config.addFormBeanConfig(child);
config.addFormBeanConfig(grandChild);
-
+
assertTrue("Circular inheritance should've been detected",
grandChild.checkCircularInheritance(config));
}
-
-
+
/**
- * Test that processExtends() makes sure that a base form's own
- * extension has been processed.
- */
- public void testProcessExtendsBaseFormExtends()
+ * Test that processExtends() makes sure that a base form's own extension
+ * has been processed.
+ */
+ public void testProcessExtendsBaseFormExtends()
throws Exception {
-
CustomFormBeanConfig first = new CustomFormBeanConfig();
+
first.setName("first");
-
+
CustomFormBeanConfig second = new CustomFormBeanConfig();
+
second.setName("second");
second.setExtends("first");
-
+
config.addFormBeanConfig(first);
config.addFormBeanConfig(second);
-
+
// set baseForm to extend second
baseForm.setExtends("second");
-
+
baseForm.processExtends(config);
-
+
assertTrue("The first form's processExtends() wasn't called",
first.processExtendsCalled);
assertTrue("The second form's processExtends() wasn't called",
second.processExtendsCalled);
}
-
-
+
/**
* Make sure that correct exception is thrown if a base form can't be
* found.
- */
- public void testProcessExtendsMissingBaseForm()
+ */
+ public void testProcessExtendsMissingBaseForm()
throws Exception {
-
baseForm.setExtends("someMissingForm");
+
try {
baseForm.processExtends(config);
- fail("An exception should be thrown if a super form can't be found.");
- } catch (NullPointerException e) {
+ fail(
+ "An exception should be thrown if a super form can't be found.");
+ }
+ catch (NullPointerException e) {
// succeed
- } catch (InstantiationException e) {
+ }
+ catch (InstantiationException e) {
fail("Unrecognized exception thrown.");
}
-
}
-
-
+
/**
* Test a typical form bean configuration extension where various
* properties should be inherited from a base form. This method checks
* all the properties.
- */
- public void testInheritFrom()
+ */
+ public void testInheritFrom()
throws Exception {
-
// give baseForm some arbitrary parameters
String baseFormCount = "1";
+
baseForm.setProperty("count", baseFormCount);
-
+
// create a basic subform
FormBeanConfig subForm = new FormBeanConfig();
String subFormName = "subForm";
+
subForm.setName(subFormName);
subForm.setExtends("baseForm");
-
+
// override score
FormPropertyConfig property = new FormPropertyConfig();
+
property.setName("score");
property.setType("java.lang.Integer");
subForm.addFormPropertyConfig(property);
-
- // ... and id
+
+ // ... and id
property = new FormPropertyConfig();
property.setName("id");
property.setType("java.lang.String");
property.setInitial("unknown");
subForm.addFormPropertyConfig(property);
-
+
// ... and message
property = new FormPropertyConfig();
property.setName("message");
property.setType("java.lang.String");
property.setSize(10);
subForm.addFormPropertyConfig(property);
-
+
config.addFormBeanConfig(subForm);
-
+
subForm.inheritFrom(baseForm);
-
+
// check that our subForm is still the one in the config
- assertSame("subForm no longer in ModuleConfig",
- subForm, config.findFormBeanConfig("subForm"));
-
+ assertSame("subForm no longer in ModuleConfig", subForm,
+ config.findFormBeanConfig("subForm"));
+
// check our configured sub form
assertNotNull("Form bean type was not inherited", subForm.getType());
assertEquals("Wrong form bean name", subFormName, subForm.getName());
- assertEquals("Wrong form bean type", baseForm.getType(), subForm.getType());
- assertEquals("Wrong restricted value",
- baseForm.isRestricted(), subForm.isRestricted());
-
- FormPropertyConfig[] formPropertyConfigs = subForm.findFormPropertyConfigs();
+ assertEquals("Wrong form bean type", baseForm.getType(),
+ subForm.getType());
+ assertEquals("Wrong restricted value", baseForm.isRestricted(),
+ subForm.isRestricted());
+
+ FormPropertyConfig[] formPropertyConfigs = subForm
+ .findFormPropertyConfigs();
+
assertEquals("Wrong prop count", 4, formPropertyConfigs.length);
// we want to check that the form is EXACTLY as we want it, so
// here are some fine grain checks
property = subForm.findFormPropertyConfig("name");
+
FormPropertyConfig original = baseForm.findFormPropertyConfig("name");
+
assertNotNull("'name' property was not inherited", property);
- assertEquals("Wrong type for name", original.getType(),
+ assertEquals("Wrong type for name", original.getType(),
property.getType());
assertEquals("Wrong initial value for name", original.getInitial(),
property.getInitial());
assertEquals("Wrong size value for name", original.getSize(),
property.getSize());
-
+
property = subForm.findFormPropertyConfig("id");
original = baseForm.findFormPropertyConfig("id");
assertNotNull("'id' property was not found", property);
- assertEquals("Wrong type for id", original.getType(),
+ assertEquals("Wrong type for id",
+ original.getType(),
property.getType());
assertEquals("Wrong initial value for id", "unknown",
property.getInitial());
assertEquals("Wrong size value for id", original.getSize(),
property.getSize());
-
+
property = subForm.findFormPropertyConfig("score");
original = baseForm.findFormPropertyConfig("score");
assertNotNull("'score' property was not found", property);
- assertEquals("Wrong type for score", "java.lang.Integer",
+ assertEquals("Wrong type for score", "java.lang.Integer",
property.getType());
assertEquals("Wrong initial value for score", original.getInitial(),
property.getInitial());
assertEquals("Wrong size value for score", original.getSize(),
property.getSize());
-
+
property = subForm.findFormPropertyConfig("message");
original = baseForm.findFormPropertyConfig("message");
assertNotNull("'message' property was not found", property);
- assertEquals("Wrong type for message", original.getType(),
+ assertEquals("Wrong type for message", original.getType(),
property.getType());
assertEquals("Wrong initial value for message", original.getInitial(),
property.getInitial());
assertEquals("Wrong size value for message", 10, property.getSize());
-
+
property = subForm.findFormPropertyConfig("name");
original = baseForm.findFormPropertyConfig("name");
- assertEquals("Arbitrary property not found",
+ assertEquals("Arbitrary property not found",
original.getProperty("count"), property.getProperty("count"));
String count = subForm.getProperty("count");
- assertEquals("Arbitrary property was not inherited",
- baseFormCount, count);
- }
+ assertEquals("Arbitrary property was not inherited", baseFormCount,
+ count);
+ }
/**
* Used to detect that FormBeanConfig is making the right calls.
- */
- public static class CustomFormBeanConfig
- extends FormBeanConfig {
-
+ */
+ public static class CustomFormBeanConfig extends FormBeanConfig {
boolean processExtendsCalled = false;
- public void processExtends(ModuleConfig moduleConfig)
- throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {
+ public void processExtends(ModuleConfig moduleConfig)
+ throws ClassNotFoundException, IllegalAccessException,
+ InstantiationException, InvocationTargetException {
super.processExtends(moduleConfig);
processExtendsCalled = true;
}
}
-
-
}
Modified: struts/action/trunk/src/test/org/apache/struts/config/TestFormPropertyConfig.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/config/TestFormPropertyConfig.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/config/TestFormPropertyConfig.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/config/TestFormPropertyConfig.java Fri Jan 20 16:19:02 2006
@@ -1,14 +1,14 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.
@@ -20,107 +20,118 @@
import junit.framework.TestCase;
/**
- * Unit tests for the <code>org.apache.struts.config.FormPropertyConfig</code>
+ * Unit tests for the <code>org.apache.struts.config.FormPropertyConfig</code>
* class.
- *
- * @version $Rev$ $Date$
+ *
+ * @version $Rev$ $Date: 2005-05-21 19:06:53 -0400 (Sat, 21 May 2005)
+ * $
*/
-public class TestFormPropertyConfig
- extends TestCase {
-
-
- public void testBasicInherit()
+public class TestFormPropertyConfig extends TestCase {
+ public void testBasicInherit()
throws Exception {
- FormPropertyConfig base =
- new FormPropertyConfig("base", "java.lang.String[]", "", 10);
+ FormPropertyConfig base = new FormPropertyConfig("base",
+ "java.lang.String[]", "", 10);
String baseCount = "10";
+
base.setProperty("count", baseCount);
-
+
FormPropertyConfig sub = new FormPropertyConfig();
+
sub.setName("base");
-
+
sub.inheritFrom(base);
-
+
assertEquals("Type was not inherited", base.getType(), sub.getType());
- assertEquals("Initial is incorrect",
- base.getInitial(), sub.getInitial());
+ assertEquals("Initial is incorrect",
+ base.getInitial(),
+ sub.getInitial());
assertEquals("Size was not inherited", base.getSize(), sub.getSize());
- assertEquals("Arbitrary config property was not inherited",
- baseCount, sub.getProperty("count"));
+ assertEquals("Arbitrary config property was not inherited", baseCount,
+ sub.getProperty("count"));
}
-
- public void testInheritWithInitialOverride()
+
+ public void testInheritWithInitialOverride()
throws Exception {
- FormPropertyConfig base =
- new FormPropertyConfig("base", "java.lang.String", "value");
-
+ FormPropertyConfig base = new FormPropertyConfig("base",
+ "java.lang.String", "value");
+
FormPropertyConfig sub = new FormPropertyConfig();
+
sub.setName("base");
+
String initial = "otherValue";
+
sub.setInitial(initial);
-
+
sub.inheritFrom(base);
-
+
assertEquals("Type was not inherited", base.getType(), sub.getType());
- assertEquals("Initial is incorrect",
- initial, sub.getInitial());
- assertEquals("Size is incorrect", base.getSize(), sub.getSize());
+ assertEquals("Initial is incorrect", initial, sub.getInitial());
+ assertEquals("Size is incorrect", base.getSize(), sub.getSize());
}
-
- public void testInheritWithTypeOverride()
+
+ public void testInheritWithTypeOverride()
throws Exception {
- FormPropertyConfig base =
- new FormPropertyConfig("base", "java.lang.String", "");
-
+ FormPropertyConfig base = new FormPropertyConfig("base",
+ "java.lang.String", "");
+
FormPropertyConfig sub = new FormPropertyConfig();
+
sub.setName("base");
sub.setType("java.lang.Integer");
-
+
sub.inheritFrom(base);
-
+
assertEquals("Type is incorrect", "java.lang.Integer", sub.getType());
- assertEquals("Initial is incorrect",
- base.getInitial(), sub.getInitial());
- assertEquals("Size is incorrect", base.getSize(), sub.getSize());
+ assertEquals("Initial is incorrect",
+ base.getInitial(),
+ sub.getInitial());
+ assertEquals("Size is incorrect", base.getSize(), sub.getSize());
}
-
- public void testInheritWithTypeOverride2()
+
+ public void testInheritWithTypeOverride2()
throws Exception {
- FormPropertyConfig base =
- new FormPropertyConfig("base", "java.lang.String", "");
-
+ FormPropertyConfig base = new FormPropertyConfig("base",
+ "java.lang.String", "");
+
FormPropertyConfig sub = new FormPropertyConfig();
+
sub.setName("base");
+
String type = "java.lang.Integer[]";
int size = 10;
+
sub.setType(type);
sub.setSize(size);
-
+
sub.inheritFrom(base);
-
+
assertEquals("Type is incorrect", type, sub.getType());
- assertEquals("Initial is incorrect",
- base.getInitial(), sub.getInitial());
- assertEquals("Size is incorrect", size, sub.getSize());
+ assertEquals("Initial is incorrect",
+ base.getInitial(),
+ sub.getInitial());
+ assertEquals("Size is incorrect", size, sub.getSize());
}
-
- public void testInheritWithSizeOverride()
+
+ public void testInheritWithSizeOverride()
throws Exception {
- FormPropertyConfig base =
- new FormPropertyConfig("base", "java.lang.String[]", "", 20);
-
+ FormPropertyConfig base = new FormPropertyConfig("base",
+ "java.lang.String[]", "", 20);
+
FormPropertyConfig sub = new FormPropertyConfig();
+
sub.setName("base");
+
int size = 50;
+
sub.setSize(size);
-
+
sub.inheritFrom(base);
-
+
assertEquals("Type was not inherited", base.getType(), sub.getType());
- assertEquals("Initial is incorrect",
- base.getInitial(), sub.getInitial());
- assertEquals("Size is incorrect", size, sub.getSize());
+ assertEquals("Initial is incorrect",
+ base.getInitial(),
+ sub.getInitial());
+ assertEquals("Size is incorrect", size, sub.getSize());
}
-
-
}
Modified: struts/action/trunk/src/test/org/apache/struts/config/TestForwardConfig.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/config/TestForwardConfig.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/config/TestForwardConfig.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/config/TestForwardConfig.java Fri Jan 20 16:19:02 2006
@@ -1,73 +1,64 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.struts.config;
-import junit.framework.TestCase;
import junit.framework.Test;
+import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
- * <p>Unit tests for ForwardConfig. Currently contains tests for methods
+ * <p>Unit tests for ForwardConfig. Currently contains tests for methods
* supporting configuration inheritance.</p>
- *
- * @version $Rev$ $Date$
+ *
+ * @version $Rev$ $Date: 2005-05-21 19:06:53 -0400 (Sat, 21 May 2005)
+ * $
*/
-public class TestForwardConfig
- extends TestCase {
-
-
+public class TestForwardConfig extends TestCase {
// ----------------------------------------------------- Instance Variables
-
/**
* The ModuleConfig we'll use.
*/
protected ModuleConfig moduleConfig = null;
-
/**
* The common base we'll use.
- */
+ */
protected ForwardConfig baseConfig = null;
-
/**
* The common subForward we'll use.
- */
+ */
protected ForwardConfig subConfig = null;
-
-
+
/**
* A ForwardConfig we'll use to test cases where a ForwardConfig declared
* for an action extends a ForwardConfig declared globally, with both
* ForwardConfigs using the same name.
- */
- protected ForwardConfig actionBaseConfig = null;
-
-
+ */
+ protected ForwardConfig actionBaseConfig = null;
+
/**
* An action mapping we'll use within tests.
*/
protected ActionConfig actionConfig = null;
-
- // ----------------------------------------------------------- Constructors
+ // ----------------------------------------------------------- Constructors
/**
* Construct a new instance of this test case.
@@ -75,29 +66,25 @@
* @param name Name of the test case
*/
public TestForwardConfig(String name) {
-
super(name);
-
}
-
// --------------------------------------------------------- Public Methods
-
/**
* Set up instance variables required by this test case.
*/
public void setUp() {
-
ModuleConfigFactory factoryObject =
- ModuleConfigFactory.createFactory();
+ ModuleConfigFactory.createFactory();
+
moduleConfig = factoryObject.createModuleConfig("");
// Setup the base and sub forwards, with sub extending base
baseConfig = new ForwardConfig();
baseConfig.setName("baseConfig");
baseConfig.setPath("/somePage.jsp");
-
+
subConfig = new ForwardConfig();
subConfig.setName("subConfig");
subConfig.setExtends("baseConfig");
@@ -112,362 +99,363 @@
actionConfig = new ActionConfig();
actionConfig.setPath("/index");
moduleConfig.addActionConfig(actionConfig);
-
+
// No forward configs are registered to either module or action configs.
// Each test will determine where it needs these configs, if at all.
}
-
/**
* Return the tests included in this test suite.
*/
public static Test suite() {
-
return (new TestSuite(TestForwardConfig.class));
-
}
-
/**
* Tear down instance variables required by this test case.
*/
public void tearDown() {
-
moduleConfig = null;
baseConfig = null;
-
}
-
-
// ------------------------------------------------------- Individual Tests
-
/**
- * Make sure checkCircularInheritance() works as expected where there is
+ * Make sure checkCircularInheritance() works as expected where there is
* no inheritance set up.
- */
+ */
public void testCheckCircularInheritanceNoExtends() {
moduleConfig.addForwardConfig(baseConfig);
- boolean result = baseConfig.checkCircularInheritance(moduleConfig, null);
-
+
+ boolean result =
+ baseConfig.checkCircularInheritance(moduleConfig, null);
+
assertTrue("Incorrect result", !result);
}
-
+
/**
- * Test checkCircularInheritance() for when there is no circular
- * inheritance.
- */
+ * Test checkCircularInheritance() for when there is no circular
+ * inheritance.
+ */
public void testCheckCircularInheritanceNoConflicts() {
moduleConfig.addForwardConfig(baseConfig);
moduleConfig.addForwardConfig(subConfig);
-
- boolean result = subConfig.checkCircularInheritance(moduleConfig, null);
-
+
+ boolean result =
+ subConfig.checkCircularInheritance(moduleConfig, null);
+
assertTrue("Incorrect result", !result);
}
-
+
/**
- * Test checkCircularInheritance() for circular inheritance between
- * global forwards.
- */
+ * Test checkCircularInheritance() for circular inheritance between global
+ * forwards.
+ */
public void testCheckCircularInheritanceBasicGlobal() {
moduleConfig.addForwardConfig(subConfig);
moduleConfig.addForwardConfig(baseConfig);
-
+
// set the baseConfig to extend subConfig
baseConfig.setExtends("subConfig");
-
- boolean result = subConfig.checkCircularInheritance(moduleConfig, null);
-
+
+ boolean result =
+ subConfig.checkCircularInheritance(moduleConfig, null);
+
assertTrue("Circular inheritance not detected.", result);
}
-
+
/**
- * Test checkCircularInheritance() for circular inheritance between
- * global forwards.
- */
+ * Test checkCircularInheritance() for circular inheritance between global
+ * forwards.
+ */
public void testCheckCircularInheritanceGlobal2Levels() {
moduleConfig.addForwardConfig(baseConfig);
moduleConfig.addForwardConfig(subConfig);
ForwardConfig grand = new ForwardConfig();
+
grand.setName("grandConfig");
grand.setExtends("subConfig");
moduleConfig.addForwardConfig(grand);
-
+
// set the baseConfig to extend grandConfig
baseConfig.setExtends("grandConfig");
-
+
boolean result = grand.checkCircularInheritance(moduleConfig, null);
-
+
assertTrue("Circular inheritance not detected.", result);
}
-
+
/**
- * Test checkCircularInheritance() for circular inheritance between
+ * Test checkCircularInheritance() for circular inheritance between
* forwards in an action.
*/
public void testCheckCircularInheritanceActionForwardsNoConflict() {
actionConfig.addForwardConfig(baseConfig);
actionConfig.addForwardConfig(subConfig);
-
- boolean result = subConfig.checkCircularInheritance(moduleConfig,
+
+ boolean result = subConfig.checkCircularInheritance(moduleConfig,
actionConfig);
-
+
assertTrue("Incorrect result", !result);
}
-
/**
- * Test checkCircularInheritance() for circular inheritance between
+ * Test checkCircularInheritance() for circular inheritance between
* forwards in an action.
*/
public void testCheckCircularInheritanceActionForwardsBasic() {
actionConfig.addForwardConfig(baseConfig);
actionConfig.addForwardConfig(subConfig);
-
+
// set base to extend sub
baseConfig.setExtends("subConfig");
-
- boolean result = subConfig.checkCircularInheritance(moduleConfig,
+
+ boolean result = subConfig.checkCircularInheritance(moduleConfig,
actionConfig);
-
+
assertTrue("Circular inheritance not detected.", result);
}
-
/**
- * Test checkCircularInheritance() for circular inheritance between
- * a forward declared in an action and a global forward.
+ * Test checkCircularInheritance() for circular inheritance between a
+ * forward declared in an action and a global forward.
*/
public void testCheckCircularInheritanceActionForwardExtendGlobal() {
actionConfig.addForwardConfig(subConfig);
moduleConfig.addForwardConfig(baseConfig);
-
+
boolean result = subConfig.checkCircularInheritance(moduleConfig,
actionConfig);
-
+
assertTrue("Incorrect result", !result);
}
-
/**
- * Test checkCircularInheritance() for circular inheritance between
- * a forward declared in an action and a global forward and both forwards
+ * Test checkCircularInheritance() for circular inheritance between a
+ * forward declared in an action and a global forward and both forwards
* have the same name.
*/
public void testCheckCircularInheritanceActionForwardExtendGlobalSameName() {
moduleConfig.addForwardConfig(baseConfig);
actionConfig.addForwardConfig(actionBaseConfig);
-
- boolean result = actionBaseConfig.checkCircularInheritance(moduleConfig,
- actionConfig);
-
+
+ boolean result =
+ actionBaseConfig.checkCircularInheritance(moduleConfig,
+ actionConfig);
+
assertTrue("Incorrect result", !result);
}
-
-
+
/**
* Make sure processExtends() throws an error when the config is already
* configured.
*/
- public void testProcessExtendsConfigured()
+ public void testProcessExtendsConfigured()
throws Exception {
-
baseConfig.configured = true;
moduleConfig.addForwardConfig(baseConfig);
+
try {
baseConfig.processExtends(moduleConfig, null);
- fail("processExtends should not succeed when object is already configured");
- } catch (IllegalStateException e) {
+ fail(
+ "processExtends should not succeed when object is already configured");
+ }
+ catch (IllegalStateException e) {
// success
}
-
}
-
/**
* Test processExtends() when nothing is extended.
*/
- public void testProcessExtendsNoExtension()
+ public void testProcessExtendsNoExtension()
throws Exception {
-
String path = baseConfig.getPath();
String module = baseConfig.getModule();
String name = baseConfig.getName();
String inherit = baseConfig.getExtends();
boolean redirect = baseConfig.getRedirect();
-
+
moduleConfig.addForwardConfig(baseConfig);
baseConfig.processExtends(moduleConfig, null);
-
- assertEquals("Path shouldn't have changed", path, baseConfig.getPath());
- assertEquals("Module shouldn't have changed", module,
+
+ assertEquals("Path shouldn't have changed",
+ path,
+ baseConfig.getPath());
+ assertEquals("Module shouldn't have changed", module,
baseConfig.getModule());
- assertEquals("Name shouldn't have changed", name, baseConfig.getName());
+ assertEquals("Name shouldn't have changed",
+ name,
+ baseConfig.getName());
assertEquals("Extends shouldn't have changed", inherit,
baseConfig.getExtends());
assertEquals("Redirect shouldn't have changed", redirect,
baseConfig.getRedirect());
}
-
+
/**
* Test processExtends() with a basic extension.
*/
- public void testProcessExtendsBasicExtension()
+ public void testProcessExtendsBasicExtension()
throws Exception {
-
String baseCount = "10";
+
baseConfig.setProperty("count", baseCount);
String baseLabel = "label a";
+
baseConfig.setProperty("label", baseLabel);
String path = baseConfig.getPath();
String module = baseConfig.getModule();
-
+
String inherit = subConfig.getExtends();
String name = subConfig.getName();
boolean redirect = subConfig.getRedirect();
-
+
String subLabel = "label b";
+
subConfig.setProperty("label", subLabel);
-
+
moduleConfig.addForwardConfig(baseConfig);
moduleConfig.addForwardConfig(subConfig);
subConfig.processExtends(moduleConfig, null);
-
+
assertEquals("Path wasn't inherited", path, subConfig.getPath());
- assertEquals("Module wasn't inherited", module,
+ assertEquals("Module wasn't inherited",
+ module,
subConfig.getModule());
- assertEquals("Name shouldn't have changed", name, subConfig.getName());
+ assertEquals("Name shouldn't have changed",
+ name,
+ subConfig.getName());
assertEquals("Extends shouldn't have changed", inherit,
subConfig.getExtends());
assertEquals("Redirect shouldn't have changed", redirect,
subConfig.getRedirect());
- assertEquals("Arbitrary config property was not inherited",
- baseCount, subConfig.getProperty("count"));
- assertEquals("Overridden config property was not retained",
- subLabel, subConfig.getProperty("label"));
+ assertEquals("Arbitrary config property was not inherited", baseCount,
+ subConfig.getProperty("count"));
+ assertEquals("Overridden config property was not retained", subLabel,
+ subConfig.getProperty("label"));
}
-
/**
* Test processExtends() with a basic extension between an action config
* and a global config.
*/
- public void testProcessExtendsBasicGlobalExtension()
+ public void testProcessExtendsBasicGlobalExtension()
throws Exception {
-
String path = baseConfig.getPath();
String module = baseConfig.getModule();
boolean redirect = subConfig.getRedirect();
String inherit = subConfig.getExtends();
String name = subConfig.getName();
-
+
moduleConfig.addForwardConfig(baseConfig);
actionConfig.addForwardConfig(subConfig);
subConfig.processExtends(moduleConfig, actionConfig);
-
+
assertEquals("Path wasn't inherited", path, subConfig.getPath());
- assertEquals("Module wasn't inherited", module,
+ assertEquals("Module wasn't inherited",
+ module,
subConfig.getModule());
- assertEquals("Name shouldn't have changed", name, subConfig.getName());
+ assertEquals("Name shouldn't have changed",
+ name,
+ subConfig.getName());
assertEquals("Extends shouldn't have changed", inherit,
subConfig.getExtends());
assertEquals("Redirect shouldn't have changed", redirect,
subConfig.getRedirect());
}
-
/**
* Test processExtends() with an incorrect setup where a global config
* attempts to extend an action config.
*/
- public void testProcessExtendsGlobalExtendingAction()
+ public void testProcessExtendsGlobalExtendingAction()
throws Exception {
-
moduleConfig.addForwardConfig(subConfig);
actionConfig.addForwardConfig(baseConfig);
-
+
try {
subConfig.processExtends(moduleConfig, actionConfig);
- fail("Should not find config from actionConfig when *this* is global");
- } catch (NullPointerException npe) {
+ fail(
+ "Should not find config from actionConfig when *this* is global");
+ }
+ catch (NullPointerException npe) {
// succeed
}
}
-
+
/**
* Test processExtends() with an action config that extends a global
* config with the same name.
*/
- public void testProcessExtendsSameNames()
+ public void testProcessExtendsSameNames()
throws Exception {
-
String path = baseConfig.getPath();
boolean redirect = baseConfig.getRedirect();
-
+
String module = actionBaseConfig.getModule();
String inherit = actionBaseConfig.getExtends();
String name = actionBaseConfig.getName();
-
+
moduleConfig.addForwardConfig(baseConfig);
actionConfig.addForwardConfig(actionBaseConfig);
actionBaseConfig.processExtends(moduleConfig, actionConfig);
-
- assertEquals("Path wasn't inherited", path,
+
+ assertEquals("Path wasn't inherited",
+ path,
actionBaseConfig.getPath());
- assertEquals("Module shouldn't have changed", module,
+ assertEquals("Module shouldn't have changed", module,
actionBaseConfig.getModule());
- assertEquals("Name shouldn't have changed", name,
+ assertEquals("Name shouldn't have changed", name,
actionBaseConfig.getName());
assertEquals("Extends shouldn't have changed", inherit,
actionBaseConfig.getExtends());
assertEquals("Redirect shouldn't have changed", redirect,
actionBaseConfig.getRedirect());
}
-
+
/**
- * Test processExtends() where an action ForwardConfig extends another
- * ForwardConfig, which in turn extends a global ForwardConfig with
- * the same name.
+ * Test processExtends() where an action ForwardConfig extends another
+ * ForwardConfig, which in turn extends a global ForwardConfig with the
+ * same name.
*/
- public void testProcessExtendsActionExtendsActionExtendsGlobalWithSameName()
+ public void testProcessExtendsActionExtendsActionExtendsGlobalWithSameName()
throws Exception {
-
String path = baseConfig.getPath();
-
+
String module = actionBaseConfig.getModule();
-
+
boolean redirect = subConfig.getRedirect();
String inherit = subConfig.getExtends();
String name = subConfig.getName();
-
+
moduleConfig.addForwardConfig(baseConfig);
actionConfig.addForwardConfig(actionBaseConfig);
actionConfig.addForwardConfig(subConfig);
-
+
subConfig.processExtends(moduleConfig, actionConfig);
-
+
assertTrue("baseConfig's processExtends() should've been called",
baseConfig.extensionProcessed);
assertTrue("actionBaseConfig's processExtends() should've been called",
actionBaseConfig.extensionProcessed);
-
- assertEquals("Path wasn't inherited", path,
- subConfig.getPath());
- assertEquals("Module wasn't inherited", module,
+
+ assertEquals("Path wasn't inherited", path, subConfig.getPath());
+ assertEquals("Module wasn't inherited",
+ module,
subConfig.getModule());
- assertEquals("Name shouldn't have changed", name,
+ assertEquals("Name shouldn't have changed",
+ name,
subConfig.getName());
assertEquals("Extends shouldn't have changed", inherit,
subConfig.getExtends());
assertEquals("Redirect shouldn't have changed", redirect,
- subConfig.getRedirect());
+ subConfig.getRedirect());
}
-
}
Modified: struts/action/trunk/src/test/org/apache/struts/config/TestModuleConfig.java
URL: http://svn.apache.org/viewcvs/struts/action/trunk/src/test/org/apache/struts/config/TestModuleConfig.java?rev=370938&r1=370937&r2=370938&view=diff
==============================================================================
--- struts/action/trunk/src/test/org/apache/struts/config/TestModuleConfig.java (original)
+++ struts/action/trunk/src/test/org/apache/struts/config/TestModuleConfig.java Fri Jan 20 16:19:02 2006
@@ -1,240 +1,204 @@
/*
- * $Id$
+ * $Id$
*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed 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.struts.config;
-
-import java.io.InputStream;
-
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-
import org.apache.commons.digester.Digester;
-import org.apache.struts.Globals;
+import java.io.InputStream;
/**
* Unit tests for the <code>org.apache.struts.config</code> package.
*
- * @version $Rev$ $Date$
+ * @version $Rev$ $Date: 2005-03-01 20:26:14 -0500 (Tue, 01 Mar 2005)
+ * $
*/
-
public class TestModuleConfig extends TestCase {
-
-
// ----------------------------------------------------- Instance Variables
-
/**
* The ModuleConfig we are testing.
*/
protected ModuleConfig config = null;
-
// ----------------------------------------------------------- Constructors
-
/**
* Construct a new instance of this test case.
*
* @param name Name of the test case
*/
public TestModuleConfig(String name) {
-
super(name);
-
}
-
// --------------------------------------------------------- Public Methods
-
/**
* Set up instance variables required by this test case.
*/
public void setUp() {
-
ModuleConfigFactory factoryObject =
- ModuleConfigFactory.createFactory();
- config = factoryObject.createModuleConfig("");
+ ModuleConfigFactory.createFactory();
+ config = factoryObject.createModuleConfig("");
}
-
/**
* Return the tests included in this test suite.
*/
public static Test suite() {
-
return (new TestSuite(TestModuleConfig.class));
-
}
-
/**
* Tear down instance variables required by this test case.
*/
public void tearDown() {
-
config = null;
-
}
-
// ------------------------------------------------ Individual Test Methods
- private void parseConfig(String publicId, String entityURL,String strutsConfig) {
-
-
+ private void parseConfig(String publicId, String entityURL,
+ String strutsConfig) {
// Prepare a Digester for parsing a struts-config.xml file
Digester digester = new Digester();
+
digester.push(config);
digester.setNamespaceAware(true);
digester.setValidating(true);
digester.addRuleSet(new ConfigRuleSet());
- digester.register
- (publicId,
- this.getClass().getResource
- (entityURL).toString());
+ digester.register(publicId,
+ this.getClass().getResource(entityURL).toString());
// Parse the test struts-config.xml file
try {
- InputStream input = this.getClass().getResourceAsStream(strutsConfig);
- assertNotNull("Got an input stream for "+strutsConfig, input);
+ InputStream input =
+ this.getClass().getResourceAsStream(strutsConfig);
+
+ assertNotNull("Got an input stream for " + strutsConfig, input);
digester.parse(input);
input.close();
- } catch (Throwable t) {
+ }
+ catch (Throwable t) {
t.printStackTrace(System.out);
fail("Parsing threw exception: " + t);
}
-
-
-
}
-
/**
* Test parsing of a struts-config.xml file.
*/
public void testParse() {
-
- testParseBase("-//Apache Software Foundation//DTD Struts Configuration 1.2//EN",
- "/org/apache/struts/resources/struts-config_1_2.dtd",
- "/org/apache/struts/config/struts-config.xml");
-
+ testParseBase(
+ "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN",
+ "/org/apache/struts/resources/struts-config_1_2.dtd",
+ "/org/apache/struts/config/struts-config.xml");
}
public void testParse1_1() {
-
- testParseBase("-//Apache Software Foundation//DTD Struts Configuration 1.1//EN",
- "/org/apache/struts/resources/struts-config_1_1.dtd",
- "/org/apache/struts/config/struts-config-1.1.xml");
-
+ testParseBase(
+ "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN",
+ "/org/apache/struts/resources/struts-config_1_1.dtd",
+ "/org/apache/struts/config/struts-config-1.1.xml");
}
- public void testParseBase(String publicId, String entityURL,String strutsConfig) {
-
- parseConfig(publicId,entityURL, strutsConfig);
+ public void testParseBase(String publicId, String entityURL,
+ String strutsConfig) {
+ parseConfig(publicId, entityURL, strutsConfig);
// Perform assertion tests on the parsed information
- FormBeanConfig fbcs[] = config.findFormBeanConfigs();
+ FormBeanConfig[] fbcs = config.findFormBeanConfigs();
+
assertNotNull("Found our form bean configurations", fbcs);
- assertEquals("Found three form bean configurations",
- 3, fbcs.length);
+ assertEquals("Found three form bean configurations", 3, fbcs.length);
+
+ ForwardConfig[] fcs = config.findForwardConfigs();
- ForwardConfig fcs[] = config.findForwardConfigs();
assertNotNull("Found our forward configurations", fcs);
- assertEquals("Found three forward configurations",
- 3, fcs.length);
+ assertEquals("Found three forward configurations", 3, fcs.length);
ActionConfig logon = config.findActionConfig("/logon");
- assertNotNull("Found logon action configuration", logon);
- assertEquals("Found correct logon configuration",
- "logonForm",
- logon.getName());
-
+ assertNotNull("Found logon action configuration", logon);
+ assertEquals("Found correct logon configuration", "logonForm",
+ logon.getName());
}
-
- /**
+ /**
* Tests a struts-config.xml that contains a custom mapping and property.
*/
public void testCustomMappingParse() {
-
- // Prepare a Digester for parsing a struts-config.xml file
- testCustomMappingParseBase
- ("-//Apache Software Foundation//DTD Struts Configuration 1.2//EN",
- "/org/apache/struts/resources/struts-config_1_2.dtd",
- "/org/apache/struts/config/struts-config-custom-mapping.xml");
+ // Prepare a Digester for parsing a struts-config.xml file
+ testCustomMappingParseBase(
+ "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN",
+ "/org/apache/struts/resources/struts-config_1_2.dtd",
+ "/org/apache/struts/config/struts-config-custom-mapping.xml");
}
/**
- * Tests a struts-config.xml that contains a custom mapping and property.
- */
- public void testCustomMappingParse1_1() {
-
-
- // Prepare a Digester for parsing a struts-config.xml file
- testCustomMappingParseBase
- ("-//Apache Software Foundation//DTD Struts Configuration 1.1//EN",
- "/org/apache/struts/resources/struts-config_1_1.dtd",
- "/org/apache/struts/config/struts-config-custom-mapping.xml");
-
- }
-
+ * Tests a struts-config.xml that contains a custom mapping and property.
+ */
+ public void testCustomMappingParse1_1() {
+ // Prepare a Digester for parsing a struts-config.xml file
+ testCustomMappingParseBase(
+ "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN",
+ "/org/apache/struts/resources/struts-config_1_1.dtd",
+ "/org/apache/struts/config/struts-config-custom-mapping.xml");
+ }
/**
- * Tests a struts-config.xml that contains a custom mapping and property.
- */
- private void testCustomMappingParseBase(String publicId, String entityURL,String strutsConfig) {
-
-
- parseConfig(publicId,entityURL, strutsConfig);
+ * Tests a struts-config.xml that contains a custom mapping and property.
+ */
+ private void testCustomMappingParseBase(String publicId, String entityURL,
+ String strutsConfig) {
+ parseConfig(publicId, entityURL, strutsConfig);
- // Perform assertion tests on the parsed information
- CustomMappingTest map = (CustomMappingTest)config.findActionConfig("/editRegistration");
- assertNotNull("Cannot find editRegistration mapping", map);
- assertTrue("The custom mapping attribute has not been set", map.getPublic());
+ // Perform assertion tests on the parsed information
+ CustomMappingTest map = (CustomMappingTest) config.findActionConfig(
+ "/editRegistration");
- }
+ assertNotNull("Cannot find editRegistration mapping", map);
+ assertTrue("The custom mapping attribute has not been set",
+ map.getPublic());
+ }
/**
* Test order of action mappings defined perserved.
*/
public void testPreserveActionMappingsOrder() {
-
- parseConfig("-//Apache Software Foundation//DTD Struts Configuration 1.2//EN",
- "/org/apache/struts/resources/struts-config_1_2.dtd",
- "/org/apache/struts/config/struts-config.xml");
-
- String[] paths = new String[] {"/editRegistration",
- "/editSubscription", "/logoff", "/logon", "/saveRegistration",
- "/saveSubscription", "/tour"
- };
+ parseConfig(
+ "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN",
+ "/org/apache/struts/resources/struts-config_1_2.dtd",
+ "/org/apache/struts/config/struts-config.xml");
+
+ String[] paths = new String[]{
+ "/editRegistration", "/editSubscription", "/logoff", "/logon",
+ "/saveRegistration", "/saveSubscription", "/tour"
+ };
ActionConfig[] actions = config.findActionConfigs();
- for (int x=0; x<paths.length; x++) {
- assertTrue("Action config out of order:"+actions[x].getPath(),
- paths[x].equals(actions[x].getPath()));
- }
- }
-
-
+ for (int x = 0; x < paths.length; x++) {
+ assertTrue("Action config out of order:" + actions[x].getPath(),
+ paths[x].equals(actions[x].getPath()));
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org