Author: mukulg
Date: Mon Dec 31 16:44:46 2012
New Revision: 1427173

URL: http://svn.apache.org/viewvc?rev=1427173&view=rev
Log:
schema 1.1 commit: committing few new test cases for the implementation 
improvement done in a commit few minutes ago.

Added:
    
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_1.xml
    
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_1.xsd
    
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_2.xml
    
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_2.xsd
    
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_3.xsd
    
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_4.xsd
    
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_1.xml
    
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_1.xsd
    
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_2.xml
Modified:
    
xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AssertionTests.java

Added: 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_1.xml
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_1.xml?rev=1427173&view=auto
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_1.xml 
(added)
+++ 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_1.xml 
Mon Dec 31 16:44:46 2012
@@ -0,0 +1 @@
+<X>2005-10-09 2007-05-07 2007-05-03</X>
\ No newline at end of file

Added: 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_1.xsd
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_1.xsd?rev=1427173&view=auto
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_1.xsd 
(added)
+++ 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_1.xsd 
Mon Dec 31 16:44:46 2012
@@ -0,0 +1,20 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
+
+    <xs:element name="X">
+          <xs:simpleType>
+             <xs:restriction base="union_of_DtList_and_integer">
+                        <xs:assertion test="$value instance of xs:date+"/>
+                        <xs:assertion test="count($value) eq 3"/>
+                 </xs:restriction>
+          </xs:simpleType>
+       </xs:element>
+       
+       <xs:simpleType name="union_of_DtList_and_integer">
+          <xs:union memberTypes="xs:integer">
+             <xs:simpleType>
+                    <xs:list itemType="xs:date"/>
+                 </xs:simpleType>
+          </xs:union>
+       </xs:simpleType>
+       
+</xs:schema>
\ No newline at end of file

Added: 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_2.xml
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_2.xml?rev=1427173&view=auto
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_2.xml 
(added)
+++ 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_2.xml 
Mon Dec 31 16:44:46 2012
@@ -0,0 +1 @@
+<X>100</X>
\ No newline at end of file

Added: 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_2.xsd
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_2.xsd?rev=1427173&view=auto
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_2.xsd 
(added)
+++ 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_2.xsd 
Mon Dec 31 16:44:46 2012
@@ -0,0 +1,19 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
+
+    <xs:element name="X">
+          <xs:simpleType>
+             <xs:restriction base="union_of_DtList_and_integer">
+                    <xs:assertion test="$value instance of xs:integer"/>
+                 </xs:restriction>
+          </xs:simpleType>
+       </xs:element>
+       
+       <xs:simpleType name="union_of_DtList_and_integer">
+          <xs:union memberTypes="xs:integer">
+             <xs:simpleType>
+                    <xs:list itemType="xs:date"/>
+                 </xs:simpleType>
+          </xs:union>
+       </xs:simpleType>
+       
+</xs:schema>
\ No newline at end of file

Added: 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_3.xsd
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_3.xsd?rev=1427173&view=auto
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_3.xsd 
(added)
+++ 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_3.xsd 
Mon Dec 31 16:44:46 2012
@@ -0,0 +1,22 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
+       
+       <xs:element name="X">
+          <xs:complexType>
+             <xs:simpleContent>
+                    <xs:extension base="union_of_DtList_and_integer">
+                           <xs:assert test="$value instance of xs:date+"/>
+                           <xs:assert test="count($value) = 3"/>
+                        </xs:extension>
+                 </xs:simpleContent>
+          </xs:complexType>
+       </xs:element>
+       
+       <xs:simpleType name="union_of_DtList_and_integer">
+          <xs:union memberTypes="xs:integer">
+             <xs:simpleType>
+                    <xs:list itemType="xs:date"/>
+                 </xs:simpleType>
+          </xs:union>
+       </xs:simpleType>
+       
+</xs:schema>
\ No newline at end of file

Added: 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_4.xsd
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_4.xsd?rev=1427173&view=auto
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_4.xsd 
(added)
+++ 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion14_4.xsd 
Mon Dec 31 16:44:46 2012
@@ -0,0 +1,21 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
+       
+       <xs:element name="X">
+          <xs:complexType>
+             <xs:simpleContent>
+                    <xs:extension base="union_of_DtList_and_integer">
+                           <xs:assert test="$value instance of xs:integer"/>
+                        </xs:extension>
+                 </xs:simpleContent>
+          </xs:complexType>
+       </xs:element>
+       
+       <xs:simpleType name="union_of_DtList_and_integer">
+          <xs:union memberTypes="xs:integer">
+             <xs:simpleType>
+                    <xs:list itemType="xs:date"/>
+                 </xs:simpleType>
+          </xs:union>
+       </xs:simpleType>
+       
+</xs:schema>
\ No newline at end of file

Added: 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_1.xml
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_1.xml?rev=1427173&view=auto
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_1.xml 
(added)
+++ 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_1.xml 
Mon Dec 31 16:44:46 2012
@@ -0,0 +1,4 @@
+<Z>
+  <X val="2005-10-09 2007-05-07 2007-05-03"/>
+  <X val="100"/>
+</Z>
\ No newline at end of file

