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

billblough pushed a commit to branch AXIS2-4091
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit d341fa3de89d70761bb9ed9d335c33654a2ba31b
Merge: 9c54c8a 25ae0f1
Author: Andreas Veithen <veit...@apache.org>
AuthorDate: Sun Dec 17 22:16:04 2017 +0000

    Merge r1536050 from the trunk.

 modules/adb-codegen/pom.xml                        |    5 +-
 .../org/apache/axis2/schema/ExtensionUtility.java  |   49 +-
 .../org/apache/axis2/schema/SchemaCompiler.java    | 1548 +++++++++++---------
 .../axis2/schema/template/ADBBeanTemplate-bean.xsl |    3 +-
 .../org/apache/axis2/schema/XMLSchemaTest.java     |   29 +-
 .../schema/extension/SimpleExtensionTest.java      |    9 +-
 .../codegen/extension/JAXWSWapperExtension.java    |   45 +-
 .../extension/SchemaUnwrapperExtension.java        |   48 +-
 .../codegen/extension/WSDLValidatorExtension.java  |    8 +-
 .../AxisServiceTopElementSchemaGenerator.java      |   34 +-
 .../apache/axis2/wsdl/codegen/XMLSchemaTest.java   |   27 +-
 .../extension/SchemaUnwrapperExtensionTest.java    |    2 +-
 .../extension/WSDLValidatorExtensionTest.java      |   12 +-
 .../axis2/corba/deployer/CorbaConstants.java       |    1 +
 .../axis2/corba/deployer/SchemaGenerator.java      |  149 +-
 modules/fastinfoset/pom.xml                        |    4 +-
 modules/integration/pom.xml                        |    5 +
 modules/java2wsdl/pom.xml                          |    4 +-
 .../apache/axis2/jaxbri/CodeGenerationUtility.java |    2 +-
 .../apache/axis2/jaxbri/JaxbSchemaGenerator.java   |   31 +-
 .../src/test/java/org/temp/XMLSchemaTest.java      |   27 +-
 .../apache/axis2/jibx/CodeGenerationUtility.java   |   12 +-
 .../axis2/json/gson/factory/XmlNodeGenerator.java  |   12 +-
 .../axis2/json/gson/GsonXMLStreamReaderTest.java   |    2 +-
 .../axis2/json/gson/GsonXMLStreamWriterTest.java   |    2 +-
 .../axis2/json/gson/JSONMessageHandlerTest.java    |    3 +-
 .../apache/axis2/json/gson/JsonFormatterTest.java  |    2 +-
 .../json/gson/factory/XmlNodeGeneratorTest.java    |    4 +-
 modules/kernel/pom.xml                             |   11 +-
 .../src/org/apache/axis2/builder/BuilderUtil.java  |  136 +-
 .../org/apache/axis2/description/AxisMessage.java  |   35 +-
 .../org/apache/axis2/description/AxisService.java  |   62 +-
 .../axis2/description/AxisService2WSDL20.java      |   61 +-
 .../java2wsdl/DefaultSchemaGenerator.java          |  250 ++--
 .../java2wsdl/DocLitBareSchemaGenerator.java       |  114 +-
 .../src/org/apache/axis2/util/SchemaUtil.java      |   28 +-
 .../test-resources/wsdl/printWSDLreference.wsdl    |    6 +-
 ...stGenerateInterfaceOperationElement11_WSDL.wsdl |    6 +-
 ...testGenerateInterfaceOperationElement_WSDL.wsdl |    6 +-
 .../apache/axis2/description/AxisServiceTest.java  |   23 +-
 .../WSDL11ToAxisServiceBuilderTest.java            |    6 +-
 .../java2wsdl/DefaultSchemaGeneratorTest.java      |   17 +-
 .../axis2/description/java2wsdl/XMLSchemaTest.java |   22 +-
 modules/parent/pom.xml                             |   13 +-
 modules/tool/axis2-ant-plugin/pom.xml              |    4 +-
 modules/tool/axis2-idea-plugin/pom.xml             |    6 +-
 .../apache/axis2/transport/http/XMLSchemaTest.java |   27 +-
 .../apache/axis2/transport/xmpp/XMPPSender.java    |   63 +-
 .../axis2/xmlbeans/CodeGenerationUtility.java      |   10 +-
 49 files changed, 1611 insertions(+), 1374 deletions(-)

diff --cc modules/kernel/test-resources/wsdl/printWSDLreference.wsdl
index c5f46eb,c5f46eb..7ea26e5
--- a/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl
+++ b/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl
@@@ -1,5 -1,5 +1,4 @@@
--<?xml version="1.0" encoding="UTF-8"?>
--<!--
++<?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
@@@ -16,8 -16,8 +15,7 @@@
    ~ KIND, either express or implied. See the License for the
    ~ specific language governing permissions and limitations
    ~ under the License.
--  -->
--<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:tns="http://ws.apache.org/axis2"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; 
targetNamespace="http://ws.apache.org/axis2";>
++  --><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:tns="http://ws.apache.org/axis2"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; 
targetNamespace="http://ws.apache.org/axis2";>
      <wsdl:types/>
      <wsdl:portType name="testPortType">
          <wsdl:operation name="test">
diff --cc 
modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl
index c5f46eb,c5f46eb..7ea26e5
--- 
a/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl
+++ 
b/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl
@@@ -1,5 -1,5 +1,4 @@@
--<?xml version="1.0" encoding="UTF-8"?>
--<!--
++<?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
@@@ -16,8 -16,8 +15,7 @@@
    ~ KIND, either express or implied. See the License for the
    ~ specific language governing permissions and limitations
    ~ under the License.
