You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2014/01/16 12:50:04 UTC

svn commit: r1558763 - in /cxf/trunk/tools/wadlto/jaxrs/src: main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java test/resources/wadl/bookstore.xml

Author: sergeyb
Date: Thu Jan 16 11:50:04 2014
New Revision: 1558763

URL: http://svn.apache.org/r1558763
Log:
[CXF-5494] Making sure '-' does not make it into the method names

Modified:
    cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
    cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/bookstore.xml

Modified: cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java?rev=1558763&r1=1558762&r2=1558763&view=diff
==============================================================================
--- cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java (original)
+++ cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java Thu Jan 16 11:50:04 2014
@@ -676,7 +676,7 @@ public class SourceGenerator {
             if (!jaxpSourceRequired && inXmlRep != null && xmlRequestReps.size() > 1) {
                 String value = inXmlRep.getAttribute("element");
                 int index = value.indexOf(":");
-                suffixName = value.substring(index + 1);
+                suffixName = value.substring(index + 1).replace("-", "");
             }
             if (writeAnnotations(info.isInterfaceGenerated())) {
                 sbCode.append(TAB);
@@ -706,6 +706,9 @@ public class SourceGenerator {
             if (methodNameLowerCase.length() > 0) {
                 responseTypeAvailable = writeResponseType(responseEls, sbCode, imports, info, suspendedAsync);
                 String genMethodName = id + suffixName;
+                if (genMethodName.contains("-")) {
+                    System.out.println(genMethodName);
+                }
                 if (methodNameLowerCase.equals(genMethodName)) {
                     List<PathSegment> segments = JAXRSUtils.getPathSegments(currentPath, true, true);
                     StringBuilder sb = new StringBuilder();

Modified: cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/bookstore.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/bookstore.xml?rev=1558763&r1=1558762&r2=1558763&view=diff
==============================================================================
--- cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/bookstore.xml (original)
+++ cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/bookstore.xml Thu Jan 16 11:50:04 2014
@@ -21,7 +21,7 @@
     <grammars>
         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://superbooks" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://superbooks">
             <xs:element name="thebook" type="tns:book"/>
-            <xs:element name="theBook2" type="tns:theBook2"/>
+            <xs:element name="the-Book2" type="tns:theBook2"/>
             <xs:element name="thechapter" type="tns:chapter"/>
             <xs:complexType name="book">
                 <xs:sequence>
@@ -89,7 +89,7 @@
             <resource path="/book2/{bookid:.*}">
                 <method name="GET" id="getBook2">
                     <response>
-                        <representation mediaType="application/xml" element="prefix1:theBook2"/>
+                        <representation mediaType="application/xml" element="prefix1:the-Book2"/>
                         <representation mediaType="application/json"/>
                     </response>
                 </method>
@@ -116,10 +116,10 @@
                         <param name="provider.bar" style="query" required="true" type="xs:int"/>
                         <param name="a" style="query" repeating="true" type="xs:string"/>
                         <param name="b:c" style="query" repeating="true" type="xs:long"/>
-                        <representation mediaType="application/xml" element="prefix1:theBook2">
+                        <representation mediaType="application/xml" element="prefix1:the-Book2">
                             <doc>InputBook</doc>
                         </representation>
-                        <representation mediaType="application/json" element="prefix1:theBook2">
+                        <representation mediaType="application/json" element="prefix1:the-Book2">
                             <doc>InputBook</doc>
                         </representation>
                     </request>
@@ -144,7 +144,7 @@
                 <method name="POST" id="addBookOrBook2">
                     <request>
                         <representation mediaType="application/xml" element="prefix1:thebook"/>
-                        <representation mediaType="application/xml" element="prefix1:theBook2"/>
+                        <representation mediaType="application/xml" element="prefix1:the-Book2"/>
                         <representation mediaType="application/json"/>
                     </request>
                     <response status="201"/>