cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1328502 - in /cxf/trunk/tools/wadlto/jaxrs/src: main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java test/resources/wadl/singleResource.xml
Date Fri, 20 Apr 2012 21:10:33 GMT
Author: sergeyb
Date: Fri Apr 20 21:10:33 2012
New Revision: 1328502

URL: http://svn.apache.org/viewvc?rev=1328502&view=rev
Log:
[CXF-4256] Adding a simple test

Modified:
    cxf/trunk/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
    cxf/trunk/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
    cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/singleResource.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=1328502&r1=1328501&r2=1328502&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
Fri Apr 20 21:10:33 2012
@@ -851,7 +851,8 @@ public class SourceGenerator {
                 }
             }
             boolean isRepeating = Boolean.valueOf(paramEl.getAttribute("repeating"));
-            String type = getPrimitiveType(paramEl, info, imports);
+            String type = enumCreated ? getTypicalClassName(name)
+                : getPrimitiveType(paramEl, info, imports);
             if (paramAnn == QueryParam.class
                 && (isRepeating || !Boolean.valueOf(paramEl.getAttribute("required")))
   
                 && AUTOBOXED_PRIMITIVES_MAP.containsKey(type)) {
@@ -861,8 +862,7 @@ public class SourceGenerator {
                 addImport(imports, List.class.getName());
                 type = "List<" + type + ">";
             }
-            String paramName = enumCreated ? getTypicalClassName(name) 
-                                           : name.replaceAll("[\\.\\-]", "_");
+            String paramName = name.replaceAll("[\\.\\-]", "_");
             sbCode.append(type).append(" ").append(paramName);
             if (i + 1 < inParamEls.size()) {
                 sbCode.append(", ");

Modified: cxf/trunk/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java?rev=1328502&r1=1328501&r2=1328502&view=diff
==============================================================================
--- cxf/trunk/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
(original)
+++ cxf/trunk/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
Fri Apr 20 21:10:33 2012
@@ -279,6 +279,7 @@ public class JAXRSContainerTest extends 
             context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
             context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/singleResource.xml"));
             context.put(WadlToolConstants.CFG_RESOURCENAME, "CustomResource");
+            context.put(WadlToolConstants.CFG_GENERATE_ENUMS, "true");
             context.put(WadlToolConstants.CFG_COMPILE, "true");
             
             container.setContext(context);
@@ -287,12 +288,14 @@ public class JAXRSContainerTest extends 
             assertNotNull(output.list());
             
             List<File> javaFiles = FileUtils.getFilesRecurse(output, ".+\\." + "java"
+ "$");
-            assertEquals(1, javaFiles.size());
+            assertEquals(2, javaFiles.size());
             assertTrue(checkContains(javaFiles, "application.CustomResource.java"));
+            assertTrue(checkContains(javaFiles, "application.Theid.java"));
             
             List<File> classFiles = FileUtils.getFilesRecurse(output, ".+\\." + "class"
+ "$");
-            assertEquals(1, classFiles.size());
+            assertEquals(2, classFiles.size());
             assertTrue(checkContains(classFiles, "application.CustomResource.class"));
+            assertTrue(checkContains(classFiles, "application.Theid.class"));
         } catch (Exception e) {
             e.printStackTrace();
             fail();

Modified: cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/singleResource.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/singleResource.xml?rev=1328502&r1=1328501&r2=1328502&view=diff
==============================================================================
--- cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/singleResource.xml (original)
+++ cxf/trunk/tools/wadlto/jaxrs/src/test/resources/wadl/singleResource.xml Fri Apr 20 21:10:33
2012
@@ -21,7 +21,10 @@
 
  <resources base="http://localhost:8080/baz">
    <resource path="/bookstore/{id}">
-     <param name="id" style="template" type="xs:long"/>
+     <param name="theid" style="template" type="xs:string">
+       <option value="one"/>
+       <option value="two"/>
+     </param>
      <method name="GET">
       <request/>
       <response>



Mime
View raw message