cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6446] More updates
Date Fri, 12 Jun 2015 12:08:02 GMT
Repository: cxf
Updated Branches:
  refs/heads/master a7f8a6325 -> 1542c8d62


[CXF-6446] More updates


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1542c8d6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1542c8d6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1542c8d6

Branch: refs/heads/master
Commit: 1542c8d62cb69109a4717c81409b6d2fc4f740b8
Parents: a7f8a63
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Jun 12 13:07:41 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Jun 12 13:07:41 2015 +0100

----------------------------------------------------------------------
 .../cxf/jaxrs/model/wadl/JavaDocProvider.java   |  15 ++---
 .../jaxrs/model/wadl/JavaDocProviderTest.java   |  47 +++++++++++----
 .../cxf/jaxrs/model/wadl/petstore/PetStore.java |  60 ++++++++++---------
 .../resources/javadocs/pet-store-javadoc16.jar  | Bin 5068 -> 3569 bytes
 .../resources/javadocs/pet-store-javadoc17.jar  | Bin 5024 -> 3601 bytes
 .../resources/javadocs/pet-store-javadoc18.jar  | Bin 4046 -> 3873 bytes
 6 files changed, 75 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/1542c8d6/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProvider.java
b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProvider.java
index bcfd5be..17162bc 100644
--- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProvider.java
+++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProvider.java
@@ -189,12 +189,13 @@ public class JavaDocProvider implements DocumentationProvider {
                 if (endOfOpSigIndex == startOfOpSigIndex && paramLen == 0) {
                     break;
                 } else if (endOfOpSigIndex > startOfOpSigIndex + 1) {
-                    
-                    String[] opBits = 
-                        classDoc.getClassDoc().substring(operMarkerIndex, endOfOpSigIndex)
-                            .split(getOperationParamSeparator());
-                    if (opBits.length == paramLen) {
-                        break;
+                    String paramSequence = classDoc.getClassDoc().substring(operMarkerIndex,
endOfOpSigIndex);
+                    if (paramSequence.startsWith(operMarker)) {
+                        paramSequence = paramSequence.substring(operMarker.length());
+                        String[] opBits = paramSequence.split(getOperationParamSeparator());
+                        if (opBits.length == paramLen) {
+                            break;
+                        }
                     }
                 }
                 operMarkerIndex = classDoc.getClassDoc().indexOf(operMarker, 
@@ -301,7 +302,7 @@ public class JavaDocProvider implements DocumentationProvider {
         return javaDocsBuiltByVersion == JAVA_VERSION_18 ? "-" : "(";
     }
     protected String getOperationMarkerClose() {
-        return javaDocsBuiltByVersion == JAVA_VERSION_18 ? "-" : ")";
+        return javaDocsBuiltByVersion == JAVA_VERSION_18 ? "-\"" : ")";
     }
     protected String getOperationParamSeparator() {
         return javaDocsBuiltByVersion == JAVA_VERSION_18 ? "-" : ",";

http://git-wip-us.apache.org/repos/asf/cxf/blob/1542c8d6/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProviderTest.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProviderTest.java
b/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProviderTest.java
index 486e7f1..f8f675e 100644
--- a/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProviderTest.java
+++ b/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProviderTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.cxf.jaxrs.model.wadl;
 
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
 import org.apache.cxf.jaxrs.model.OperationResourceInfo;
 import org.apache.cxf.jaxrs.model.wadl.petstore.PetStore;
@@ -51,32 +50,58 @@ public class JavaDocProviderTest extends Assert {
         String classDoc = p.getClassDoc(cri);
         assertEquals("The Pet Store", classDoc);
         
-        boolean getStatusTested = false;
+        boolean getStatus1Tested = false;
+        boolean getStatus2Tested = false;
+        boolean getStatus3Tested = false;
         boolean noDocsTested = false;
         for (OperationResourceInfo ori : cri.getMethodDispatcher().getOperationResourceInfos())
{
-            if ("getStatus".equals(ori.getMethodToInvoke().getName())) {
-                testGetStatusJavaDocs(p, ori);
-                getStatusTested = true;
-            } else {
+            if ("getStatus1Param".equals(ori.getMethodToInvoke().getName())) {
+                testGetStatus1JavaDocs(p, ori);
+                getStatus1Tested = true;
+            } else if ("getStatus2Params".equals(ori.getMethodToInvoke().getName())) {
+                testGetStatus2JavaDocs(p, ori);
+                getStatus2Tested = true;
+            } else if ("getStatus3Params".equals(ori.getMethodToInvoke().getName())) {
+                testGetStatus3JavaDocs(p, ori);
+                getStatus3Tested = true;
+            } else if ("getBaseStatus".equals(ori.getMethodToInvoke().getName())) {
                 testOperWithNoJavaDocs(p, ori);
                 noDocsTested = true;
             }
         }
-        assertTrue(getStatusTested);
+        assertTrue(getStatus1Tested);
+        assertTrue(getStatus2Tested);
+        assertTrue(getStatus3Tested);
         assertTrue(noDocsTested);
         assertTrue(true);
     }
 
     private void testOperWithNoJavaDocs(JavaDocProvider p, OperationResourceInfo ori) {
-        assertTrue(StringUtils.isEmpty(p.getMethodDoc(ori)));
-        assertTrue(StringUtils.isEmpty(p.getMethodResponseDoc(ori)));
+        assertEquals(0, ori.getParameters().size());
+        assertEquals("Return Pet Status with no params", p.getMethodDoc(ori));
+        assertEquals("status", p.getMethodResponseDoc(ori));
     }
     
-    private void testGetStatusJavaDocs(JavaDocProvider p, OperationResourceInfo ori) {
-        assertEquals("Return Pet Status", p.getMethodDoc(ori));
+    private void testGetStatus1JavaDocs(JavaDocProvider p, OperationResourceInfo ori) {
+        assertEquals("Return Pet Status With 1 Param", p.getMethodDoc(ori));
+        assertEquals(1, ori.getParameters().size());
+        assertEquals("status", p.getMethodResponseDoc(ori));
+        assertEquals("the pet id", p.getMethodParameterDoc(ori, 0));
+    }
+    private void testGetStatus2JavaDocs(JavaDocProvider p, OperationResourceInfo ori) {
+        assertEquals("Return Pet Status with 2 params", p.getMethodDoc(ori));
+        assertEquals(2, ori.getParameters().size());
+        assertEquals("status", p.getMethodResponseDoc(ori));
+        assertEquals("the pet id", p.getMethodParameterDoc(ori, 0));
+        assertEquals("the query", p.getMethodParameterDoc(ori, 1));
+    }
+    private void testGetStatus3JavaDocs(JavaDocProvider p, OperationResourceInfo ori) {
+        assertEquals("Return Pet Status With 3 Params", p.getMethodDoc(ori));
+        assertEquals(3, ori.getParameters().size());
         assertEquals("status", p.getMethodResponseDoc(ori));
         assertEquals("the pet id", p.getMethodParameterDoc(ori, 0));
         assertEquals("the query", p.getMethodParameterDoc(ori, 1));
+        assertEquals("the query2", p.getMethodParameterDoc(ori, 2));
     }
     
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/1542c8d6/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/petstore/PetStore.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/petstore/PetStore.java
b/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/petstore/PetStore.java
index 8804521..356e702 100644
--- a/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/petstore/PetStore.java
+++ b/rt/rs/description/src/test/java/org/apache/cxf/jaxrs/model/wadl/petstore/PetStore.java
@@ -19,17 +19,12 @@
 
 package org.apache.cxf.jaxrs.model.wadl.petstore;
 
-import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
-import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
-import javax.xml.bind.annotation.XmlType;
 
 /**
  * The Pet Store
@@ -44,13 +39,19 @@ public class PetStore {
 
     @GET
     @Produces("text/plain")
+    /**
+     * Return Pet Status with no params
+     * 
+     * @return status 
+     * @throws Exception
+     */
     public Response getBaseStatus() throws Exception {
 
         return Response.ok(CLOSED).build();
     }
     
     /**
-     * Return Pet Status
+     * Return Pet Status with 2 params
      * @param petId the pet id
      * @param query the query
      * @return status 
@@ -59,42 +60,43 @@ public class PetStore {
     @GET
     @Path("/petstore/pets/{petId}/")
     @Produces("text/xml")
-    public Response getStatus(@PathParam("petId") String petId,
+    public Response getStatus2Params(@PathParam("petId") String petId,
                               @QueryParam("query") String query) throws Exception {
 
         return Response.ok(CLOSED).build();
     }
     
-    
+    /**
+     * Return Pet Status With 1 Param
+     * @param petId the pet id
+     * @return status 
+     * @throws Exception
+     */
     @GET
-    @Path("/petstore/jaxb/status/")
+    @Path("/petstore/pets/id/{petId}/")
     @Produces("text/xml")
-    public PetStoreStatus getJaxbStatus() {
+    public Response getStatus1Param(@PathParam("petId") String petId) throws Exception {
 
-        return new PetStoreStatus();
+        return Response.ok(CLOSED).build();
     }
     
     
+    /**
+     * Return Pet Status With 3 Params
+     * @param petId the pet id
+     * @param query the query
+     * @param query2 the query2
+     * @return status 
+     * @throws Exception
+     */
     @GET
-    @POST
-    @Path("/petstore/pets/")
-    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
+    @Path("/petstore/pets/{petId}/")
     @Produces("text/xml")
-    public Response updateStatus(MultivaluedMap<String, String> params) throws Exception
{
-        return Response.ok(params.getFirst("status")).build();
-    }
-    
-    @XmlType(name = "status", namespace = "http://pets")
-    public static class PetStoreStatus {
-        private String status = PetStore.CLOSED;
-
-        public String getStatus() {
-            return status;
-        }
+    public Response getStatus3Params(@PathParam("petId") String petId,
+                              @QueryParam("query") String query,
+                              @QueryParam("query2") String query2) throws Exception {
 
-        public void setStatus(String status) {
-            this.status = status;
-        }
-        
+        return Response.ok(CLOSED).build();
     }
+    
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/1542c8d6/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc16.jar
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc16.jar b/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc16.jar
index aab8cc6..b7f2cb6 100644
Binary files a/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc16.jar and b/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc16.jar
differ

http://git-wip-us.apache.org/repos/asf/cxf/blob/1542c8d6/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc17.jar
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc17.jar b/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc17.jar
index 6d7ad99..d49a58d 100644
Binary files a/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc17.jar and b/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc17.jar
differ

http://git-wip-us.apache.org/repos/asf/cxf/blob/1542c8d6/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc18.jar
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc18.jar b/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc18.jar
index 8a6bb65..24a8c63 100644
Binary files a/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc18.jar and b/rt/rs/description/src/test/resources/javadocs/pet-store-javadoc18.jar
differ


Mime
View raw message