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/20 10:51:38 UTC

svn commit: r1871851 - in /xerces/java/branches/xs-1.1-tests: data/idconstraints/ data/jira_bugs/ src/org/apache/xerces/tests/

Author: mukulg
Date: Fri Dec 20 10:51:37 2019
New Revision: 1871851

URL: http://svn.apache.org/viewvc?rev=1871851&view=rev
Log:
adding & modifying few details about test cases, on xerces-j xsd 1.1 svn test branch (xs-1.1-tests). this commit also removes one duplicate test case in this test branch.

Added:
    xerces/java/branches/xs-1.1-tests/data/idconstraints/invalid_1_1515.xml
    xerces/java/branches/xs-1.1-tests/data/idconstraints/sch_1515.xsd
    xerces/java/branches/xs-1.1-tests/data/idconstraints/valid_1_1515.xml
    xerces/java/branches/xs-1.1-tests/data/idconstraints/valid_2_1515.xml
Removed:
    xerces/java/branches/xs-1.1-tests/data/jira_bugs/1585_1.xml
    xerces/java/branches/xs-1.1-tests/data/jira_bugs/1585_1.xsd
Modified:
    xerces/java/branches/xs-1.1-tests/data/idconstraints/jira_1585.xml
    xerces/java/branches/xs-1.1-tests/data/idconstraints/jira_1585.xsd
    xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java
    xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java

Added: xerces/java/branches/xs-1.1-tests/data/idconstraints/invalid_1_1515.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/idconstraints/invalid_1_1515.xml?rev=1871851&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/idconstraints/invalid_1_1515.xml (added)
+++ xerces/java/branches/xs-1.1-tests/data/idconstraints/invalid_1_1515.xml Fri Dec 20 10:51:37 2019
@@ -0,0 +1,3 @@
+<root>
+   <keyref att="xyz"/>
+</root>
\ No newline at end of file

Modified: xerces/java/branches/xs-1.1-tests/data/idconstraints/jira_1585.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/idconstraints/jira_1585.xml?rev=1871851&r1=1871850&r2=1871851&view=diff
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/idconstraints/jira_1585.xml (original)
+++ xerces/java/branches/xs-1.1-tests/data/idconstraints/jira_1585.xml Fri Dec 20 10:51:37 2019
@@ -1,7 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Top xmlns="www.bla.com"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="www.bla.com test.xsd">
+<Top xmlns="www.bla.com">
     <Sub_1>
         <Sub_2/>
         <Sub_2/>

Modified: xerces/java/branches/xs-1.1-tests/data/idconstraints/jira_1585.xsd
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/idconstraints/jira_1585.xsd?rev=1871851&r1=1871850&r2=1871851&view=diff
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/idconstraints/jira_1585.xsd (original)
+++ xerces/java/branches/xs-1.1-tests/data/idconstraints/jira_1585.xsd Fri Dec 20 10:51:37 2019
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
-    targetNamespace="www.bla.com" xmlns:ns="www.bla.com">
+           targetNamespace="www.bla.com" xmlns:ns="www.bla.com">
     
     <xs:element name="Top">
         <xs:complexType>

Added: xerces/java/branches/xs-1.1-tests/data/idconstraints/sch_1515.xsd
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/idconstraints/sch_1515.xsd?rev=1871851&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/idconstraints/sch_1515.xsd (added)
+++ xerces/java/branches/xs-1.1-tests/data/idconstraints/sch_1515.xsd Fri Dec 20 10:51:37 2019
@@ -0,0 +1,25 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+   <xs:element name="root">
+      <xs:complexType>
+         <xs:sequence>
+           <xs:element name="key" type="xs:string" minOccurs="0">
+              <xs:key name="key">
+                <xs:selector xpath="."/>
+                <xs:field xpath="."/>
+              </xs:key>
+           </xs:element>
+           <xs:element name="keyref">
+              <xs:complexType>
+                 <xs:attribute name="att" type="xs:string"/>
+              </xs:complexType>
+           </xs:element>
+         </xs:sequence>
+      </xs:complexType>
+      <xs:keyref name="keyref" refer="key">
+         <xs:selector xpath="keyref"/>
+         <xs:field xpath="@att"/>
+      </xs:keyref>
+   </xs:element>
+
+</xs:schema>
\ No newline at end of file

Added: xerces/java/branches/xs-1.1-tests/data/idconstraints/valid_1_1515.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/idconstraints/valid_1_1515.xml?rev=1871851&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/idconstraints/valid_1_1515.xml (added)
+++ xerces/java/branches/xs-1.1-tests/data/idconstraints/valid_1_1515.xml Fri Dec 20 10:51:37 2019
@@ -0,0 +1,4 @@
+<root>
+   <key>xyz</key>
+   <keyref att="xyz"/>
+</root>
\ No newline at end of file

