Author: mukulg
Date: Tue Apr 12 09:08:03 2022
New Revision: 1899771
URL: http://svn.apache.org/viewvc?rev=1899771&view=rev
Log:
xercesj commit: fixes to xsd 1.1 test cases
Added:
xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_2.xml
xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_2.xsd
Modified:
xerces/java/branches/xml-schema-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
Added: xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_2.xml
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_2.xml?rev=1899771&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_2.xml (added)
+++ xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_2.xml Tue Apr
12 09:08:03 2022
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<X>1 2 3</X>
\ No newline at end of file
Added: xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_2.xsd
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_2.xsd?rev=1899771&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_2.xsd (added)
+++ xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_2.xsd Tue Apr
12 09:08:03 2022
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+ <xs:element name="X">
+ <xs:simpleType>
+ <xs:restriction base="ST1">
+ <xs:enumeration value="1 2 3"/>
+ <xs:enumeration value="2 3"/>
+ <xs:enumeration value="5 6 7"/>
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:element>
+
+ <xs:simpleType name="ST1">
+ <xs:restriction base="ListType1">
+ <xs:assertion test="count($value) = 3"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="ListType1">
+ <xs:list itemType="xs:integer"/>
+ </xs:simpleType>
+
+</xs:schema>
\ No newline at end of file
Modified:
xerces/java/branches/xml-schema-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java?rev=1899771&r1=1899770&r2=1899771&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
(original)
+++
xerces/java/branches/xml-schema-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
Tue Apr 12 09:08:03 2022
@@ -628,11 +628,44 @@ public class JiraBugsTests extends Xerce
public void testJira_1743_1() {
String schemapath = fDataDir+"/jira_bugs/1743_1.xsd";
try {
- Schema s = fSchemaFactory.newSchema(new
StreamSource(schemapath));
+ fSchemaFactory.setErrorHandler(this);
+ Schema s = fSchemaFactory.newSchema(new
StreamSource(schemapath));
assertTrue(failureList.size() == 1);
+ // test expected error messages
+ List expectedMsgList = new ArrayList();
+ FailureMesgFragments mesgFragments = new FailureMesgFragments();
+ mesgFragments.setMessageFragment("enumeration-valid-restriction:
Enumeration value 'a' is not in "
+ + "the value space of the
base type, Color");
+ expectedMsgList.add(mesgFragments);
+ assertTrue(areErrorMessagesConsistent(expectedMsgList));
+ fErrSysId.endsWith("1743_1.xsd");
} catch(Exception ex) {
- assertEquals(ex.getMessage(),
"enumeration-valid-restriction: Enumeration value"
- + " 'a' is not in the
value space of the base type, Color.");
+ ex.printStackTrace();
+ assertTrue(false);
+ }
+ }
+
+ public void testJira_1743_2() {
+ String xmlfile = fDataDir+"/jira_bugs/1743_2.xml";
+ String schemapath = fDataDir+"/jira_bugs/1743_2.xsd";
+ try {
+ fSchemaFactory.setErrorHandler(this);
+ Schema s = fSchemaFactory.newSchema(new File(schemapath));
+ Validator v = s.newValidator();
+ v.setErrorHandler(this);
+ v.validate(new DOMSource(getDomDocument(xmlfile)));
+ assertTrue(failureList.size() == 1);
+ // test expected error messages
+ List expectedMsgList = new ArrayList();
+ FailureMesgFragments mesgFragments = new FailureMesgFragments();
+ mesgFragments.setMessageFragment("enumeration-valid-restriction:
Enumeration value '2 3' is not "
+ + "in the value space of the
base type, ST1");
+ expectedMsgList.add(mesgFragments);
+ assertTrue(areErrorMessagesConsistent(expectedMsgList));
+ fErrSysId.endsWith("1743_2.xsd");
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ assertTrue(false);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]