Author: mukulg
Date: Wed Apr 13 11:58:16 2022
New Revision: 1899807

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

Added:
    xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_4.xsd
    xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_5.xsd
    xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_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/1743_4.xsd
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_4.xsd?rev=1899807&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_4.xsd (added)
+++ xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_4.xsd Wed Apr 
13 11:58:16 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="UnionType1">
+             <xs:enumeration value="2"/>
+             <xs:enumeration value="2021-04-09"/>
+             <xs:enumeration value="3"/>
+          </xs:restriction>
+       </xs:simpleType>
+    </xs:element>
+    
+    <xs:simpleType name="UnionType1">
+       <xs:union memberTypes="xs:integer DATE1"/>
+    </xs:simpleType>
+    
+    <xs:simpleType name="DATE1">
+       <xs:restriction base="xs:date">
+          <xs:assertion test="$value gt 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/1743_5.xsd
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_5.xsd?rev=1899807&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_5.xsd (added)
+++ xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_5.xsd Wed Apr 
13 11:58:16 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="UnionType1">
+             <xs:enumeration value="2"/>
+             <xs:enumeration value="7785-04-09"/>
+             <xs:enumeration value="3d"/>
+          </xs:restriction>
+       </xs:simpleType>
+    </xs:element>
+    
+    <xs:simpleType name="UnionType1">
+       <xs:union memberTypes="xs:integer DATE1"/>
+    </xs:simpleType>
+    
+    <xs:simpleType name="DATE1">
+       <xs:restriction base="xs:date">
+          <xs:assertion test="$value gt 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/1743_6.xsd
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_6.xsd?rev=1899807&view=auto
==============================================================================
--- xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_6.xsd (added)
+++ xerces/java/branches/xml-schema-1.1-tests/data/jira_bugs/1743_6.xsd Wed Apr 
13 11:58:16 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="UnionType1">
+             <xs:enumeration value="2"/>
+             <xs:enumeration value="7785-04-09"/>
+             <xs:enumeration value="3"/>
+          </xs:restriction>
+       </xs:simpleType>
+    </xs:element>
+    
+    <xs:simpleType name="UnionType1">
+       <xs:union memberTypes="xs:integer DATE1"/>
+    </xs:simpleType>
+    
+    <xs:simpleType name="DATE1">
+       <xs:restriction base="xs:date">
+          <xs:assertion test="$value gt 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=1899807&r1=1899806&r2=1899807&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
 Wed Apr 13 11:58:16 2022
@@ -688,5 +688,58 @@ public class JiraBugsTests extends Xerce
                        assertTrue(false);                                      
                       
                }
        }
+       
+       public void testJira_1743_4() {
+               String schemapath = fDataDir+"/jira_bugs/1743_4.xsd";   
+               try {
+                       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 '2021-04-09' is not "
+                                                + "in the value space of the 
base type, UnionType1");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+            fErrSysId.endsWith("1743_4.xsd");
+               } catch(Exception ex) {
+                       ex.printStackTrace();
+                       assertTrue(false);                                      
                       
+               }
+       }
+       
+       public void testJira_1743_5() {
+               String schemapath = fDataDir+"/jira_bugs/1743_5.xsd";   
+               try {
+                       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 '3d' is not "
+                                                + "in the value space of the 
base type, UnionType1");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+            fErrSysId.endsWith("1743_5.xsd");
+               } catch(Exception ex) {
+                       ex.printStackTrace();
+                       assertTrue(false);                                      
                       
+               }
+       }
+       
+       public void testJira_1743_6() {
+               String schemapath = fDataDir+"/jira_bugs/1743_6.xsd";   
+               try {
+                       fSchemaFactory.setErrorHandler(this);
+                   Schema s = fSchemaFactory.newSchema(new 
StreamSource(schemapath));              
+                   assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+               } catch(Exception ex) {
+                       ex.printStackTrace();
+                       assertTrue(false);                                      
                       
+               }
+       }
                
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to