You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2019/12/23 05:40:51 UTC
svn commit: r1871915 -
/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java
Author: mukulg
Date: Mon Dec 23 05:40:51 2019
New Revision: 1871915
URL: http://svn.apache.org/viewvc?rev=1871915&view=rev
Log:
modifying xerces xsd 1.1 test case for jira issue, XERCESJ-1594. now handling both xsd 1.0 and 1.1 modes with this test case.
Modified:
xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java
Modified: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java?rev=1871915&r1=1871914&r2=1871915&view=diff
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java (original)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java Mon Dec 23 05:40:51 2019
@@ -328,9 +328,12 @@ public class IDConstraintTests extends X
}
public void testIDConstraint16() {
+ // run validation in XSD 1.0 mode
+ fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
String xmlfile = fDataDir+"/idconstraints/jira_1594.xml";
- String schemapath = fDataDir+"/idconstraints/jira_1594.xsd";
+ String schemapath = fDataDir+"/idconstraints/jira_1594.xsd";
try {
+ fSchemaFactory.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true);
Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
Validator v = s.newValidator();
v.setErrorHandler(this);
@@ -342,6 +345,21 @@ public class IDConstraintTests extends X
mesgFragments.setMessageFragment("cvc-identity-constraint.4.3: Key 'keyref' with value '1' not found for identity constraint of element 'personnel'");
expectedMsgList.add(mesgFragments);
assertTrue(areErrorMessagesConsistent(expectedMsgList));
+
+ // run validation again with same input files, now in XSD 1.1 mode
+ tearDown();
+ setUp();
+ s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+ v = s.newValidator();
+ v.setErrorHandler(this);
+ v.validate(new StreamSource(xmlfile));
+ assertTrue(failureList.size() == 1);
+ // test expected error messages
+ expectedMsgList = new ArrayList();
+ mesgFragments = new FailureMesgFragments();
+ mesgFragments.setMessageFragment("cvc-identity-constraint.4.3: Key 'keyref' with value '1' not found for identity constraint of element 'personnel'");
+ expectedMsgList.add(mesgFragments);
+ assertTrue(areErrorMessagesConsistent(expectedMsgList));
} catch(Exception ex) {
ex.printStackTrace();
assertTrue(false);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org