Added: xerces/java/branches/xs-1.1-tests/data/idconstraints/valid_2_1515.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/idconstraints/valid_2_1515.xml?rev=1871851&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/idconstraints/valid_2_1515.xml (added)
+++ xerces/java/branches/xs-1.1-tests/data/idconstraints/valid_2_1515.xml Fri Dec 20 10:51:37 2019
@@ -0,0 +1,3 @@
+<root>
+  <keyref/>
+</root>
\ No newline at end of file

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=1871851&r1=1871850&r2=1871851&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 Fri Dec 20 10:51:37 2019
@@ -299,27 +299,35 @@ public class IDConstraintTests extends X
 	}
 	
 	public void testIDConstraint15() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
 		String xmlfile = fDataDir+"/idconstraints/jira_1585.xml";
-		String schemapath = fDataDir+"/idconstraints/jira_1585.xsd";			
+		String schemapath = fDataDir+"/idconstraints/jira_1585.xsd";	
 		try {
+			fSchemaFactory.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true);
 		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
             Validator v = s.newValidator();
 		    v.setErrorHandler(this);
             v.validate(new StreamSource(xmlfile));
-            assertTrue(failureList.size() == 1);
-            // test expected error messages
-            List expectedMsgList = new ArrayList();
-            FailureMesgFragments mesgFragments = new FailureMesgFragments();
-            mesgFragments.setMessageFragment("the keyref identity constraint \"newKeyref\" refers to a key or unique that is out of scope");
-            expectedMsgList.add(mesgFragments);
-            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);            
+            
+            // 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));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
 		} catch(Exception ex) {
 		   ex.printStackTrace();
 		   assertTrue(false);
 		}
 	}
 	
-	public void testIDConstraint16() {
+	/*public void testIDConstraint16() {
 		String xmlfile = fDataDir+"/idconstraints/jira_1594.xml";
 		String schemapath = fDataDir+"/idconstraints/jira_1594.xsd";			
 		try {
@@ -338,7 +346,7 @@ public class IDConstraintTests extends X
 		   ex.printStackTrace();
 		   assertTrue(false);
 		}
-	}
+	}*/
 	
 	public void testIDConstraint17() {
 		// run validation in XSD 1.0 mode
@@ -1133,6 +1141,103 @@ public class IDConstraintTests extends X
             expectedMsgList.add(mesgFragments);
             assertTrue(areErrorMessagesConsistent(expectedMsgList));
 		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint40() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
+		String xmlfile = fDataDir+"/idconstraints/valid_1_1515.xml";
+		String schemapath = fDataDir+"/idconstraints/sch_1515.xsd";	
+		try {
+			fSchemaFactory.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true);
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);            
+            
+            // 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));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint41() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
+		String xmlfile = fDataDir+"/idconstraints/valid_2_1515.xml";
+		String schemapath = fDataDir+"/idconstraints/sch_1515.xsd";	
+		try {
+			fSchemaFactory.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true);
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);            
+            
+            // 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));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint42() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
+		String xmlfile = fDataDir+"/idconstraints/invalid_1_1515.xml";
+		String schemapath = fDataDir+"/idconstraints/sch_1515.xsd";	
+		try {
+			fSchemaFactory.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, true);
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertTrue(failureList.size() == 1);
+            // test expected error messages
+            List expectedMsgList = new ArrayList();
+            FailureMesgFragments mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("Identity Constraint error: the keyref identity constraint \"keyref\" refers to a key or unique that is out of scope");
+            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("Identity Constraint error: the keyref identity constraint \"keyref\" refers to a key or unique that is out of scope");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
 		   ex.printStackTrace();
 		   assertTrue(false);
 		}

Modified: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java?rev=1871851&r1=1871850&r2=1871851&view=diff
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java (original)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java Fri Dec 20 10:51:37 2019
@@ -111,28 +111,6 @@ public class JiraBugsTests extends Xerce
 		}
 	}
 	
-	public void testJira_1585_1() {
-		String xmlfile = fDataDir+"/jira_bugs/1585_1.xml";	
-		String schemapath = fDataDir+"/jira_bugs/1585_1.xsd";	
-		try {
-		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
-            Validator v = s.newValidator();
-		    v.setErrorHandler(this);
-            v.validate(new StreamSource(xmlfile));
-            assertTrue(failureList.size() == 1);
-            // test expected error messages
-            List expectedMsgList = new ArrayList();
-            FailureMesgFragments mesgFragments = new FailureMesgFragments();
-            mesgFragments.setMessageFragment("Identity Constraint error:");
-            mesgFragments.setMessageFragment("the keyref identity constraint \"newKeyref\" refers to a key or unique that is out of scope");
-            expectedMsgList.add(mesgFragments);
-            assertTrue(areErrorMessagesConsistent(expectedMsgList));
-		} catch(Exception ex) {
-		   ex.printStackTrace();
-		   assertTrue(false);
-		}
-	}
-	
 	public void testJira_1584_1() {
 		String xmlfile = fDataDir+"/jira_bugs/3.xml";	
 		String schemapath = fDataDir+"/jira_bugs/3.xsd";	



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org