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 2022/04/18 14:59:34 UTC

svn commit: r1899983 - in /xerces/java/branches/xml-schema-1.1-tests: data/jira_bugs/1744_5.xml data/jira_bugs/1744_5.xsd data/jira_bugs/1744_6.xml data/jira_bugs/1744_6.xsd src/org/apache/xerces/tests/JiraBugsTests.java

Author: mukulg
Date: Mon Apr 18 14:59:34 2022
New Revision: 1899983

URL: http://svn.apache.org/viewvc?rev=1899983&view=rev
Log:
adding few test cases, for jira issue XERCESJ-1744

Added:
    xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_5.xml
    xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_5.xsd
    xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_6.xml
    xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_6.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/1744_5.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_5.xml?rev=1899983&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_5.xml (added)
+++ xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_5.xml Mon Apr 18 14:59:34 2022
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<temp>
+  <X>2012-10-08 7776-10-05</X>
+  <X>8876-10-08 2013-10-05</X>
+  <X>2017-10-08 8786-10-05</X>
+</temp>
\ No newline at end of file

Added: xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_5.xsd
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_5.xsd?rev=1899983&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_5.xsd (added)
+++ xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_5.xsd Mon Apr 18 14:59:34 2022
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+    
+    <xs:element name="temp">
+       <xs:complexType>
+          <xs:sequence>
+             <xs:element name="X" maxOccurs="unbounded">
+                <xs:simpleType>
+		           <xs:list itemType="DATE_TYPE"/>
+	            </xs:simpleType>	  
+             </xs:element>
+          </xs:sequence>
+       </xs:complexType>
+    </xs:element>
+    
+    <xs:simpleType name="DATE_TYPE">
+       <xs:union memberTypes="DATE_TYPE1 DATE_TYPE2"/>
+    </xs:simpleType>
+    
+    <xs:simpleType name="DATE_TYPE1">
+       <xs:restriction base="xs:date">
+         <xs:assertion test="$value lt current-date()"/>
+       </xs:restriction>
+    </xs:simpleType>
+    
+    <xs:simpleType name="DATE_TYPE2">
+      <xs:restriction base="xs:date">
+         <xs:assertion test="$value lt current-date()"/>
+      </xs:restriction>
+    </xs:simpleType>
+
+</xs:schema>
\ No newline at end of file

Added: xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_6.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_6.xml?rev=1899983&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_6.xml (added)
+++ xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_6.xml Mon Apr 18 14:59:34 2022
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<temp>
+  <X attr1="2012-10-08 7776-10-05"/>
+  <X attr1="8876-10-08 2013-10-05"/>
+  <X attr1="2017-10-08 8786-10-05"/>
+</temp>
\ No newline at end of file

Added: xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_6.xsd
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_6.xsd?rev=1899983&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_6.xsd (added)
+++ xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1744_6.xsd Mon Apr 18 14:59:34 2022
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+    
+    <xs:element name="temp">
+       <xs:complexType>
+          <xs:sequence>
+             <xs:element name="X" maxOccurs="unbounded">
+                <xs:complexType>
+                   <xs:simpleContent>
+                      <xs:extension base="xs:string">
+                         <xs:attribute name="attr1">
+                            <xs:simpleType>
+		                       <xs:list itemType="DATE_TYPE"/>
+	                        </xs:simpleType>
+	                     </xs:attribute>
+	                  </xs:extension>
+	               </xs:simpleContent>
+	            </xs:complexType>	  
+             </xs:element>
+          </xs:sequence>
+       </xs:complexType>
+    </xs:element>
+    
+    <xs:simpleType name="DATE_TYPE">
+       <xs:union memberTypes="DATE_TYPE1 DATE_TYPE2"/>
+    </xs:simpleType>
+    
+    <xs:simpleType name="DATE_TYPE1">
+       <xs:restriction base="xs:date">
+         <xs:assertion test="$value lt current-date()"/>
+       </xs:restriction>
+    </xs:simpleType>
+    
+    <xs:simpleType name="DATE_TYPE2">
+      <xs:restriction base="xs:date">
+         <xs:assertion test="$value lt current-date()"/>
+      </xs:restriction>
+    </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=1899983&r1=1899982&r2=1899983&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 Mon Apr 18 14:59:34 2022
@@ -836,5 +836,37 @@ public class JiraBugsTests extends Xerce
 			assertTrue(false);
 		}
 	}
+	
+	public void testJira_1744_6() {
+		String xmlfile = fDataDir+"/jira_bugs/1744_5.xml";
+		String schemapath = fDataDir+"/jira_bugs/1744_5.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() == 3);
+		} catch(Exception ex) {
+			ex.printStackTrace();
+			assertTrue(false);
+		}
+	}
+	
+	public void testJira_1744_7() {
+		String xmlfile = fDataDir+"/jira_bugs/1744_6.xml";
+		String schemapath = fDataDir+"/jira_bugs/1744_6.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() == 3);
+		} catch(Exception ex) {
+			ex.printStackTrace();
+			assertTrue(false);
+		}
+	}
 		
-}
+}
\ No newline at end of file



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