struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From musa...@apache.org
Subject svn commit: r526317 - in /struts/struts2/trunk/core/src: main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
Date Fri, 06 Apr 2007 23:22:18 GMT
Author: musachy
Date: Fri Apr  6 16:22:17 2007
New Revision: 526317

URL: http://svn.apache.org/viewvc?view=rev&rev=526317
Log:
Fix test breaking build. Don, can you verify this?

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java?view=diff&rev=526317&r1=526316&r2=526317
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapper.java
Fri Apr  6 16:22:17 2007
@@ -64,7 +64,7 @@
  *  <li><code>GET:    /movie/Thrillers!edit => method="edit", id="Thrillers"</code></li>
  *  <li><code>GET:    /movie/new           => method="editNew"</code></li>
  *  <li><code>POST:   /movie/Thrillers      => method="create"</code></li>
- *  <li><code>PUT:    /movie/              => method="update"</code></li>
+ *  <li><code>PUT:    /movie/Thrillers      => method="update", id="Thrillers""</code></li>
  *  <li><code>DELETE: /movie/Thrillers      => method="remove"</code></li>
  * </ul>
  * <p>
@@ -116,6 +116,10 @@
                     // Creating a new entry on POST e.g. foo/
                     } else if (isPost(request)) {
                         mapping.setMethod("create");
+                        
+                    // Updating an item e.g. foo/1    
+                    }  else if (isPut(request)) {
+                        mapping.setMethod("update");
                     }
 
                 } else if (lastSlashPos > -1) {
@@ -128,10 +132,6 @@
                     // Viewing an item e.g. foo/1
                     } else if (isGet(request)) {
                         mapping.setMethod("view");
-
-                    // Updating an item e.g. foo/1
-                    } else if (isPut(request)) {
-                        mapping.setMethod("update");
 
                     // Removing an item e.g. foo/1
                     } else if (isDelete(request)) {

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java?view=diff&rev=526317&r1=526316&r2=526317
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
(original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/mapper/Restful2ActionMapperTest.java
Fri Apr  6 16:22:17 2007
@@ -89,8 +89,8 @@
     }
 
     public void testPutCreate() throws Exception {
-        req.setupGetRequestURI("/my/namespace/foo/");
-        req.setupGetServletPath("/my/namespace/foo/");
+        req.setupGetRequestURI("/my/namespace/bar/1/foo/");
+        req.setupGetServletPath("/my/namespace/bar/1/foo/");
         req.setupGetAttribute(null);
         req.addExpectedGetAttributeName("javax.servlet.include.servlet_path");
         req.setupGetMethod("PUT");
@@ -99,6 +99,8 @@
 
         assertEquals("/my/namespace", mapping.getNamespace());
         assertEquals("foo/", mapping.getName());
-        assertEquals("create", mapping.getMethod());
+        assertEquals("update", mapping.getMethod());
+        assertEquals(1, mapping.getParams().size());
+        assertEquals("1", mapping.getParams().get("bar"));
     }
 }



Mime
View raw message