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 2022/01/11 00:43:10 UTC
[cxf-xjc-utils] branch 3.x-fixes updated: CXFXJC-41: Regression with JAXB 2.3.5 / 3.x: http://schemas.xmlsoap.org/wsdl/ is not a part of this compilation (#11)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch 3.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf-xjc-utils.git
The following commit(s) were added to refs/heads/3.x-fixes by this push:
new 059fac2 CXFXJC-41: Regression with JAXB 2.3.5 / 3.x: http://schemas.xmlsoap.org/wsdl/ is not a part of this compilation (#11)
059fac2 is described below
commit 059fac2c3fdeeb1620393d0fa7b8b364b7642d22
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Mon Jan 10 19:37:46 2022 -0500
CXFXJC-41: Regression with JAXB 2.3.5 / 3.x: http://schemas.xmlsoap.org/wsdl/ is not a part of this compilation (#11)
* CXFXJC-41: Regression with JAXB 2.3.5 / 3.x: http://schemas.xmlsoap.org/wsdl/ is not a part of this compilation
* CXFXJC-41: Added a test case
---
.../apache/cxf/maven_plugin/XSDToJavaRunner.java | 2 +-
.../cxf/maven_plugin/XSDToJavaRunnerTest.java | 60 ++++++++++++++++++++++
.../resources/schemas/configuration/catalog.cat | 24 +++++++++
.../test/resources/schemas/configuration/wsdl.xsd | 43 ++++++++++++++++
.../src/test/resources/schemas/wsdl/test.xjb | 30 +++++++++++
.../src/test/resources/schemas/wsdl/test.xsd | 29 +++++++++++
6 files changed, 187 insertions(+), 1 deletion(-)
diff --git a/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
index 776d018..493e1d9 100644
--- a/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
+++ b/cxf-xjc-plugin/src/main/java/org/apache/cxf/maven_plugin/XSDToJavaRunner.java
@@ -124,7 +124,7 @@ public class XSDToJavaRunner {
if (resolved == null) {
return null;
}
- InputSource iSource = new InputSource(resolved);
+ InputSource iSource = new InputSource((systemId != null) ? systemId : resolved);
iSource.setPublicId(publicId);
try {
final URL url;
diff --git a/cxf-xjc-plugin/src/test/java/org/apache/cxf/maven_plugin/XSDToJavaRunnerTest.java b/cxf-xjc-plugin/src/test/java/org/apache/cxf/maven_plugin/XSDToJavaRunnerTest.java
new file mode 100644
index 0000000..0453205
--- /dev/null
+++ b/cxf-xjc-plugin/src/test/java/org/apache/cxf/maven_plugin/XSDToJavaRunnerTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.maven_plugin;
+
+import java.io.File;
+import java.util.Collections;
+
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class XSDToJavaRunnerTest {
+ @Rule public TemporaryFolder outputFolder = new TemporaryFolder();
+
+ @Test
+ public void testCatalogAndBindings() throws Exception {
+ final BuildContext context = new XJCBuildContext();
+ final XJCErrorListener listener = new XJCErrorListener(context);
+
+ final File outputFile = outputFolder.newFile();
+ final String xjb = getClass().getResource("/schemas/wsdl/test.xjb").toExternalForm();
+ final String xsd = getClass().getResource("/schemas/wsdl/test.xsd").toExternalForm();
+ final String catalog = getClass().getResource("/schemas/configuration/catalog.cat").toExternalForm();
+
+ new XSDToJavaRunner(
+ new String [] {
+ "-catalog", catalog,
+ "-b", xjb,
+ xsd
+ },
+ listener,
+ outputFile,
+ Collections.emptyList()).run();
+
+ assertThat(listener.getFirstError(), is(nullValue()));
+ }
+}
diff --git a/cxf-xjc-plugin/src/test/resources/schemas/configuration/catalog.cat b/cxf-xjc-plugin/src/test/resources/schemas/configuration/catalog.cat
new file mode 100644
index 0000000..ad375e4
--- /dev/null
+++ b/cxf-xjc-plugin/src/test/resources/schemas/configuration/catalog.cat
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+ <system systemId="http://schemas.xmlsoap.org/wsdl/" uri="wsdl.xsd"/>
+</catalog>
diff --git a/cxf-xjc-plugin/src/test/resources/schemas/configuration/wsdl.xsd b/cxf-xjc-plugin/src/test/resources/schemas/configuration/wsdl.xsd
new file mode 100644
index 0000000..cbaf8bf
--- /dev/null
+++ b/cxf-xjc-plugin/src/test/resources/schemas/configuration/wsdl.xsd
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+Copyright 2001 - 2005, International Business Machines Corporation and Microsoft Corporation
+All Rights Reserved
+
+License for WSDL Schema Files
+
+The Authors grant permission to copy and distribute the WSDL Schema
+Files in any medium without fee or royalty as long as this notice and
+license are distributed with them. The originals of these files can
+be located at:
+
+http://schemas.xmlsoap.org/wsdl/2004-08-24.xsd
+
+THESE SCHEMA FILES ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS
+OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THESE FILES, INCLUDING, BUT NOT
+LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT,
+INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR
+RELATING TO ANY USE OR DISTRIBUTION OF THESE FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner,
+including advertising or publicity pertaining to these files or any program
+or service that uses these files, written prior permission. Title to copyright
+in these files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ targetNamespace="http://schemas.xmlsoap.org/wsdl/"
+ elementFormDefault="qualified" >
+
+ <xs:complexType mixed="true" name="tDocumentation" >
+ <xs:sequence>
+ <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+ </xs:sequence>
+ </xs:complexType>
+
+</xs:schema>
diff --git a/cxf-xjc-plugin/src/test/resources/schemas/wsdl/test.xjb b/cxf-xjc-plugin/src/test/resources/schemas/wsdl/test.xjb
new file mode 100644
index 0000000..93c53a7
--- /dev/null
+++ b/cxf-xjc-plugin/src/test/resources/schemas/wsdl/test.xjb
@@ -0,0 +1,30 @@
+<?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.
+-->
+<jaxb:bindings version="2.0"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+ jaxb:extensionBindingPrefixes="xjc">
+ <jaxb:bindings schemaLocation="http://schemas.xmlsoap.org/wsdl/" node="/xs:schema">
+ <jaxb:schemaBindings>
+ <jaxb:package name="org.apache.cxf.wsdl"/>
+ </jaxb:schemaBindings>
+ </jaxb:bindings>
+</jaxb:bindings>
diff --git a/cxf-xjc-plugin/src/test/resources/schemas/wsdl/test.xsd b/cxf-xjc-plugin/src/test/resources/schemas/wsdl/test.xsd
new file mode 100644
index 0000000..03a28b3
--- /dev/null
+++ b/cxf-xjc-plugin/src/test/resources/schemas/wsdl/test.xsd
@@ -0,0 +1,29 @@
+<?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.
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://cxf.apache.org/abc/test"
+ xmlns:tns="http://cxf.apache.org/abc/test"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <xs:import namespace="http://schemas.xmlsoap.org/wsdl/" schemaLocation="http://schemas.xmlsoap.org/wsdl/"/>
+
+</xs:schema>