cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1369648 - in /cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl: BookStore.java WadlGeneratorTest.java
Date Sun, 05 Aug 2012 19:18:01 GMT
Author: sergeyb
Date: Sun Aug  5 19:18:00 2012
New Revision: 1369648

URL: http://svn.apache.org/viewvc?rev=1369648&view=rev
Log:
Fixing the test bug exposed on Java7 and Ibm Java

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java?rev=1369648&r1=1369647&r2=1369648&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/BookStore.java
Sun Aug  5 19:18:00 2012
@@ -61,7 +61,10 @@ public class BookStore {
     @GET 
     @Produces("application/xml")
     @XMLName("{http://superbooks}books")
-    public List<Book> getBooks() {
+    @Descriptions({ 
+        @Description(value = "Get Books", target = DocTarget.METHOD)
+    })
+    public List<Book> getBooks(@PathParam("id") Long id) {
         return Collections.emptyList();
     }
     

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java?rev=1369648&r1=1369647&r2=1369648&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
Sun Aug  5 19:18:00 2012
@@ -454,30 +454,18 @@ public class WadlGeneratorTest extends A
         // must have 4 methods, 2 GETs, POST and PUT
         List<Element> methodEls = getElements(resource, "method", 4);
         
-        // verify 1st GET
-        assertEquals("GET", methodEls.get(0).getAttribute("name"));
-        assertEquals(0, DOMUtils.getChildrenWithName(methodEls.get(0), 
-                        WadlGenerator.WADL_NS, "param").size());
-        // check request 
-        List<Element> requestEls = getElements(methodEls.get(0), "request", 1);
-        
-        // 4 parameters are expected
-        verifyParameters(requestEls.get(0), 5, 
-                         new Param("a", "query", "xs:int"),
-                         new Param("c.a", "query", "xs:int"),
-                         new Param("c.b", "query", "xs:int"),
-                         new Param("c.d.a", "query", "xs:int"),
-                         new Param("e", "query", "xs:string", Collections.singleton("A")));
-        
-        assertEquals(0, DOMUtils.getChildrenWithName(requestEls.get(0), 
-                         WadlGenerator.WADL_NS, "representation").size());
-        //check response
-        verifyRepresentation(methodEls.get(0), "response", "text/plain", "");
+        // verify 1st Root GET
+        try {
+            verifyFirstRootGet(methodEls.get(0));
+        } catch (Throwable ex) {
+            verifyFirstRootGet(methodEls.get(1));
+        }
         
-        // verify 2nd GET
-        assertEquals("GET", methodEls.get(1).getAttribute("name"));
-        if (booksEl != null) {
-            verifyRepresentation(methodEls.get(1), "response", "application/xml", booksEl);
+        // verify 2nd Root GET
+        try {
+            verifySecondRootGet(methodEls.get(1), booksEl);
+        } catch (Throwable ex) {
+            verifySecondRootGet(methodEls.get(0), booksEl);
         }
         
         // verify POST
@@ -507,7 +495,7 @@ public class WadlGeneratorTest extends A
         // POST 
         assertEquals("POST", methodEls.get(0).getAttribute("name"));
         checkDocs(methodEls.get(0), "", "Update the books collection", "");
-        requestEls = getElements(methodEls.get(0), "request", 1);
+        List<Element> requestEls = getElements(methodEls.get(0), "request", 1);
         
         checkDocs(requestEls.get(0), "", "Request", "");
         
@@ -567,6 +555,35 @@ public class WadlGeneratorTest extends A
         verifyGetResourceMethod(chapterMethodEls.get(0), chapterEl, "Get the chapter");
     }
     
+    private void verifyFirstRootGet(Element methodEl) {
+        assertEquals("GET", methodEl.getAttribute("name"));
+        assertEquals(0, DOMUtils.getChildrenWithName(methodEl, 
+                        WadlGenerator.WADL_NS, "param").size());
+        // check request 
+        List<Element> requestEls = getElements(methodEl, "request", 1);
+        
+        // 4 parameters are expected
+        verifyParameters(requestEls.get(0), 5, 
+                         new Param("a", "query", "xs:int"),
+                         new Param("c.a", "query", "xs:int"),
+                         new Param("c.b", "query", "xs:int"),
+                         new Param("c.d.a", "query", "xs:int"),
+                         new Param("e", "query", "xs:string", Collections.singleton("A")));
+        
+        assertEquals(0, DOMUtils.getChildrenWithName(requestEls.get(0), 
+                         WadlGenerator.WADL_NS, "representation").size());
+        //check response
+        verifyRepresentation(methodEl, "response", "text/plain", "");
+    }
+    
+    private void verifySecondRootGet(Element methodEl, String booksEl) {
+        assertEquals("GET", methodEl.getAttribute("name"));
+        checkDocs(methodEl, "", "Get Books", "");
+        if (booksEl != null) {
+            verifyRepresentation(methodEl, "response", "application/xml", booksEl);
+        }
+    }
+    
     private void verifyFormSubResources(List<Element> subResourceEls) {
      // verify book-subresource /form1 resource
         List<Element> form1MethodEls = getElements(subResourceEls.get(1), "method",
1);



Mime
View raw message