struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r676179 - /struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
Date Sat, 12 Jul 2008 13:55:52 GMT
Author: mrdon
Date: Sat Jul 12 06:55:51 2008
New Revision: 676179

URL: http://svn.apache.org/viewvc?rev=676179&view=rev
Log:
Adding test to ensure action tags are executed without the method from the URI polluting the
result
WW-2290

Modified:
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java?rev=676179&r1=676178&r2=676179&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
(original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ActionTagTest.java
Sat Jul 12 06:55:51 2008
@@ -106,6 +106,35 @@
         this.testSimple();
     }
 
+    public void testSimpleWithctionMethodInOriginalURI() {
+        request.setupGetServletPath("/foo!foo.action");
+
+        ActionTag tag = new ActionTag();
+        tag.setPageContext(pageContext);
+        tag.setName("testAction");
+        tag.setId("testAction");
+
+        int stackSize = stack.size();
+
+        try {
+            tag.doStartTag();
+            tag.addParameter("foo", "myFoo");
+            tag.doEndTag();
+
+            assertEquals(stack.size(), ActionContext.getContext().getValueStack().size());
+            assertEquals("myFoo", stack.findValue("#testAction.foo"));
+            assertEquals(stackSize, stack.size());
+
+            Object o = pageContext.findAttribute("testAction");
+            assertTrue(o instanceof TestAction);
+            assertEquals("myFoo", ((TestAction) o).getFoo());
+            assertEquals(Action.SUCCESS, ((TestAction) o).getResult());
+        } catch (JspException ex) {
+            ex.printStackTrace();
+            fail();
+        }
+    }
+
     public void testActionWithExecuteResult() throws Exception {
         ActionTag tag = new ActionTag();
         tag.setPageContext(pageContext);



Mime
View raw message