Author: hrabago Date: Tue Jul 25 18:44:13 2006 New Revision: 425585 URL: http://svn.apache.org/viewvc?rev=425585&view=rev Log: STR-2917 Additional tests for action-level config objects inheriting from global config objects.
Modified: struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java Modified: struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java?rev=425585&r1=425584&r2=425585&view=diff ============================================================================== --- struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java (original) +++ struts/struts1/trunk/core/src/test/java/org/apache/struts/action/TestActionServlet.java Tue Jul 25 18:44:13 2006 @@ -862,6 +862,48 @@ } /** + * Test that an ActionConfig's ForwardConfig can inherit from a + * global ForwardConfig. + */ + public void testProcessActionExtensionWithForwardConfig() + throws ServletException { + ForwardConfig forwardConfig = new ForwardConfig(); + forwardConfig.setName("sub"); + forwardConfig.setExtends("success"); + baseAction.addForwardConfig(forwardConfig); + + moduleConfig.addActionConfig(baseAction); + moduleConfig.addForwardConfig(baseForward); + actionServlet.processActionConfigExtension(baseAction, moduleConfig); + + forwardConfig = baseAction.findForwardConfig("sub"); + + assertEquals("'sub' forward's inheritance was not processed.", + baseForward.getPath(), forwardConfig.getPath()); + } + + /** + * Test that an ActionConfig's ExceptionConfig can inherit from a + * global ExceptionConfig. + */ + public void testProcessActionExtensionWithExceptionConfig() + throws ServletException { + ExceptionConfig exceptionConfig = new ExceptionConfig(); + exceptionConfig.setType("SomeException"); + exceptionConfig.setExtends("java.lang.NullPointerException"); + baseAction.addExceptionConfig(exceptionConfig); + + moduleConfig.addActionConfig(baseAction); + moduleConfig.addExceptionConfig(baseException); + actionServlet.processActionConfigExtension(baseAction, moduleConfig); + + exceptionConfig = baseAction.findExceptionConfig("SomeException"); + + assertEquals("SomeException's inheritance was not processed.", + baseException.getKey(), exceptionConfig.getKey()); + } + + /** * Make sure processActionConfigClass() returns an instance of the correct * class if the base config is using a custom class. */