cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1207885 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/ rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/
Date Tue, 29 Nov 2011 14:26:20 GMT
Author: sergeyb
Date: Tue Nov 29 14:26:19 2011
New Revision: 1207885

URL: http://svn.apache.org/viewvc?rev=1207885&view=rev
Log:
Merged revisions 1207883 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1207883 | sergeyb | 2011-11-29 14:24:46 +0000 (Tue, 29 Nov 2011) | 1 line
  
  [CXF-3941] Better support for Description annotations
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 29 14:26:19 2011
@@ -1 +1 @@
-/cxf/trunk:1205786,1205830,1205996-1205997,1206800,1207334,1207482,1207835
+/cxf/trunk:1205786,1205830,1205996-1205997,1206800,1207334,1207482,1207835,1207883

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=1207885&r1=1207884&r2=1207885&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
Tue Nov 29 14:26:19 2011
@@ -647,6 +647,9 @@ public class WadlGenerator implements Re
             if (inbound) {
                 int index = getRequestBodyParam(ori).getIndex();
                 anns = opMethod.getParameterAnnotations()[index];
+                if (!isDocAvailable(anns)) {
+                    anns = opMethod.getAnnotations();
+                }
                 docCategory = DocTarget.PARAM;
             } else {
                 anns = opMethod.getAnnotations();

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java?rev=1207885&r1=1207884&r2=1207885&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
Tue Nov 29 14:26:19 2011
@@ -37,6 +37,7 @@ import javax.ws.rs.core.Response;
 import javax.xml.bind.annotation.XmlTransient;
 
 import org.apache.cxf.aegis.type.java5.IgnoreProperty;
+import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
 import org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2;
 import org.apache.cxf.jaxrs.model.wadl.jaxb.Book;
 import org.apache.cxf.jaxrs.model.wadl.jaxb.Chapter;
@@ -47,6 +48,15 @@ import org.apache.cxf.jaxrs.model.wadl.j
 @Description(lang = "en-us", title = "book store resource", value = "super resource")
 public class BookStore {
 
+    @Descriptions({ 
+        @Description(value = "Attachments", target = DocTarget.PARAM)
+    })
+    @POST 
+    @Consumes("multipart/form-data")
+    public void formdata(MultipartBody body) {
+        
+    }
+    
     @GET 
     @Produces("text/plain")
     public String getName(@PathParam("id") Long id, @QueryParam("") QueryBean query) {

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java?rev=1207885&r1=1207884&r2=1207885&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
Tue Nov 29 14:26:19 2011
@@ -359,8 +359,8 @@ public class WadlGeneratorTest extends A
         // must have a single template parameter
         verifyParameters(resource, 1, new Param("id", "template", "xs:long"));
         
-        // must have 2 methods, GET and PUT
-        List<Element> methodEls = getElements(resource, "method", 2);
+        // must have 3 methods, GET, POST and PUT
+        List<Element> methodEls = getElements(resource, "method", 3);
         
         // verify GET
         assertEquals("GET", methodEls.get(0).getAttribute("name"));
@@ -382,11 +382,16 @@ public class WadlGeneratorTest extends A
         //check response
         verifyRepresentation(methodEls.get(0), "response", "text/plain", "");
         
+        // verify POST
+        assertEquals("POST", methodEls.get(1).getAttribute("name"));
+        Element formRep = verifyRepresentation(methodEls.get(1), "request", "multipart/form-data",
"");
+        checkDocs(formRep, "", "Attachments", "");
+        
         // verify PUT
-        assertEquals("PUT", methodEls.get(1).getAttribute("name"));
-        verifyRepresentation(methodEls.get(1), "request", "text/plain", "");
+        assertEquals("PUT", methodEls.get(2).getAttribute("name"));
+        verifyRepresentation(methodEls.get(2), "request", "text/plain", "");
         
-        verifyResponseWithStatus(methodEls.get(1), "204");
+        verifyResponseWithStatus(methodEls.get(2), "204");
         
         // verify resource starting with /book2
         verifyGetResourceMethod(resourceEls.get(0), book2El, null);
@@ -533,7 +538,7 @@ public class WadlGeneratorTest extends A
             WadlGenerator.WADL_NS, "representation").size());
     }
     
-    private void verifyRepresentation(Element element, 
+    private Element verifyRepresentation(Element element, 
                                       String name, 
                                       String mediaType,
                                       String elementValue) {
@@ -548,6 +553,7 @@ public class WadlGeneratorTest extends A
             String pName = "request".equals(name) ? "request" : "result";
             verifyParameters(representationEls.get(0), 1, new Param(pName, "plain", "xs:string"));
         }
+        return representationEls.get(0);
     }
     
     private void verifyXmlJsonRepresentations(Element element, String type, String docs)
{



Mime
View raw message