Skip to content

Commit c5c8da6

Browse files
authored
Bug 543265 - WSDL namespace order is different on ITEMSERVICEPORT?WSDL (#1879)
This is fix for this bug with unit test ClassArraySchemaGenTestCases.testSchemaGenFromClassArrayVerifyOrder() There are two sort calls. First sort in SchemaGenerator.java to sort input classes before schema name (like schema1.xsd, schema2.xsd....) is generated and assigned. Second sort in Generator.java to ensure that schemas will be passed to the output in specified order (by namespace). This fix leads into some changes in current unit tests in MOXy (schema generation), because some schemes are generated in different order. In some cases there are changes in order of complexType definition inside schemes. Signed-off-by: Radek Felcman [email protected] (cherry picked from commit 68fd69e)
1 parent ee5be0b commit c5c8da6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+859
-337
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0 which is available at
6+
* http://www.eclipse.org/legal/epl-2.0,
7+
* or the Eclipse Distribution License v. 1.0 which is available at
8+
* http://www.eclipse.org/org/documents/edl-v10.php.
9+
*
10+
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
11+
*/
12+
13+
// Contributors:
14+
// Radek Felcman (Oracle) - initial implementation
15+
package org.eclipse.persistence.internal.oxm.schema.model;
16+
17+
import java.util.Comparator;
18+
19+
public class SchemaCompareByNamespace implements Comparator<Schema>{
20+
21+
@Override
22+
public int compare(Schema arg1, Schema arg2) {
23+
String targetNamespace1 = arg1.getTargetNamespace() != null ? arg1.getTargetNamespace() : "";
24+
String targetNamespace2 = arg2.getTargetNamespace() != null ? arg2.getTargetNamespace() : "";
25+
return targetNamespace1.compareTo(targetNamespace2);
26+
}
27+
}

moxy/eclipselink.moxy.test/moxy.test.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<orderEntry type="module-library">
4343
<library>
4444
<CLASSES>
45-
<root url="jar://$MODULE_DIR$/../../plugins/com.sun.xml.bind.jaxb-osgi.jar!/" />
45+
<root url="jar://$MODULE_DIR$/../../plugins/jaxb-osgi.jar!/" />
4646
</CLASSES>
4747
<JAVADOC />
4848
<SOURCES />

moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/beanvalidation/generator/schema_with_facets.xsd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0 which is available at
@@ -14,6 +14,11 @@
1414
-->
1515

1616
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
17+
<xsd:complexType name="drivingLicense">
18+
<xsd:sequence/>
19+
<xsd:attribute name="id" type="xsd:int" use="required"/>
20+
<xsd:attribute name="validThrough" type="xsd:dateTime"/>
21+
</xsd:complexType>
1722
<xsd:complexType name="employee">
1823
<xsd:sequence>
1924
<xsd:element name="personalName" minOccurs="0">
@@ -37,13 +42,8 @@
3742
<xsd:attribute name="id" type="xsd:int"/>
3843
<xsd:attribute name="age" type="xsd:int" use="required"/>
3944
</xsd:complexType>
40-
<xsd:complexType name="drivingLicense">
41-
<xsd:sequence/>
42-
<xsd:attribute name="id" type="xsd:int" use="required"/>
43-
<xsd:attribute name="validThrough" type="xsd:dateTime"/>
44-
</xsd:complexType>
45-
<xsd:element name="employee" type="employee"/>
4645
<xsd:element name="department" type="department"/>
46+
<xsd:element name="employee" type="employee"/>
4747
<xsd:simpleType name="department">
4848
<xsd:restriction base="xsd:string">
4949
<xsd:enumeration value="RDBMS"/>

moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/beanvalidation/sgen_xjc/golden_file.xsd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0 which is available at
@@ -36,6 +36,14 @@
3636
<xsd:element name="someCollection" type="xsd:anyType" maxOccurs="unbounded"/>
3737
</xsd:sequence>
3838
</xsd:complexType>
39+
<xsd:complexType name="NumberWithHiddenValueAttribute">
40+
<xsd:simpleContent>
41+
<xsd:extension base="xsd:string">
42+
<xsd:attribute name="code" type="xsd:string" use="required"/>
43+
<xsd:attribute name="whatNumber" type="xsd:long" use="required"/>
44+
</xsd:extension>
45+
</xsd:simpleContent>
46+
</xsd:complexType>
3947
<xsd:complexType name="Numbers">
4048
<xsd:sequence>
4149
<xsd:element name="minInclusive">
@@ -77,14 +85,6 @@
7785
<xsd:element name="NumberWithHiddenValueAttribute" type="ns0:NumberWithHiddenValueAttribute"/>
7886
</xsd:sequence>
7987
</xsd:complexType>
80-
<xsd:complexType name="NumberWithHiddenValueAttribute">
81-
<xsd:simpleContent>
82-
<xsd:extension base="xsd:string">
83-
<xsd:attribute name="code" type="xsd:string" use="required"/>
84-
<xsd:attribute name="whatNumber" type="xsd:long" use="required"/>
85-
</xsd:extension>
86-
</xsd:simpleContent>
87-
</xsd:complexType>
8888
<xsd:complexType name="Strings">
8989
<xsd:sequence>
9090
<xsd:element name="regexShorthands">
Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,45 +13,20 @@
1313
1414
-->
1515

16-
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://jaxb.dev.java.net/array" xmlns:x="listOfObjectsNamespace" targetNamespace="listOfObjectsNamespace">
17-
<xsd:complexType name="multiDimensionalArrayRoot">
16+
<xsd:schema xmlns:ns0="http://jaxb.dev.java.net/array" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jaxb.dev.java.net/array">
17+
<xsd:complexType name="intArray">
1818
<xsd:sequence>
19-
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="char2dArray" type="ns0:stringArray"/>
20-
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="employee2dArray" type="x:employeeArray"/>
21-
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="innerClass2dArray" type="x:myInnerArray"/>
22-
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="int2dArray" type="ns0:intArray"/>
23-
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="int3dArray" type="ns0:intArrayArray"/>
19+
<xsd:element name="item" type="xsd:int" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
2420
</xsd:sequence>
2521
</xsd:complexType>
26-
<xsd:complexType name="myInner">
22+
<xsd:complexType name="intArrayArray">
2723
<xsd:sequence>
28-
<xsd:element minOccurs="0" name="innerName" type="xsd:string"/>
24+
<xsd:element name="item" type="ns0:intArray" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
2925
</xsd:sequence>
3026
</xsd:complexType>
31-
<xsd:complexType name="employeeArray">
27+
<xsd:complexType name="stringArray">
3228
<xsd:sequence>
33-
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="item" type="x:employee"/>
29+
<xsd:element name="item" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
3430
</xsd:sequence>
3531
</xsd:complexType>
36-
<xsd:complexType name="employee">
37-
<xsd:sequence>
38-
<xsd:element minOccurs="0" name="firstName" type="xsd:string"/>
39-
<xsd:element minOccurs="0" name="lastName" type="xsd:string"/>
40-
<xsd:element minOccurs="0" name="birthday" type="xsd:dateTime"/>
41-
<xsd:element minOccurs="0" name="responsibilities">
42-
<xsd:complexType>
43-
<xsd:sequence>
44-
<xsd:element maxOccurs="unbounded" minOccurs="0" name="responsibility" type="xsd:anyType"/>
45-
</xsd:sequence>
46-
</xsd:complexType>
47-
</xsd:element>
48-
</xsd:sequence>
49-
<xsd:attribute name="id" type="xsd:int" use="required"/>
50-
</xsd:complexType>
51-
<xsd:complexType name="myInnerArray">
52-
<xsd:sequence>
53-
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="item" type="x:myInner"/>
54-
</xsd:sequence>
55-
</xsd:complexType>
56-
<xsd:element name="employee-data" type="x:employee"/>
5732
</xsd:schema>
Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
22
<!--
33
4-
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,7 +13,45 @@
1313
1414
-->
1515

16-
<xsd:schema xmlns:ns0="urn:example" xmlns:ns1="listOfObjectsNamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:example">
17-
<xsd:import schemaLocation="schema1.xsd" namespace="listOfObjectsNamespace"/>
18-
<xsd:element name="root" type="ns1:multiDimensionalArrayRoot"/>
16+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://jaxb.dev.java.net/array" xmlns:x="listOfObjectsNamespace" targetNamespace="listOfObjectsNamespace">
17+
<xsd:complexType name="employeeArray">
18+
<xsd:sequence>
19+
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="item" type="x:employee"/>
20+
</xsd:sequence>
21+
</xsd:complexType>
22+
<xsd:complexType name="myInnerArray">
23+
<xsd:sequence>
24+
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="item" type="x:myInner"/>
25+
</xsd:sequence>
26+
</xsd:complexType>
27+
<xsd:complexType name="myInner">
28+
<xsd:sequence>
29+
<xsd:element minOccurs="0" name="innerName" type="xsd:string"/>
30+
</xsd:sequence>
31+
</xsd:complexType>
32+
<xsd:complexType name="employee">
33+
<xsd:sequence>
34+
<xsd:element minOccurs="0" name="firstName" type="xsd:string"/>
35+
<xsd:element minOccurs="0" name="lastName" type="xsd:string"/>
36+
<xsd:element minOccurs="0" name="birthday" type="xsd:dateTime"/>
37+
<xsd:element minOccurs="0" name="responsibilities">
38+
<xsd:complexType>
39+
<xsd:sequence>
40+
<xsd:element maxOccurs="unbounded" minOccurs="0" name="responsibility" type="xsd:anyType"/>
41+
</xsd:sequence>
42+
</xsd:complexType>
43+
</xsd:element>
44+
</xsd:sequence>
45+
<xsd:attribute name="id" type="xsd:int" use="required"/>
46+
</xsd:complexType>
47+
<xsd:complexType name="multiDimensionalArrayRoot">
48+
<xsd:sequence>
49+
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="char2dArray" type="ns0:stringArray"/>
50+
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="employee2dArray" type="x:employeeArray"/>
51+
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="innerClass2dArray" type="x:myInnerArray"/>
52+
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="int2dArray" type="ns0:intArray"/>
53+
<xsd:element nillable="true" maxOccurs="unbounded" minOccurs="0" name="int3dArray" type="ns0:intArrayArray"/>
54+
</xsd:sequence>
55+
</xsd:complexType>
56+
<xsd:element name="employee-data" type="x:employee"/>
1957
</xsd:schema>
Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,20 +13,7 @@
1313
1414
-->
1515

16-
<xsd:schema xmlns:ns0="http://jaxb.dev.java.net/array" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jaxb.dev.java.net/array">
17-
<xsd:complexType name="intArrayArray">
18-
<xsd:sequence>
19-
<xsd:element name="item" type="ns0:intArray" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
20-
</xsd:sequence>
21-
</xsd:complexType>
22-
<xsd:complexType name="stringArray">
23-
<xsd:sequence>
24-
<xsd:element name="item" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
25-
</xsd:sequence>
26-
</xsd:complexType>
27-
<xsd:complexType name="intArray">
28-
<xsd:sequence>
29-
<xsd:element name="item" type="xsd:int" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
30-
</xsd:sequence>
31-
</xsd:complexType>
16+
<xsd:schema xmlns:ns0="urn:example" xmlns:ns1="listOfObjectsNamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:example">
17+
<xsd:import schemaLocation="schema2.xsd" namespace="listOfObjectsNamespace"/>
18+
<xsd:element name="root" type="ns1:multiDimensionalArrayRoot"/>
3219
</xsd:schema>

moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/listofobjects/employeeCollision1.xsd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,7 +13,12 @@
1313
1414
-->
1515

16-
<xsd:schema targetNamespace="listOfObjectsNamespace" xmlns:x="listOfObjectsNamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
16+
<xsd:schema targetNamespace="examplenamespace" xmlns:x="examplenamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
17+
<xsd:complexType name="employeeArray">
18+
<xsd:sequence>
19+
<xsd:element name="item" nillable="true" type="x:employee" minOccurs="0" maxOccurs="unbounded"/>
20+
</xsd:sequence>
21+
</xsd:complexType>
1722
<xsd:complexType name="employee">
1823
<xsd:sequence>
1924
<xsd:element name="firstName" type="xsd:string" minOccurs="0"/>
@@ -29,10 +34,5 @@
2934
</xsd:sequence>
3035
<xsd:attribute name="id" type="xsd:int" use="required"/>
3136
</xsd:complexType>
32-
<xsd:complexType name="listOfEmployee">
33-
<xsd:sequence>
34-
<xsd:element name="item" nillable="true" type="x:employee" minOccurs="0" maxOccurs="unbounded"/>
35-
</xsd:sequence>
36-
</xsd:complexType>
3737
<xsd:element name="employee-data" type="x:employee"/>
3838
</xsd:schema>

moxy/eclipselink.moxy.test/resource/org/eclipse/persistence/testing/jaxb/listofobjects/employeeCollision2.xsd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,12 +13,7 @@
1313
1414
-->
1515

16-
<xsd:schema targetNamespace="examplenamespace" xmlns:x="examplenamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
17-
<xsd:complexType name="employeeArray">
18-
<xsd:sequence>
19-
<xsd:element name="item" nillable="true" type="x:employee" minOccurs="0" maxOccurs="unbounded"/>
20-
</xsd:sequence>
21-
</xsd:complexType>
16+
<xsd:schema targetNamespace="listOfObjectsNamespace" xmlns:x="listOfObjectsNamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2217
<xsd:complexType name="employee">
2318
<xsd:sequence>
2419
<xsd:element name="firstName" type="xsd:string" minOccurs="0"/>
@@ -34,5 +29,10 @@
3429
</xsd:sequence>
3530
<xsd:attribute name="id" type="xsd:int" use="required"/>
3631
</xsd:complexType>
32+
<xsd:complexType name="listOfEmployee">
33+
<xsd:sequence>
34+
<xsd:element name="item" nillable="true" type="x:employee" minOccurs="0" maxOccurs="unbounded"/>
35+
</xsd:sequence>
36+
</xsd:complexType>
3737
<xsd:element name="employee-data" type="x:employee"/>
3838
</xsd:schema>
Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
4+
Copyright (c) 2018, 2023 Oracle and/or its affiliates. All rights reserved.
55
66
This program and the accompanying materials are made available under the
77
terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,26 +13,10 @@
1313
1414
-->
1515

16-
<xsd:schema targetNamespace="listOfObjectsNamespace" xmlns:x="listOfObjectsNamespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
17-
<xsd:complexType name="employeeArray">
16+
<xsd:schema targetNamespace="http://jaxb.dev.java.net/array" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns0="http://jaxb.dev.java.net/array">
17+
<xsd:complexType name="intArray">
1818
<xsd:sequence>
19-
<xsd:element name="item" nillable="true" type="x:employee" minOccurs="0" maxOccurs="unbounded"/>
19+
<xsd:element name="item" nillable="true" type="xsd:int" minOccurs="0" maxOccurs="unbounded"/>
2020
</xsd:sequence>
2121
</xsd:complexType>
22-
<xsd:complexType name="employee">
23-
<xsd:sequence>
24-
<xsd:element name="firstName" type="xsd:string" minOccurs="0"/>
25-
<xsd:element name="lastName" type="xsd:string" minOccurs="0"/>
26-
<xsd:element name="birthday" type="xsd:dateTime" minOccurs="0"/>
27-
<xsd:element name="responsibilities" minOccurs="0">
28-
<xsd:complexType>
29-
<xsd:sequence>
30-
<xsd:element name="responsibility" type="xsd:anyType" minOccurs="0" maxOccurs="unbounded"/>
31-
</xsd:sequence>
32-
</xsd:complexType>
33-
</xsd:element>
34-
</xsd:sequence>
35-
<xsd:attribute name="id" type="xsd:int" use="required"/>
36-
</xsd:complexType>
37-
<xsd:element name="employee-data" type="x:employee"/>
3822
</xsd:schema>

0 commit comments

Comments
 (0)