[cxf] branch 3.3.x-fixes updated (066e10a -> 56d30f1)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[cxf] branch 3.3.x-fixes updated (066e10a -> 56d30f1)

reta
This is an automated email from the ASF dual-hosted git repository.

reta pushed a change to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git.


    from 066e10a  Recording .gitmergeinfo Changes
     new 39e1754  CXF-8307: Invalid class generated if resource contains hyphen
     new 56d30f1  Recording .gitmergeinfo Changes

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitmergeinfo                                      |  1 +
 .../cxf/tools/wadlto/jaxrs/SourceGenerator.java    |  2 +-
 .../cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java | 22 ++++++++++++++
 .../{multipleResources.xml => bookstoreHyphen.xml} | 35 ++++++++++++----------
 4 files changed, 44 insertions(+), 16 deletions(-)
 copy tools/wadlto/jaxrs/src/test/resources/wadl/{multipleResources.xml => bookstoreHyphen.xml} (53%)

Reply | Threaded
Open this post in threaded view
|

[cxf] 01/02: CXF-8307: Invalid class generated if resource contains hyphen

reta
This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 39e1754a0a145805acb775f755c82223e0ce261a
Author: reta <[hidden email]>
AuthorDate: Sun Jun 28 16:23:35 2020 -0400

    CXF-8307: Invalid class generated if resource contains hyphen
   
    (cherry picked from commit 9a5b4568a94a72569caf4d012a42df6ebbe02779)
   
    # Conflicts:
    # tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
---
 .../cxf/tools/wadlto/jaxrs/SourceGenerator.java    |  2 +-
 .../cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java | 22 +++++++++++
 .../src/test/resources/wadl/bookstoreHyphen.xml    | 46 ++++++++++++++++++++++
 3 files changed, 69 insertions(+), 1 deletion(-)

diff --git a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
index af72010..b372ad6 100644
--- a/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
+++ b/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java
@@ -465,7 +465,7 @@ public class SourceGenerator {
         if (resourceId.length() == 0) {
             String path = rElement.getAttribute("path");
             if (path.length() > 0) {
-                path = path.replaceAll("[\\{\\}_]*", "");
+                path = path.replaceAll("[-\\{\\}_]*", "");
                 String[] split = path.split("/");
                 StringBuilder builder = new StringBuilder(resourceId);
                 for (int i = 0; i < split.length; i++) {
diff --git a/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java b/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
index f948a48..8f892d6 100644
--- a/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
+++ b/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
@@ -810,6 +810,28 @@ public class JAXRSContainerTest extends ProcessorTestBase {
     }
 
     @Test
+    public void testCodeGenHyphen() throws Exception {
+        JAXRSContainer container = new JAXRSContainer(null);
+
+        ToolContext context = new ToolContext();
+        context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
+        context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstoreHyphen.xml"));
+        context.put(WadlToolConstants.CFG_IMPL, "true");
+        context.put(WadlToolConstants.CFG_COMPILE, "true");
+
+        container.setContext(context);
+        container.execute();
+
+        assertNotNull(output.list());
+
+        List<File> files = FileUtils.getFilesRecurseUsingSuffix(output, ".class");
+        assertEquals(3, files.size());
+        assertTrue(checkContains(files, "application" + ".BookstoreResource.class"));
+        assertTrue(checkContains(files, "generated" + ".TestCompositeObject.class"));
+        assertTrue(checkContains(files, "generated" + ".ObjectFactory.class"));
+    }
+
+    @Test
     public void testCodeGenTypesOnly() throws Exception {
         JAXRSContainer container = new JAXRSContainer(null);
 
diff --git a/tools/wadlto/jaxrs/src/test/resources/wadl/bookstoreHyphen.xml b/tools/wadlto/jaxrs/src/test/resources/wadl/bookstoreHyphen.xml
new file mode 100644
index 0000000..f040db0
--- /dev/null
+++ b/tools/wadlto/jaxrs/src/test/resources/wadl/bookstoreHyphen.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<application xmlns="http://wadl.dev.java.net/2009/02"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+    <doc title="My Application"/>
+    <grammars>
+        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+         <xs:element name="test" type="testCompositeObject"/>
+            <xs:complexType name="testCompositeObject">
+                <xs:sequence>
+                    <xs:element name="id" type="xs:int"/>
+                    <xs:element minOccurs="0" name="name" type="xs:string"/>
+                </xs:sequence>
+            </xs:complexType>
+        </xs:schema>
+    </grammars>
+    <resources base="http://localhost:8080/baz">
+        <resource path="/book-store">
+            <method name="PUT">
+                <request>
+                    <representation mediaType="application/xml" element="test"/>
+                </request>
+                <response>
+                    <representation mediaType="application/xml" element="test"/>
+                </response>
+            </method>
+        </resource>
+    </resources>
+</application>

Reply | Threaded
Open this post in threaded view
|

[cxf] 02/02: Recording .gitmergeinfo Changes

reta
In reply to this post by reta
This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch 3.3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 56d30f1eeb9c9a9d264911f7bf78132245d08bff
Author: reta <[hidden email]>
AuthorDate: Sun Jun 28 16:37:16 2020 -0400

    Recording .gitmergeinfo Changes
---
 .gitmergeinfo | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitmergeinfo b/.gitmergeinfo
index baca2a6..4b3c5db 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -334,6 +334,7 @@ M 92a00fc05e2437d2d0cf98099060ba4e1f6dac99
 M 92d4bfe929c5d11f19c6dd2974f0f880ba7d5382
 M 95c3c37092751b1d00b6f2c26642f18ebcbba878
 M 972a2755ca85ba86f473b0ce46f23bf6193ced62
+M 9a5b4568a94a72569caf4d012a42df6ebbe02779
 M 9c2721f27e9697fa0f515e0787f75c26077d0572
 M 9c37b6c321f06621334076cc61b5b31b237f634d
 M 9c462e9bd614d529f0a2fd86490243ea1c858651