--  -->
--<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:tns="http://ws.apache.org/axis2"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; 
targetNamespace="http://ws.apache.org/axis2";>
++  --><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:tns="http://ws.apache.org/axis2"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; 
targetNamespace="http://ws.apache.org/axis2";>
      <wsdl:types/>
      <wsdl:portType name="testPortType">
          <wsdl:operation name="test">
diff --cc 
modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl
index aeac035,aeac035..563da91
--- 
a/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl
+++ 
b/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl
@@@ -1,5 -1,5 +1,4 @@@
--<?xml version="1.0" encoding="UTF-8"?>
--<!--
++<?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
@@@ -16,8 -16,8 +15,7 @@@
    ~ KIND, either express or implied. See the License for the
    ~ specific language governing permissions and limitations
    ~ under the License.
--  -->
--<wsdl2:description xmlns:wsdl2="http://www.w3.org/ns/wsdl"; 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
xmlns:tns="http://ws.apache.org/axis2"; 
xmlns:wsoap="http://www.w3.org/ns/wsdl/soap"; 
xmlns:wrpc="http://www.w3.org/ns/wsdl/rpc"; 
xmlns:wsdlx="http://www.w3.org/ns/wsdl-extensions"; 
xmlns:whttp="http://www.w3.org/ns/wsdl/http"; 
targetNamespace="http://ws.apache.org/axis2";>
++  --><wsdl2:description xmlns:wsdl2="http://www.w3.org/ns/wsdl"; 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
xmlns:tns="http://ws.apache.org/axis2"; 
xmlns:wsoap="http://www.w3.org/ns/wsdl/soap"; 
xmlns:wrpc="http://www.w3.org/ns/wsdl/rpc"; 
xmlns:wsdlx="http://www.w3.org/ns/wsdl-extensions"; 
xmlns:whttp="http://www.w3.org/ns/wsdl/http"; 
targetNamespace="http://ws.apache.org/axis2";>
      <wsdl2:types/>
      <wsdl2:interface name="ServiceInterface">
          <wsdl2:operation name="test" 
pattern="http://www.w3.org/ns/wsdl/in-out";>
diff --cc 
modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
index 7f64d71,4854c97..04cdb4d
--- 
a/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
+++ 
b/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
@@@ -21,18 -21,9 +21,16 @@@ package org.apache.axis2.description
  import java.io.FileInputStream;
  import java.io.InputStream;
  import java.util.List;
 +import java.util.ArrayList;
- import java.util.Iterator;
 +import java.util.Set;
 +import java.util.HashSet;
  
  import javax.xml.namespace.QName;
  
 +import org.apache.ws.commons.schema.XmlSchema;
 +import org.apache.ws.commons.schema.XmlSchemaElement;
 +import org.apache.ws.commons.schema.XmlSchemaObject;
- import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
 +
  import junit.framework.TestCase;
  
  public class WSDL11ToAxisServiceBuilderTest extends TestCase {
@@@ -63,45 -54,4 +61,43 @@@
              in.close();
          }
      }
 +    
 +    public void testNonDuplicatedElementsHttpBinding() throws Exception {
 +        final String wsdlPath = 
"test-resources/wsdl/nonduplicatedElements.wsdl";
 +        InputStream in = new FileInputStream(wsdlPath);
 +        final String targetNamespace = "http://www.example.org";;
 +        final QName serviceName = new QName(targetNamespace, "FooService");
 +        final String portName = "FooHttpGetPort";
 +          
 +        AxisService service = new WSDL11ToAxisServiceBuilder(in, serviceName, 
portName).populateService();
 +        List schemaDocuments = service.getSchema();
 +        List duplicatedGlobalElements = 
findDuplicatedGlobalElements(schemaDocuments);
 +        // NO duplicated element should exists
 +        assertTrue("Duplicated global element declarations found in '" +  
wsdlPath, 
 +            duplicatedGlobalElements.isEmpty());
 +    }
 +
 +    protected List findDuplicatedGlobalElements(List schemaDocuments) {
 +        List duplicatedGlobalElementDeclarations = new ArrayList();
 +        Set globalElementDeclarations = new HashSet();
 +        // Iterate over all schema documents
 +        for (int i = 0; i < schemaDocuments.size(); i++) {
 +            XmlSchema schemaDocument = (XmlSchema)schemaDocuments.get(i);
-             XmlSchemaObjectCollection items = schemaDocument.getItems();
-             for (Iterator itemsIt = items.getIterator(); itemsIt.hasNext();) {
-                 XmlSchemaObject xmlSchemaObject = 
(XmlSchemaObject)itemsIt.next();
++            for (XmlSchemaObject xmlSchemaObject : schemaDocument.getItems()) 
{
 +                // Check only XML schema elements
 +                if (xmlSchemaObject instanceof XmlSchemaElement) {
 +                    QName elementName = 
((XmlSchemaElement)xmlSchemaObject).getQName();
 +                    /* Was another element with the same name found in this or
 +                      other XML schema document? */
 +                    if (globalElementDeclarations.contains(elementName)) {
 +                        duplicatedGlobalElementDeclarations.add(elementName);
 +                    } else {
 +                        globalElementDeclarations.add(elementName);
 +                    }
 +                }
 +            }
 +        }
 +        return duplicatedGlobalElementDeclarations;
 +    }
 +
  }

Reply via email to