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 2012/12/16 10:13:39 UTC

svn commit: r1422490 [12/13] - in /xerces/java/branches/xs-1.1-tests: ./ data/ data/assertions/ data/assertions/ST/ data/assertions/ST/list/ data/assertions/attributes/ data/assertions/defaultValues/ data/assertions/errors/ data/assertions/list_union/ ...

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AssertionTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AssertionTests.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AttributeTests.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AttributeTests.java?rev=1422490&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AttributeTests.java (added)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AttributeTests.java Sun Dec 16 09:12:49 2012
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.Validator;
+
+public class AttributeTests extends XercesAbstractTestCase {
+
+	public AttributeTests(String name) {
+		super(name);
+	}
+	
+	public void testDefaultAttributes1() {
+		String xmlfile = fDataDir+"/roger/defaultAttributes/bookStore/BookStore.xml";
+		String schemapath = fDataDir+"/roger/defaultAttributes/bookStore/BookStore.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 testDefaultAttributes2() {
+		String xmlfile = fDataDir+"/roger/defaultAttributes/bookStore/BookStore_v2.xml";
+		String schemapath = fDataDir+"/roger/defaultAttributes/bookStore/BookStore_v2.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 testDefaultAttributes3() {
+		String xmlfile = fDataDir+"/roger/defaultAttributes/bookStore/BookStore_v3.xml";
+		String schemapath = fDataDir+"/roger/defaultAttributes/bookStore/BookStore_v3.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);
+		}
+	}
+	
+	// inheritable attribute with type alternatives
+	public void testAttributes4() {
+		String xmlfile = fDataDir+"/attributes/test1_1.xml";
+		String schemapath = fDataDir+"/attributes/test1.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);
+		}
+	}
+	
+	// inheritable attribute with type alternatives
+	public void testAttributes5() {
+		String xmlfile = fDataDir+"/attributes/test1_2.xml";
+		String schemapath = fDataDir+"/attributes/test1.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("cvc-enumeration-valid:");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-type.3.1.3: The value 'Prentice Hall' of element");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+
+}

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AttributeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/AttributeTests.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/CompositorTests.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/CompositorTests.java?rev=1422490&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/CompositorTests.java (added)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/CompositorTests.java Sun Dec 16 09:12:49 2012
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.Validator;
+
+public class CompositorTests extends XercesAbstractTestCase {
+
+	public CompositorTests(String name) {
+		super(name);
+	}
+	
+	public void testAllCompositor1() {
+		String xmlfile = fDataDir+"/roger/all/book-store/BookStore_v1.xml";
+		String schemapath = fDataDir+"/roger/all/book-store/BookStore_v1.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 testAllCompositor2() {
+		String xmlfile = fDataDir+"/roger/all/book-store/BookStore_v2.xml";
+		String schemapath = fDataDir+"/roger/all/book-store/BookStore_v2.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 testAllCompositor3() {
+		String xmlfile = fDataDir+"/roger/all/book-store/BookStore_v3.xml";
+		String schemapath = fDataDir+"/roger/all/book-store/BookStore_v3.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 testAllCompositor4() {
+		String xmlfile = fDataDir+"/roger/all/juicers/juicers.xml";
+		String schemapath = fDataDir+"/roger/all/juicers/juicers.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 testAllCompositor5() {
+		String xmlfile = fDataDir+"/compositors/test1.xml";
+		String schemapath = fDataDir+"/compositors/test1.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 testAllCompositor6() {
+		String xmlfile = fDataDir+"/compositors/assertions/test2.xml";
+		String schemapath = fDataDir+"/compositors/assertions/test2.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 testAllCompositor7() {
+		String xmlfile = fDataDir+"/compositors/test1.xml";
+		String schemapath = fDataDir+"/compositors/test2.xsd";	
+		try {
+			fSchemaFactory.setErrorHandler(this);
+		    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("cos-all-limited.2-xs11: Incorrect schema instruction 'xs:sequence' found as child of 'xs:group' that is referred by this group reference. Groups that are referred from 'xs:all', are allowed to contain only 'xs:all' themselves.");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-complex-type.2.4.a: Invalid content was found starting with element 'b'. One of '{a}' is expected.");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		}
+	}
+
+}

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/CompositorTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/CompositorTests.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/ConditionalInclusionTests.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/ConditionalInclusionTests.java?rev=1422490&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/ConditionalInclusionTests.java (added)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/ConditionalInclusionTests.java Sun Dec 16 09:12:49 2012
@@ -0,0 +1,412 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.xml.sax.SAXParseException;
+
+public class ConditionalInclusionTests extends XercesAbstractTestCase {
+
+	public ConditionalInclusionTests(String name) {
+		super(name);
+	}
+	
+	public void testVersionControl1() {
+		String xmlfile = fDataDir+"/version-control/test36.xml";
+		String schemapath = fDataDir+"/version-control/test36.xsd";		
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            // validation failure indicates the 'test' success
+            assertNotNull(fErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testVersionControl2() {
+		String xmlfile = fDataDir+"/version-control/test37.xml";
+		String schemapath = fDataDir+"/version-control/test37.xsd";		
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            // validation failure indicates the 'test' success
+            assertNotNull(fErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testVersionControl3() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);		
+		String xmlfile = fDataDir+"/version-control/test37.xml";
+		String schemapath = fDataDir+"/version-control/test37.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 testVersionControl4() {
+		String xmlfile = fDataDir+"/version-control/test38.xml";
+		String schemapath = fDataDir+"/version-control/test38.xsd";		
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            // validation failure indicates the 'test' success
+            assertNotNull(fErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testVersionControl5() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);		
+		String xmlfile = fDataDir+"/version-control/test38.xml";
+		String schemapath = fDataDir+"/version-control/test38.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 testVersionControl6() {
+		String xmlfile = fDataDir+"/version-control/test39.xml";
+		String schemapath = fDataDir+"/version-control/test39.xsd";		
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            // validation failure indicates the 'test' success
+            assertNotNull(fErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testVersionControl7() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);		
+		String xmlfile = fDataDir+"/version-control/test40.xml";
+		String schemapath = fDataDir+"/version-control/test39.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 testVersionControl8() {
+		String xmlfile = fDataDir+"/roger/version-control/BookStore.xml";
+		String schemapath = fDataDir+"/roger/version-control/BookStore.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 testVersionControl9() {		
+		String xmlfile = fDataDir+"/version-control/test44.xml";
+		String schemapath = fDataDir+"/version-control/test44.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 testVersionControl10() {		
+		String xmlfile = fDataDir+"/version-control/test44.xml";
+		String schemapath = fDataDir+"/version-control/test45.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 testVersionControl11() {		
+		String xmlfile = fDataDir+"/version-control/test44.xml";
+		String schemapath = fDataDir+"/version-control/test46.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 testVersionControl12() {		
+		String xmlfile = fDataDir+"/version-control/test44.xml";
+		String schemapath = fDataDir+"/version-control/test47.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 testVersionControl13() {		
+		String xmlfile = fDataDir+"/version-control/test45.xml";
+		String schemapath = fDataDir+"/version-control/test48.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 testVersionControl14() {		
+		String xmlfile = fDataDir+"/version-control/test49.xml";
+		String schemapath = fDataDir+"/version-control/test49.xsd";
+		final String expectedErrMesgFragment10 = "The value 'a' of element 'Y' is not valid";
+		final String expectedErrMesgFragment11 = "An simple schema type defines the content to be EMPTY";
+		try {
+			// test a) run validation in XSD 1.0 mode
+			// instance validation fails.
+			fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertEquals(true, fErrorMessage.indexOf(expectedErrMesgFragment10) != -1);            
+            // test b) run validation in XSD 1.1 mode
+            // instance validation fails.
+            fSchemaFactory = SchemaFactory.newInstance(SCHEMA_11_LANGUAGE);
+            s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertEquals(true, fErrorMessage.indexOf(expectedErrMesgFragment11) != -1);            
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testVersionControl15() {		
+		String xmlfile = fDataDir+"/version-control/test1.xml";
+		String schemapath = fDataDir+"/version-control/test1.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 testVersionControl16() {
+		String xmlfile = fDataDir+"/version-control/test1.xml";
+		String schemapath = fDataDir+"/version-control/test2.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("cvc-complex-type.2.4.a: Invalid content was found starting with element 'x'. One of '{y}' is expected");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testVersionControl17() {
+		String xmlfile = fDataDir+"/version-control/test1.xml";
+		String schemapath = fDataDir+"/version-control/test3.xsd";
+		List expectedMsgList = new ArrayList();
+        FailureMesgFragments mesgFragments = null;
+		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
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-complex-type.2.4.a: Invalid content was found starting with element 'x'. One of '{y}' is expected");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		}
+		catch(SAXParseException ex) {
+			mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("UndeclaredPrefix: Cannot resolve 'a:t1' as a QName: the prefix 'a' is not declared");
+            expectedMsgList.add(mesgFragments);
+	    }
+		catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testVersionControl18() {		
+		String xmlfile = fDataDir+"/version-control/test1.xml";
+		String schemapath = fDataDir+"/version-control/test4.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 testVersionControl19() {
+		String xmlfile = fDataDir+"/version-control/test1.xml";
+		String schemapath = fDataDir+"/version-control/test5.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("cvc-complex-type.2.4.a: Invalid content was found starting with element 'x'. One of '{y}' is expected");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testVersionControl20() {		
+		String xmlfile = fDataDir+"/version-control/test2.xml";
+		String schemapath = fDataDir+"/version-control/test6.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 testVersionControl21() {		
+		String xmlfile = fDataDir+"/version-control/test1.xml";
+		String schemapath = fDataDir+"/version-control/test7.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);
+		}
+	}
+	
+}

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/ConditionalInclusionTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/ConditionalInclusionTests.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/FailureMesgFragments.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/FailureMesgFragments.java?rev=1422490&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/FailureMesgFragments.java (added)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/FailureMesgFragments.java Sun Dec 16 09:12:49 2012
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * Represents ONE "error/fatal error/warning" message. Various fragments of ONE "error/fatal error/warning" message
+ * can be stored in this object.
+ */
+public class FailureMesgFragments {
+	
+	private List mesgFragments = null;
+
+	// class constructor
+	public FailureMesgFragments() {
+		mesgFragments = new ArrayList();
+	}
+	
+	public void setMessageFragment(String mesgFragment) {
+		mesgFragments.add(mesgFragment);
+	}
+	
+	public List getMessageFragments() {
+		return mesgFragments;
+	}
+   
+}

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/FailureMesgFragments.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/FailureMesgFragments.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/GenericTests.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/GenericTests.java?rev=1422490&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/GenericTests.java (added)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/GenericTests.java Sun Dec 16 09:12:49 2012
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.Validator;
+
+public class GenericTests extends XercesAbstractTestCase {
+
+	public GenericTests(String name) {
+		super(name);
+	}
+	
+	public void testXsiType1() {
+		String xmlfile = fDataDir+"/generic/x1_1.xml";
+		String schemapath = fDataDir+"/generic/x1.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 testXsiType2() {
+		String xmlfile = fDataDir+"/generic/x1_2.xml";
+		String schemapath = fDataDir+"/generic/x1.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("cvc-assertion: Assertion evaluation ('not(a/*)') for element 'X' on schema type 'T1' did not succeed");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testMissingElemDecl_1() {
+		String xmlfile = fDataDir+"/generic/x1_3.xml";
+		String schemapath = fDataDir+"/generic/x1.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("cvc-elt.1.a: Cannot find the declaration of element 'X'");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testDateTimeNodeCast_1() {
+		String xmlfile = fDataDir+"/generic/x2.xml";
+		String schemapath = fDataDir+"/generic/x2_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 testDateTimeNodeCast_2() {
+		String xmlfile = fDataDir+"/generic/x2.xml";
+		String schemapath = fDataDir+"/generic/x2_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);
+		}
+	}
+	
+}

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/GenericTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/GenericTests.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 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=1422490&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java (added)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java Sun Dec 16 09:12:49 2012
@@ -0,0 +1,341 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.Validator;
+
+public class IDConstraintTests extends XercesAbstractTestCase {
+
+	public IDConstraintTests(String name) {
+		super(name);
+	}
+	
+	public void testIDConstraint1() {
+		String xmlfile = fDataDir+"/idconstraints/test1_1.xml";
+		String schemapath = fDataDir+"/idconstraints/test1.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 testIDConstraint2() {
+		String xmlfile = fDataDir+"/idconstraints/test1_2.xml";
+		String schemapath = fDataDir+"/idconstraints/test1.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("cvc-identity-constraint.4.2.2: Duplicate key value [a2] declared for identity constraint \"key_a\" of element \"X\"");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint3() {
+		String xmlfile = fDataDir+"/idconstraints/test2_1.xml";
+		String schemapath = fDataDir+"/idconstraints/test2.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 testIDConstraint4() {
+		String xmlfile = fDataDir+"/idconstraints/test2_2.xml";
+		String schemapath = fDataDir+"/idconstraints/test2.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("cvc-identity-constraint.4.2.2: Duplicate key value [a2] declared for identity constraint \"key_a\" of element \"X\"");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint5() {
+		String xmlfile = fDataDir+"/idconstraints/test3_1.xml";
+		String schemapath = fDataDir+"/idconstraints/test3.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 testIDConstraint6() {
+		String xmlfile = fDataDir+"/idconstraints/test3_2.xml";
+		String schemapath = fDataDir+"/idconstraints/test3.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("cvc-identity-constraint.4.2.2: Duplicate key value [a2] declared for identity constraint \"key_a\" of element \"X\"");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint7() {
+		String xmlfile = fDataDir+"/idconstraints/test3_1.xml";
+		String schemapath = fDataDir+"/idconstraints/test4.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 testIDConstraint8() {
+		String xmlfile = fDataDir+"/idconstraints/test3_2.xml";
+		String schemapath = fDataDir+"/idconstraints/test4.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("cvc-identity-constraint.4.2.2: Duplicate key value [a2] declared for identity constraint \"key_a\" of element \"X\"");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint9() {
+		String xmlfile = fDataDir+"/idconstraints/test4_1.xml";
+		String schemapath = fDataDir+"/idconstraints/test5.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 testIDConstraint10() {
+		String xmlfile = fDataDir+"/idconstraints/test4_2.xml";
+		String schemapath = fDataDir+"/idconstraints/test5.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("cvc-identity-constraint.4.3: Key 'keyref_data' with value 'a4' not found for identity constraint of element 'X'");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint11() {
+		String xmlfile = fDataDir+"/idconstraints/test4_3.xml";
+		String schemapath = fDataDir+"/idconstraints/test6.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 testIDConstraint12() {
+		String xmlfile = fDataDir+"/idconstraints/test4_4.xml";
+		String schemapath = fDataDir+"/idconstraints/test6.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("cvc-identity-constraint.4.3: Key 'keyref_data' with value 'a4' not found for identity constraint of element 'X'");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint13() {
+		String xmlfile = fDataDir+"/idconstraints/test3_1.xml";
+		String schemapath = fDataDir+"/idconstraints/test7.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 testIDConstraint14() {
+		String xmlfile = fDataDir+"/idconstraints/test3_2.xml";
+		String schemapath = fDataDir+"/idconstraints/test7.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("cvc-identity-constraint.4.2.2: Duplicate key value [a2] declared for identity constraint \"key_a\" of element \"X\"");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint15() {
+		String xmlfile = fDataDir+"/idconstraints/jira_1585.xml";
+		String schemapath = fDataDir+"/idconstraints/jira_1585.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("cvc-identity-constraint.4.3.b: Not enough values specified for <keyref name=\"newKeyref\"> identity constraint specified for element \"Sub_1a\"");
+            expectedMsgList.add(mesgFragments);
+            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));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testIDConstraint16() {
+		String xmlfile = fDataDir+"/idconstraints/jira_1594.xml";
+		String schemapath = fDataDir+"/idconstraints/jira_1594.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("cvc-identity-constraint.4.3.b: Not enough values specified for <keyref name=\"keyref\"> identity constraint specified for element \"personnel\"");
+            expectedMsgList.add(mesgFragments);
+            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);
+		}
+	}
+
+}
+

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/IDConstraintTests.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 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=1422490&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java (added)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java Sun Dec 16 09:12:49 2012
@@ -0,0 +1,310 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+public class JiraBugsTests extends XercesAbstractTestCase {
+
+	public JiraBugsTests(String name) {
+		super(name);
+	}
+	
+	public void testJira_1578_1() {
+		String schemapath = fDataDir+"/jira_bugs/1578_1.xsd";	
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1578_2() {
+		String schemapath = fDataDir+"/jira_bugs/1578_2.xsd";	
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1578_3() {
+		String schemapath = fDataDir+"/jira_bugs/1578_3.xsd";	
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1578_4() {
+		String schemapath = fDataDir+"/jira_bugs/1578_4.xsd";	
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1577_1() {
+		String schemapath = fDataDir+"/jira_bugs/1577_1.xsd";	
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1577_2() {
+		String schemapath = fDataDir+"/jira_bugs/1577_2.xsd";	
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	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() == 2);
+            // 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";	
+		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("Attribute 'attr' must appear on element 'el'");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1584_2() {
+		String xmlfile = fDataDir+"/jira_bugs/3_1.xml";	
+		String schemapath = fDataDir+"/jira_bugs/3_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("cvc-maxInclusive-valid: Value '60' is not facet-valid with respect to maxInclusive '50' for type 'st'");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-type.3.1.3: The value '60' of element 'el' is not valid");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1584_3() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
+		String xmlfile = fDataDir+"/jira_bugs/3.xml";	
+		String schemapath = fDataDir+"/jira_bugs/3.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("Attribute 'attr' must appear on element 'el'");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1584_4() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
+		String xmlfile = fDataDir+"/jira_bugs/3_1.xml";	
+		String schemapath = fDataDir+"/jira_bugs/3_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("cvc-maxInclusive-valid: Value '60' is not facet-valid with respect to maxInclusive '50' for type 'st'");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-type.3.1.3: The value '60' of element 'el' is not valid");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1591_1() {
+		String xmlfile = fDataDir+"/jira_bugs/ag.xml";	
+		String schemapath = fDataDir+"/jira_bugs/ag3.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("Attribute 'id' must appear on element 'el'");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1591_2() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
+		String xmlfile = fDataDir+"/jira_bugs/ag.xml";	
+		String schemapath = fDataDir+"/jira_bugs/ag3.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("Attribute 'id' must appear on element 'el'");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1591_3() {
+		String xmlfile = fDataDir+"/jira_bugs/gr.xml";	
+		String schemapath = fDataDir+"/jira_bugs/gr3.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("The content of element 'el' is not complete. One of '{\"tns\":x}' is expected");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1591_4() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);
+		String xmlfile = fDataDir+"/jira_bugs/gr.xml";	
+		String schemapath = fDataDir+"/jira_bugs/gr3.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("The content of element 'el' is not complete. One of '{\"tns\":x}' is expected");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+		
+}

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OpenContentTests.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OpenContentTests.java?rev=1422490&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OpenContentTests.java (added)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OpenContentTests.java Sun Dec 16 09:12:49 2012
@@ -0,0 +1,255 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.tests;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.Validator;
+
+public class OpenContentTests extends XercesAbstractTestCase {
+
+	public OpenContentTests(String name) {
+		super(name);
+	}
+	
+	public void testOpenContent1() {
+		String xmlfile = fDataDir+"/open-content/test21.xml";
+		String schemapath = fDataDir+"/open-content/test21.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 testOpenContent2() {
+		String xmlfile = fDataDir+"/open-content/test22.xml";
+		String schemapath = fDataDir+"/open-content/test22.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 testOpenContent3() {
+		String xmlfile = fDataDir+"/roger/open-content/"+"BookStore_v1.xml";
+		String schemapath = fDataDir+"/roger/open-content/"+"BookStore_v1.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 testOpenContent4() {
+		String xmlfile = fDataDir+"/roger/open-content/"+"BookStore_v2.xml";
+		String schemapath = fDataDir+"/roger/open-content/"+"BookStore_v2.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 testOpenContent5() {
+		String xmlfile = fDataDir+"/roger/open-content/"+"BookStore_v3.xml";
+		String schemapath = fDataDir+"/roger/open-content/"+"BookStore_v3.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 testOpenContent6() {
+		String xmlfile = fDataDir+"/roger/open-content/"+"BookStore_v4.xml";
+		String schemapath = fDataDir+"/roger/open-content/"+"BookStore_v4.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 testOpenContent7() {
+		String xmlfile = fDataDir+"/roger/open-content/"+"BookStore_v5.xml";
+		String schemapath = fDataDir+"/roger/open-content/"+"BookStore_v5.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();
+		   // schema is incorrect. an exception indicates, that this test 
+		   // has 'passed'.
+		   assertTrue(true);
+		}
+	}
+	
+	public void testOpenContent8() {
+		String xmlfile = fDataDir+"/roger/open-content/"+"BookStore_v6.xml";
+		String schemapath = fDataDir+"/roger/open-content/"+"BookStore_v6.xsd";	
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertTrue(fErrSysId != null || fFatErrSysId != null);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testOpenContent9() {
+		String xmlfile = fDataDir+"/roger/open-content/"+"BookStore_v7.xml";
+		String schemapath = fDataDir+"/roger/open-content/"+"BookStore_v7.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 testOpenContent10() {
+		String xmlfile = fDataDir+"/roger/open-content/"+"BookStore_v8.xml";
+		String schemapath = fDataDir+"/roger/open-content/"+"BookStore_v8.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 testOpenContent11() {
+		String xmlfile = fDataDir+"/roger/open-content/"+"BookStore_v9.xml";
+		String schemapath = fDataDir+"/roger/open-content/"+"BookStore_v9.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 testOpenContent12() {
+		String xmlfile = fDataDir+"/roger/open-content/"+"BookStore_v10.xml";
+		String schemapath = fDataDir+"/roger/open-content/"+"BookStore_v10.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 testOpenContent13() {
+		String xmlfile = fDataDir+"/open-content/test42.xml";
+		String schemapath = fDataDir+"/open-content/test42.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 testOpenContent14() {
+		String xmlfile = fDataDir+"/open-content/test43.xml";
+		String schemapath = fDataDir+"/open-content/test43.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);
+		}
+	}
+
+}

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OpenContentTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OpenContentTests.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OverrideTests.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OverrideTests.java?rev=1422490&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OverrideTests.java (added)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OverrideTests.java Sun Dec 16 09:12:49 2012
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+public class OverrideTests extends XercesAbstractTestCase {
+
+	public OverrideTests(String name) {
+		super(name);
+	}
+	
+	public void testXSOverride1() {
+		// run validation in XSD 1.0 mode
+		fSchemaFactory = SchemaFactory.newInstance(DEFAULT_SCHEMA_LANGUAGE);		
+		String xmlfile = fDataDir+"/override/test1.xml";
+		String schemapath = fDataDir+"/override/test1.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 testXSOverride2() {
+		String xmlfile = fDataDir+"/override/test1_1.xml";
+		String schemapath = fDataDir+"/override/test1.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 testXSOverride3() {
+		String xmlfile = fDataDir+"/override/test2.xml";
+		String schemapath = fDataDir+"/override/test2.xsd";			
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertTrue(failureList.size() == 4);
+            // test expected error messages
+            List expectedMsgList = new ArrayList();
+            FailureMesgFragments mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-maxInclusive-valid: Value '105' is not facet-valid with respect to maxInclusive '100' for type 'X_TYPE'");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-type.3.1.3: The value '105' of element 'x' is not valid");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-maxInclusive-valid: Value '505' is not facet-valid with respect to maxInclusive '500' for type 'Y_TYPE'");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-type.3.1.3: The value '505' of element 'z' is not valid");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	// scenario: A overrides B. B includes C. A overrides components of B, but not of C.
+	public void testXSOverride4() {
+		String xmlfile = fDataDir+"/override/test3.xml";
+		String schemapath = fDataDir+"/override/test3.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("cvc-maxInclusive-valid: Value '105' is not facet-valid with respect to maxInclusive '100' for type 'X_TYPE'");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-type.3.1.3: The value '105' of element 'x' is not valid");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	// scenario: A overrides B. B includes C. A overrides components of both B and C.
+	public void testXSOverride5() {
+		String xmlfile = fDataDir+"/override/test3.xml";
+		String schemapath = fDataDir+"/override/test4.xsd";			
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertTrue(failureList.size() == 4);
+            // test expected error messages
+            List expectedMsgList = new ArrayList();
+            FailureMesgFragments mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-maxInclusive-valid: Value '105' is not facet-valid with respect to maxInclusive '100' for type 'X_TYPE'");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-type.3.1.3: The value '105' of element 'x' is not valid");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-datatype-valid.1.2.1: 'hello' is not a valid value for 'integer'");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-type.3.1.3: The value 'hello' of element 'y' is not valid");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	// scenario: A overrides B. B overrides C (chained overridings) : validation succeeds.
+	public void testXSOverride6() {
+		String xmlfile = fDataDir+"/override/test4.xml";
+		String schemapath = fDataDir+"/override/test5.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);
+		}
+	}
+	
+	// scenario: A overrides B. B overrides C (chained overridings) : validation failure.
+	public void testXSOverride7() {
+		String xmlfile = fDataDir+"/override/test3.xml";
+		String schemapath = fDataDir+"/override/test5.xsd";			
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertTrue(failureList.size() == 4);
+            // test expected error messages
+            List expectedMsgList = new ArrayList();
+            FailureMesgFragments mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-maxInclusive-valid: Value '105' is not facet-valid with respect to maxInclusive '100' for type 'X_TYPE'");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-type.3.1.3: The value '105' of element 'x' is not valid");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-datatype-valid.1.2.1: 'hello' is not a valid value for 'integer'");
+            expectedMsgList.add(mesgFragments);
+            mesgFragments = new FailureMesgFragments();
+            mesgFragments.setMessageFragment("cvc-type.3.1.3: The value 'hello' of element 'y' is not valid");
+            expectedMsgList.add(mesgFragments);
+            assertTrue(areErrorMessagesConsistent(expectedMsgList));
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+
+}

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OverrideTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/OverrideTests.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/PSVIHandler.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/PSVIHandler.java?rev=1422490&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/PSVIHandler.java (added)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/PSVIHandler.java Sun Dec 16 09:12:49 2012
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.xerces.tests;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.xerces.xs.PSVIProvider;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * A class consuming SAX events, augmented by PSVI information.
+ */
+public class PSVIHandler extends DefaultHandler {
+
+    private PSVIProvider fPsviProvider = null;
+    private Map fAttributePsviInfo = null;
+    private Map fElementPsviInfo = null;
+    
+	public PSVIHandler(PSVIProvider psviProvider) {
+		fPsviProvider = psviProvider;
+		fAttributePsviInfo = new HashMap();
+		fElementPsviInfo = new HashMap();
+	}
+
+	public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+		for (int attxIdx = 0; attxIdx < attributes.getLength(); attxIdx++) {
+			fAttributePsviInfo.put(attributes.getLocalName(attxIdx), fPsviProvider.getAttributePSVIByName(null, attributes.getLocalName(attxIdx)));		
+		}
+	}
+	
+	public void endElement(String uri, String localName, String qName) throws SAXException {
+        fElementPsviInfo.put(localName, fPsviProvider.getElementPSVI());
+	}
+	
+	public Map getElementPsviInfo() {
+		return fElementPsviInfo; 
+	}
+	
+	public Map getAttributePsviInfo() {
+		return fAttributePsviInfo; 
+	}
+
+} // class PSVIHandler

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/PSVIHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/PSVIHandler.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



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