You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2020/06/29 02:13:36 UTC

[cxf] branch 3.2.x-fixes updated (9d9dc38 -> e760e9f)

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

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


    from 9d9dc38  Recording .gitmergeinfo Changes
     new 5d085d4  CXF-8307: Invalid class generated if resource contains hyphen
     new e760e9f  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                                      |  2 ++
 .../cxf/tools/wadlto/jaxrs/SourceGenerator.java    |  2 +-
 .../cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java | 21 +++++++++++++
 .../{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%)


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

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5d085d422f60a7e6c70bb9f846dad94049326eb2
Author: reta <dr...@gmail.com>
AuthorDate: Sun Jun 28 16:23:35 2020 -0400

    CXF-8307: Invalid class generated if resource contains hyphen
    
    (cherry picked from commit 9a5b4568a94a72569caf4d012a42df6ebbe02779)
---
 .../cxf/tools/wadlto/jaxrs/SourceGenerator.java    |  2 +-
 .../cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java | 21 ++++++++++
 .../src/test/resources/wadl/bookstoreHyphen.xml    | 46 ++++++++++++++++++++++
 3 files changed, 68 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 d5f93c6..09a14bc 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
@@ -467,7 +467,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 566f3dc..5820df3 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
@@ -970,6 +970,27 @@ public class JAXRSContainerTest extends ProcessorTestBase {
         }
     }
 
+    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.getFilesRecurse(output, ".class");
+        assertEquals(3, files.size());
+        assertTrue(checkContains(files, "application" + ".BookstoreResource.class"));
+        assertTrue(checkContains(files, "generated" + ".TestCompositeObject.class"));
+        assertTrue(checkContains(files, "generated" + ".ObjectFactory.class"));
+    }
+
     private void verifyFiles(String ext, boolean subresourceExpected, boolean interfacesAndImpl,
                              String schemaPackage, String resourcePackage, int expectedCount) {
         verifyFiles(ext, subresourceExpected, interfacesAndImpl, schemaPackage, resourcePackage,
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>


[cxf] 02/02: Recording .gitmergeinfo Changes

Posted by re...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit e760e9f4f5d0656944b03e9ebc1a6562896decdd
Author: reta <dr...@gmail.com>
AuthorDate: Sun Jun 28 22:12:27 2020 -0400

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

diff --git a/.gitmergeinfo b/.gitmergeinfo
index 399ae05..d890560 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -339,6 +339,7 @@ B 558d3a15e18a54ba797d317add96e34d67850d54
 B 55afdc9373257d8c111468926c7278b4e9b28a61
 B 55d5b1abf6dff2056289a0433de828c49f25afcc
 B 5601ae06f2f85e09c2319a0086a1a1ea5a1df270
+B 56d30f1eeb9c9a9d264911f7bf78132245d08bff
 B 57025af84e7fd41e3a0832385adce91c086957e3
 B 5707393922f2cc5997caab5489ad55b7d70eb949
 B 5769cea56830cf778625b871b341b11d185773b8
@@ -1002,6 +1003,7 @@ M 37537350f8c56635902b6566dc94bec19a4e19c3
 M 37f997f79c3f583b4966ae1bd60d0603101ec750
 M 38158988f675b4ad7056cee2bdb8cec081aefbb8
 M 3904a477e70fe6385777120bfe4820ff9a7713f3
+M 39e1754a0a145805acb775f755c82223e0ce261a
 M 3a2dfead4f48b9c9e41e48eddb512c1dfe3c046c
 M 3aaaad57c6bf541825c6ccfe427de2bae2c246d9
 M 3c5de459b1ce9a62464f7fc998dbb919be09d5a0