struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r539826 - in /struts/struts2/trunk/core/src: main/resources/template/simple/ test/java/org/apache/struts2/ test/java/org/apache/struts2/dispatcher/ test/java/org/apache/struts2/views/jsp/ui/ test/resources/org/apache/struts2/views/jsp/ui/
Date Sun, 20 May 2007 04:52:36 GMT
Author: mrdon
Date: Sat May 19 21:52:35 2007
New Revision: 539826

URL: http://svn.apache.org/viewvc?view=rev&rev=539826
Log:
Merging tests disproving WW-1519

Added:
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/SomeEnum.java
      - copied unchanged from r539825, struts/struts2/branches/STRUTS_2_0_X/core/src/test/java/org/apache/struts2/SomeEnum.java
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/OptGroup-4.txt
      - copied unchanged from r539819, struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/OptGroup-4.txt
    struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-13.txt
      - copied unchanged from r539825, struts/struts2/branches/STRUTS_2_0_X/core/src/test/resources/org/apache/struts2/views/jsp/ui/Select-13.txt
Modified:
    struts/struts2/trunk/core/src/main/resources/template/simple/optgroup.ftl
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/TestAction.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java

Modified: struts/struts2/trunk/core/src/main/resources/template/simple/optgroup.ftl
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/optgroup.ftl?view=diff&rev=539826&r1=539825&r2=539826
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/template/simple/optgroup.ftl (original)
+++ struts/struts2/trunk/core/src/main/resources/template/simple/optgroup.ftl Sat May 19 21:52:35
2007
@@ -14,8 +14,9 @@
 <#assign trash=stack.push(optGroupBean) />
 	<#assign tmpKey=stack.findValue(optGroupInternalListUiBean.parameters.listKey) />
 	<#assign tmpValue=stack.findValue(optGroupInternalListUiBean.parameters.listValue) />
-	<option value="${tmpKey}"
-	<#if tag.contains(parameters.nameValue, tmpKey) == true>
+	<#assign tmpKeyStr = tmpKey.toString() />
+	<option value="${tmpKeyStr}"
+	<#if tag.contains(parameters.nameValue, tmpKeyStr) == true>
 	selected="selected"
 	</#if>
 	>${tmpValue}

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/TestAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/TestAction.java?view=diff&rev=539826&r1=539825&r2=539826
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/TestAction.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/TestAction.java Sat May 19
21:52:35 2007
@@ -20,6 +20,7 @@
  */
 package org.apache.struts2;
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
@@ -47,6 +48,7 @@
     private String[][] list;
     private List list2;
     private List list3;
+    private SomeEnum status = SomeEnum.COMPLETED;
 
     public Collection getCollection() {
         return collection;
@@ -146,6 +148,18 @@
 
     public String doInput() throws Exception {
         return INPUT;
+    }
+
+	public SomeEnum getStatus() {
+		return status;
+	}
+
+	public void setStatus(SomeEnum status) {
+		this.status = status;
+	}
+    
+    public List<SomeEnum> getStatusList() {
+    	return Arrays.asList(SomeEnum.values());
     }
 
 }

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java?view=diff&rev=539826&r1=539825&r2=539826
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
(original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/ServletRedirectResultTest.java
Sat May 19 21:52:35 2007
@@ -97,6 +97,20 @@
         requestMock.verify();
         responseMock.verify();
     }
+    
+    public void testMultipleParametersRedirect() throws Exception {
+        view.setLocation("foo.jsp?foo=bar&amp;baz=jim");
+        requestMock.expectAndReturn("getParameterMap", new HashMap());
+        requestMock.expectAndReturn("getServletPath", "/namespace/some.action");
+        requestMock.expectAndReturn("getAttribute", C.ANY_ARGS, null);
+        responseMock.expectAndReturn("encodeRedirectURL", "/context/namespace/foo.jsp?foo=bar&amp;baz=jim",
"/context/namespace/foo.jsp?foo=bar&baz=jim");
+        responseMock.expect("sendRedirect", C.args(C.eq("/context/namespace/foo.jsp?foo=bar&baz=jim")));
+
+        view.execute(ai);
+
+        requestMock.verify();
+        responseMock.verify();
+    }
 
     protected void setUp() throws Exception {
         super.setUp();

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java?view=diff&rev=539826&r1=539825&r2=539826
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
(original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/OptGroupTest.java
Sat May 19 21:52:35 2007
@@ -20,6 +20,9 @@
  */
 package org.apache.struts2.views.jsp.ui;
 
+import java.util.LinkedHashMap;
+
+import org.apache.struts2.TestAction;
 import org.apache.struts2.views.jsp.AbstractUITagTest;
 
 /**
@@ -27,7 +30,6 @@
  */
 public class OptGroupTest extends AbstractUITagTest {
 
-
     public void testOptGroupSimple() throws Exception {
         SelectTag selectTag = new SelectTag();
         selectTag.setName("mySelection");
@@ -119,5 +121,41 @@
 
         //System.out.println(writer.toString());
         verify(SelectTag.class.getResource("OptGroup-3.txt"));
+    }
+    
+    public void testOptGroupNumbers() throws Exception {
+    	
+    	((TestAction)action).setMap(new LinkedHashMap() {{
+    		put("AAA", "aaa");
+    		put(new Long(111111), "bbb");
+    		put("CCC", "ccc");
+    	}});
+    	
+        SelectTag selectTag = new SelectTag();
+        selectTag.setName("mySelection");
+        selectTag.setLabel("My Selection");
+        selectTag.setList("%{#{'ONE':'one','TWO':'two','THREE':'three'}}");
+
+        OptGroupTag optGroupTag1 = new OptGroupTag();
+        optGroupTag1.setLabel("My Label 1");
+        optGroupTag1.setList("map");
+
+        OptGroupTag optGroupTag2 = new OptGroupTag();
+        optGroupTag2.setLabel("My Label 2");
+        optGroupTag2.setList("%{#{'DDD':'ddd','EEE':'eee','FFF':'fff'}}");
+
+        selectTag.setPageContext(pageContext);
+        selectTag.doStartTag();
+        optGroupTag1.setPageContext(pageContext);
+        optGroupTag1.doStartTag();
+        optGroupTag1.doEndTag();
+        optGroupTag2.setPageContext(pageContext);
+        optGroupTag2.doStartTag();
+        optGroupTag2.doEndTag();
+        selectTag.doEndTag();
+
+
+        //System.out.println(writer.toString());
+        verify(SelectTag.class.getResource("OptGroup-4.txt"));
     }
 }

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java?view=diff&rev=539826&r1=539825&r2=539826
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java
(original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/SelectTest.java
Sat May 19 21:52:35 2007
@@ -507,6 +507,22 @@
 
         verify(SelectTag.class.getResource("Select-11.txt"));
     }
+    
+    public void testEnumList() throws Exception {
+
+        SelectTag tag = new SelectTag();
+        tag.setPageContext(pageContext);
+        tag.setLabel("mylabel");
+        tag.setName("status");
+        tag.setList("statusList");
+        tag.setListKey("name");
+        tag.setListValue("displayName");
+
+        tag.doStartTag();
+        tag.doEndTag();
+
+        verify(SelectTag.class.getResource("Select-13.txt"));
+    }
 
     public class IdName {
         private String name;



Mime
View raw message