tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mschu...@apache.org
Subject svn commit: r569845 - in /tapestry/tapestry4/trunk/tapestry-framework/src: java/org/apache/tapestry/multipart/UploadFormParametersWrapper.java test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java
Date Sun, 26 Aug 2007 17:16:48 GMT
Author: mschulte
Date: Sun Aug 26 10:16:47 2007
New Revision: 569845

URL: http://svn.apache.org/viewvc?rev=569845&view=rev
Log:
fixes TAPESTRY-340

Modified:
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/multipart/UploadFormParametersWrapper.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/multipart/UploadFormParametersWrapper.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/multipart/UploadFormParametersWrapper.java?rev=569845&r1=569844&r2=569845&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/multipart/UploadFormParametersWrapper.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/multipart/UploadFormParametersWrapper.java
Sun Aug 26 10:16:47 2007
@@ -49,8 +49,9 @@
         super(request);
 
         Defense.notNull(parameterMap, "parameterMap");
-
-        _parameterMap = Collections.unmodifiableMap(parameterMap);
+        // add Parameter from the URL, typically added by JavaScript-URL-manipulation
+        parameterMap.putAll(request.getParameterMap());
+        _parameterMap = Collections.unmodifiableMap(parameterMap );
     }
 
     public String getParameter(String name)

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java?rev=569845&r1=569844&r2=569845&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java
(original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java
Sun Aug 26 10:16:47 2007
@@ -19,6 +19,8 @@
 import java.util.Map;
 
 import org.apache.tapestry.BaseComponentTestCase;
+import org.easymock.EasyMock;
+import org.testng.annotations.ExpectedExceptions;
 import org.testng.annotations.Test;
 
 import javax.servlet.http.HttpServletRequest;
@@ -34,12 +36,16 @@
 {
     private HttpServletRequest newHttpRequest()
     {
-        return newMock(HttpServletRequest.class);
+        HttpServletRequest req = newMock(HttpServletRequest.class);
+        EasyMock.expect(req.getParameterMap()).andReturn( new HashMap() );
+        return req;
     }
-
+    
+       
     public void testMapIsNotModifiable()
     {
         HttpServletRequest request = newHttpRequest();
+        
 
         replay();
 
@@ -137,5 +143,19 @@
         assertEquals(false, e.hasMoreElements());
 
         verify();
+    }
+    
+    public void testGetUrlParameter()  // Test fix for TAPESTRY-340
+    {
+        HttpServletRequest req = newMock(HttpServletRequest.class);
+        EasyMock.expect(req.getParameterMap()).andReturn(
+                new HashMap(){{put("urlParam", new String[]{"urlParamValue"} );}} );
+
+        replay();
+        
+        HttpServletRequest r = new UploadFormParametersWrapper(req, new HashMap());
+        
+        assertEquals("urlParamValue", r.getParameter("urlParam") );
+        assertEquals("urlParam", r.getParameterNames().nextElement() );
     }
 }



Mime
View raw message