-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[master] OXM Tests move from MOXy to Core module (#1341)
Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
- Loading branch information
Showing
2,218 changed files
with
799 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
foundation/org.eclipse.persistence.core/src/test/java/module-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
|
||
open module org.eclipse.persistence.core.test { | ||
|
||
requires java.compiler; | ||
requires java.logging; | ||
requires java.sql; | ||
|
||
requires jakarta.mail; | ||
requires jakarta.json; | ||
requires jakarta.xml.bind; | ||
requires org.eclipse.persistence.asm; | ||
requires org.eclipse.persistence.core; | ||
requires junit; | ||
|
||
exports org.eclipse.persistence.testing.oxm; | ||
exports org.eclipse.persistence.testing.oxm.classloader; | ||
exports org.eclipse.persistence.testing.oxm.mappings; | ||
exports org.eclipse.persistence.testing.oxm.mappings.choice; | ||
exports org.eclipse.persistence.testing.oxm.xmlconversionmanager; | ||
exports org.eclipse.persistence.testing.oxm.xmlmarshaller; | ||
exports org.eclipse.persistence.testing.oxm.xmlroot; | ||
} |
File renamed without changes.
File renamed without changes.
105 changes: 105 additions & 0 deletions
105
...se.persistence.core/src/test/java/org/eclipse/persistence/testing/oxm/OXMXMLComparer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
package org.eclipse.persistence.testing.oxm; | ||
|
||
import org.eclipse.persistence.platform.xml.XMLComparer; | ||
import org.w3c.dom.*; | ||
|
||
public class OXMXMLComparer extends XMLComparer{ | ||
|
||
public OXMXMLComparer() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Compares two XML documents which represent XML Schemas. Order of declarations should | ||
* be ignored. | ||
*/ | ||
public boolean isSchemaEqual(Document control, Document test) { | ||
Element controlRoot = control.getDocumentElement(); | ||
Element testRoot = test.getDocumentElement(); | ||
|
||
if(!(controlRoot.getChildNodes().getLength() == testRoot.getChildNodes().getLength())) { | ||
return false; | ||
} | ||
|
||
//compare attributes: | ||
NamedNodeMap controlAttributes = controlRoot.getAttributes(); | ||
NamedNodeMap testAttributes = testRoot.getAttributes(); | ||
int numberOfControlAttributes = controlAttributes.getLength(); | ||
int numberOfTestAttributes = testAttributes.getLength(); | ||
if (numberOfControlAttributes != numberOfTestAttributes) { | ||
return false; | ||
} | ||
Attr controlAttribute; | ||
Attr testAttribute; | ||
for (int x = 0; x < numberOfControlAttributes; x++) { | ||
controlAttribute = (Attr)controlAttributes.item(x); | ||
if (null == controlAttribute.getNamespaceURI()) { | ||
testAttribute = (Attr)testAttributes.getNamedItem(controlAttribute.getNodeName()); | ||
} else { | ||
testAttribute = (Attr)testAttributes.getNamedItemNS(controlAttribute.getNamespaceURI(), controlAttribute.getLocalName()); | ||
} | ||
if (null == testAttribute) { | ||
return false; | ||
} else if (!isAttributeEqual(controlAttribute, testAttribute)) { | ||
return false; | ||
} | ||
} | ||
|
||
//compare definitions ignoring order and text | ||
NodeList controlChildren = controlRoot.getChildNodes(); | ||
for(int i = 0; i < controlChildren.getLength(); i++) { | ||
Node controlChild = controlChildren.item(i); | ||
if(controlChild.getNodeType() == Node.TEXT_NODE) { | ||
continue; | ||
} | ||
NamedNodeMap controlChildAttributes = controlChild.getAttributes(); | ||
Node testChild = null; | ||
//Find the equivalent node in the test children. | ||
NodeList testChildren = testRoot.getElementsByTagNameNS(controlChild.getNamespaceURI(), controlChild.getLocalName()); | ||
for(int j = 0; j < testChildren.getLength(); j++) { | ||
Node next = testChildren.item(j); | ||
NamedNodeMap testChildAttributes = next.getAttributes(); | ||
numberOfControlAttributes = controlChildAttributes.getLength(); | ||
numberOfTestAttributes = testChildAttributes.getLength(); | ||
boolean equalAttributes = true; | ||
if(numberOfControlAttributes != numberOfTestAttributes) { | ||
equalAttributes = false; | ||
} | ||
for (int x = 0; x < numberOfControlAttributes; x++) { | ||
controlAttribute = (Attr)controlChildAttributes.item(x); | ||
if (null == controlAttribute.getNamespaceURI()) { | ||
testAttribute = (Attr)testChildAttributes.getNamedItem(controlAttribute.getNodeName()); | ||
} else { | ||
testAttribute = (Attr)testChildAttributes.getNamedItemNS(controlAttribute.getNamespaceURI(), controlAttribute.getLocalName()); | ||
} | ||
if (testAttribute == null) { | ||
equalAttributes = false; | ||
} else if (!isAttributeEqual(controlAttribute, testAttribute)) { | ||
equalAttributes = false; | ||
} | ||
} | ||
if(equalAttributes) { | ||
//if the attributes are all equal, then these are the same definition | ||
testChild = next; | ||
break; | ||
} | ||
} | ||
if(testChild == null || !isNodeEqual(controlChild, testChild)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.