Added: 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_1.xsd
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_1.xsd?rev=1427173&view=auto
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_1.xsd 
(added)
+++ 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_1.xsd 
Mon Dec 31 16:44:46 2012
@@ -0,0 +1,26 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
+
+    <xs:element name="Z">
+          <xs:complexType>
+             <xs:sequence>
+                    <xs:element name="X" maxOccurs="unbounded">
+                           <xs:complexType>
+                                  <xs:attribute name="val" 
type="union_of_DtList_and_integer"/>                                   
+                               </xs:complexType>
+                        </xs:element>
+                 </xs:sequence>
+                 <xs:assert test="data(X[1]/@val) instance of xs:date+"/>
+                 <xs:assert test="count(data(X[1]/@val)) eq 3"/>
+                 <xs:assert test="data(X[2]/@val) instance of xs:integer"/>
+          </xs:complexType>
+       </xs:element>
+       
+       <xs:simpleType name="union_of_DtList_and_integer">
+          <xs:union memberTypes="xs:integer">
+             <xs:simpleType>
+                    <xs:list itemType="xs:date"/>
+                 </xs:simpleType>
+          </xs:union>
+       </xs:simpleType>
+       
+</xs:schema>
\ No newline at end of file

Added: 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_2.xml
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_2.xml?rev=1427173&view=auto
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_2.xml 
(added)
+++ 
xerces/java/branches/xs-1.1-tests/data/assertions/list_union/listunion15_2.xml 
Mon Dec 31 16:44:46 2012
@@ -0,0 +1,4 @@
+<Z>
+  <X val="105"/>
+  <X val="100"/>
+</Z>
\ No newline at end of file

Modified: 
xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AssertionTests.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AssertionTests.java?rev=1427173&r1=1427172&r2=1427173&view=diff
==============================================================================
--- 
xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AssertionTests.java
 (original)
+++ 
xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AssertionTests.java
 Mon Dec 31 16:44:46 2012
@@ -2627,5 +2627,109 @@ public class AssertionTests extends Xerc
                   assertTrue(false);
                }
        }
+       
+       public void testAssert147() {
+               String xmlfile = 
fDataDir+"/assertions/list_union/listunion14_1.xml";
+               String schemapath = 
fDataDir+"/assertions/list_union/listunion14_1.xsd";                
+               try {
+                   Schema s = fSchemaFactory.newSchema(new 
StreamSource(schemapath));
+            Validator v = s.newValidator();
+                   v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+               } catch(Exception ex) {
+                  ex.printStackTrace();
+                  assertTrue(false);
+               }
+       }
+       
+       public void testAssert148() {
+               String xmlfile = 
fDataDir+"/assertions/list_union/listunion14_1.xml";
+               String schemapath = 
fDataDir+"/assertions/list_union/listunion14_3.xsd";                
+               try {
+                   Schema s = fSchemaFactory.newSchema(new 
StreamSource(schemapath));
+            Validator v = s.newValidator();
+                   v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+               } catch(Exception ex) {
+                  ex.printStackTrace();
+                  assertTrue(false);
+               }
+       }
+       
+       public void testAssert149() {
+               String xmlfile = 
fDataDir+"/assertions/list_union/listunion14_2.xml";
+               String schemapath = 
fDataDir+"/assertions/list_union/listunion14_2.xsd";                
+               try {
+                   Schema s = fSchemaFactory.newSchema(new 
StreamSource(schemapath));
+            Validator v = s.newValidator();
+                   v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+               } catch(Exception ex) {
+                  ex.printStackTrace();
+                  assertTrue(false);
+               }
+       }
+       
+       public void testAssert150() {
+               String xmlfile = 
fDataDir+"/assertions/list_union/listunion14_2.xml";
+               String schemapath = 
fDataDir+"/assertions/list_union/listunion14_4.xsd";                
+               try {
+                   Schema s = fSchemaFactory.newSchema(new 
StreamSource(schemapath));
+            Validator v = s.newValidator();
+                   v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+               } catch(Exception ex) {
+                  ex.printStackTrace();
+                  assertTrue(false);
+               }
+       }
+       
+       public void testAssert151() {
+               String xmlfile = 
fDataDir+"/assertions/list_union/listunion15_1.xml";
+               String schemapath = 
fDataDir+"/assertions/list_union/listunion15_1.xsd";                
+               try {
+                   Schema s = fSchemaFactory.newSchema(new 
StreamSource(schemapath));
+            Validator v = s.newValidator();
+                   v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+               } catch(Exception ex) {
+                  ex.printStackTrace();
+                  assertTrue(false);
+               }
+       }
 
+       public void testAssert152() {
+               String xmlfile = 
fDataDir+"/assertions/list_union/listunion15_2.xml";
+               String schemapath = 
fDataDir+"/assertions/list_union/listunion15_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() == 2);
+            // test expected error messages
+            List expectedMsgList = new ArrayList();
+            FailureMesgFragments mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("Assertion evaluation 
('data(X[1]/@val) instance of xs:date+') for element 'Z' on schema type 
'#AnonType_Z' did not succeed");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("Assertion evaluation 
('count(data(X[1]/@val)) eq 3') for element 'Z' on schema type '#AnonType_Z' 
did not succeed");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+               } catch(Exception ex) {
+                  ex.printStackTrace();
+                  assertTrue(false);
+               }
+       }
+       
 }



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

Reply via email to