8036951: Xerces Update: XMLSchemaValidator.java and XMLSchemaLoader.java
Reviewed-by: lancea
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/TEST.properties Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,3 @@
+# This file identifies root(s) of the test-ng hierarchy.
+
+TestNG.dirs = .
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/BaseTest.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,338 +0,0 @@
-/*
- * 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.
- */
-
-import java.io.File;
-import java.net.URL;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.impl.Constants;
-import com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar;
-import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import com.sun.org.apache.xerces.internal.xs.XSElementDeclaration;
-import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
-import javax.xml.transform.stream.StreamSource;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-public abstract class BaseTest {
- protected final static String ROOT_TYPE = Constants.XERCES_PROPERTY_PREFIX
- + Constants.ROOT_TYPE_DEFINITION_PROPERTY;
-
- protected final static String IGNORE_XSI_TYPE = Constants.XERCES_FEATURE_PREFIX
- + Constants.IGNORE_XSI_TYPE_FEATURE;
-
- protected final static String ID_IDREF_CHECKING = Constants.XERCES_FEATURE_PREFIX
- + Constants.ID_IDREF_CHECKING_FEATURE;
-
- protected final static String IDC_CHECKING = Constants.XERCES_FEATURE_PREFIX
- + Constants.IDC_CHECKING_FEATURE;
-
- protected final static String UNPARSED_ENTITY_CHECKING = Constants.XERCES_FEATURE_PREFIX
- + Constants.UNPARSED_ENTITY_CHECKING_FEATURE;
-
- protected final static String USE_GRAMMAR_POOL_ONLY = Constants.XERCES_FEATURE_PREFIX
- + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
-
- protected final static String DYNAMIC_VALIDATION = Constants.XERCES_FEATURE_PREFIX
- + Constants.DYNAMIC_VALIDATION_FEATURE;
-
- protected final static String DOCUMENT_CLASS_NAME = Constants.XERCES_PROPERTY_PREFIX
- + Constants.DOCUMENT_CLASS_NAME_PROPERTY;
-
- protected Schema schema;
- protected Validator fValidator;
-
- protected SpecialCaseErrorHandler fErrorHandler;
-
- DocumentBuilder builder;
- protected Document fDocument;
-
- protected ElementPSVI fRootNode;
-
- protected URL fDocumentURL;
- protected String documentPath;
- protected String fDocumentId;
-
- static String errMessage;
-
- int passed = 0, failed = 0;
-
- public static boolean isWindows = false;
- static {
- if (System.getProperty("os.name").indexOf("Windows")>-1) {
- isWindows = true;
- }
- };
- public static final String USER_DIR = System.getProperty("user.dir", ".");
- public static final String BASE_DIR = System.getProperty("test.src", USER_DIR)
- .replaceAll("\\" + System.getProperty("file.separator"), "/");
-
- protected abstract String getSchemaFile();
-
- protected abstract String getXMLDocument();
-
- public BaseTest(String name) {
- fErrorHandler = new SpecialCaseErrorHandler(getRelevantErrorIDs());
- }
-
- protected void setUp() throws Exception {
-
- DocumentBuilderFactory docFactory = DocumentBuilderFactory
- .newInstance();
- docFactory.setAttribute(DOCUMENT_CLASS_NAME,
- "com.sun.org.apache.xerces.internal.dom.PSVIDocumentImpl");
- docFactory.setNamespaceAware(true);
- builder = docFactory.newDocumentBuilder();
-
- documentPath = BASE_DIR + "/" + getXMLDocument();
-System.out.println("documentPath:"+documentPath);
- if (isWindows) {
- fDocumentId = "file:/" + documentPath;
- } else {
- fDocumentId = "file:" + documentPath;
- }
- //fDocumentURL = ClassLoader.getSystemResource(documentPath);
- //fDocumentURL = getClass().getResource(documentPath);
-System.out.println("fDocumentId:"+fDocumentId);
-//System.out.println("fDocumentURL.toExternalForm:"+fDocumentURL.toExternalForm());
-/**
- if (fDocumentURL == null) {
- throw new FileNotFoundException("Couldn't find xml file for test: " + documentPath);
- }
- fDocument = builder.parse(fDocumentURL.toExternalForm());
- fRootNode = (ElementPSVI) fDocument.getDocumentElement();
- */
- SchemaFactory sf = SchemaFactory
- .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- sf.setFeature(USE_GRAMMAR_POOL_ONLY, getUseGrammarPoolOnly());
- String schemaPath = BASE_DIR + "/" + getSchemaFile();
- /**
- URL schemaURL = ClassLoader.getSystemResource(schemaPath);
- if (schemaURL == null) {
- throw new FileNotFoundException("Couldn't find schema file for test: " + schemaPath);
- }
- */
- schema = sf.newSchema(new StreamSource(new File(schemaPath)));
- }
-
- protected void tearDown() throws Exception {
- fValidator = null;
- fDocument = null;
- fRootNode = null;
- fErrorHandler.reset();
- System.out.println("\nNumber of tests passed: " + passed);
- System.out.println("Number of tests failed: " + failed + "\n");
-
- if (errMessage != null) {
- throw new RuntimeException(errMessage);
- }
- }
-
- protected void validateDocument() throws Exception {
- Source source = new DOMSource(fDocument);
- source.setSystemId(fDocumentId);
- Result result = new DOMResult(fDocument);
- fValidator.validate(source, result);
- }
-
- protected void validateFragment() throws Exception {
- Source source = new DOMSource((Node) fRootNode);
- source.setSystemId(fDocumentId);
- Result result = new DOMResult((Node) fRootNode);
- fValidator.validate(source, result);
- }
-
- protected void reset() throws Exception {
- try {
-System.out.println("new File(documentPath)" + new File(documentPath));
-
- fDocument = builder.parse(new File(documentPath));
- fRootNode = (ElementPSVI) fDocument.getDocumentElement();
-System.out.println("fDocument" + fDocument);
-System.out.println("fRootNode" + fRootNode);
- fValidator = schema.newValidator();
- fErrorHandler.reset();
- fValidator.setErrorHandler(fErrorHandler);
- fValidator.setFeature(DYNAMIC_VALIDATION, false);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- protected PSVIElementNSImpl getChild(int n) {
- int numFound = 0;
- Node child = ((Node) fRootNode).getFirstChild();
- while (child != null) {
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- numFound++;
- if (numFound == n) {
- return (PSVIElementNSImpl) child;
- }
- }
- child = child.getNextSibling();
- }
- return null;
- }
-
- protected String[] getRelevantErrorIDs() {
- return new String[] {};
- }
-
- protected boolean getUseGrammarPoolOnly() {
- return false;
- }
-
- // specialized asserts
-
- protected void assertValidity(short expectedValidity, short actualValidity) {
- String expectedString = expectedValidity == ItemPSVI.VALIDITY_VALID ? "valid"
- : (expectedValidity == ItemPSVI.VALIDITY_INVALID ? "invalid"
- : "notKnown");
- String actualString = actualValidity == ItemPSVI.VALIDITY_VALID ? "valid"
- : (actualValidity == ItemPSVI.VALIDITY_INVALID ? "invalid"
- : "notKnown");
- String message = "{validity} was <" + actualString
- + "> but it should have been <" + expectedString + ">";
- assertEquals(message, expectedValidity, actualValidity);
- }
-
- protected void assertValidationAttempted(short expectedAttempted,
- short actualAttempted) {
- String expectedString = expectedAttempted == ItemPSVI.VALIDATION_FULL ? "full"
- : (expectedAttempted == ItemPSVI.VALIDATION_PARTIAL ? "partial"
- : "none");
- String actualString = actualAttempted == ItemPSVI.VALIDATION_FULL ? "full"
- : (actualAttempted == ItemPSVI.VALIDATION_PARTIAL ? "partial"
- : "none");
- String message = "{validity} was <" + actualString
- + "> but it should have been <" + expectedString + ">";
- assertEquals(message, expectedAttempted, actualAttempted);
- }
-
- protected void assertElementName(String expectedName, String actualName) {
- assertEquals("Local name of element declaration is wrong.",
- expectedName, actualName);
- }
-
- protected void assertElementNull(XSElementDeclaration elem) {
- assertNull("Element declaration should be null.", elem);
- }
-
- protected void assertElementNamespace(String expectedName, String actualName) {
- assertEquals("Namespace of element declaration is wrong.",
- expectedName, actualName);
- }
-
- protected void assertElementNamespaceNull(String actualName) {
- assertNull("Local name of element declaration should be null.",
- actualName);
- }
-
- protected void assertTypeName(String expectedName, String actualName) {
- assertEquals("Local name of type definition is wrong.", expectedName,
- actualName);
- }
-
- protected void assertTypeNull(XSTypeDefinition type) {
- assertNull("Type definition should be null.", type);
- }
-
- protected void assertTypeNamespace(String expectedName, String actualName) {
- assertEquals("Namespace of type definition is wrong.", expectedName,
- actualName);
- }
-
- protected void assertTypeNamespaceNull(String actualName) {
- assertNull("Namespace of type definition should be null.", actualName);
- }
-
- protected void assertError(String error) {
- assertTrue("Error <" + error + "> should have occured, but did not.",
- fErrorHandler.specialCaseFound(error));
- }
-
- protected void assertNoError(String error) {
- assertFalse("Error <" + error
- + "> should not have occured (but it did)", fErrorHandler
- .specialCaseFound(error));
- }
-
- protected void assertAnyType(XSTypeDefinition type) {
- assertEquals("Type is supposed to be anyType", SchemaGrammar.fAnyType,
- type);
- }
-
- void assertEquals(String msg, Object expected, Object actual) {
- if (!expected.equals(actual)) {
- fail(msg + " Expected: " + expected + " Actual: " + actual);
- } else {
- success(null);
- }
- }
- void assertNull(String msg, Object value) {
- if (value != null) {
- fail(msg);
- } else {
- success(null);
- }
- }
- void assertTrue(String msg, boolean value) {
- if (!value) {
- fail(msg);
- } else {
- success(null);
- }
- }
- void assertFalse(String msg, boolean value) {
- if (value) {
- fail(msg);
- } else {
- success(null);
- }
- }
- void fail(String errMsg) {
- if (errMessage == null) {
- errMessage = errMsg;
- } else {
- errMessage = errMessage + "\n" + errMsg;
- }
- failed++;
- }
-
- void success(String msg) {
- passed++;
- System.out.println(msg);
- if (msg != null) {
- if (msg.length() != 0) {
- System.out.println(msg);
- }
- }
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/BasicTest.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class BasicTest extends BaseTest {
-
- protected String getXMLDocument() {
- return "base.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- public BasicTest(String name) {
- super(name);
- }
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testSimpleValidation() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
- doValidityAsserts();
- }
-
- @Test
- public void testSimpleValidationWithTrivialXSIType() {
- try {
- reset();
- ((PSVIElementNSImpl) fRootNode).setAttributeNS(
- "http://www.w3.org/2001/XMLSchema-instance", "type", "X");
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
- doValidityAsserts();
- }
-
- private void doValidityAsserts() {
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("A", fRootNode.getElementDeclaration().getName());
- assertElementNamespaceNull(fRootNode.getElementDeclaration()
- .getNamespace());
- assertTypeName("X", fRootNode.getTypeDefinition().getName());
- assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/FixedAttrTest.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * The purpose of this test is to execute all of the isComparable calls in
- * XMLSchemaValidator. There are two calls in processElementContent and two
- * calls in processOneAttribute.
- *
- * @author peterjm
- */
-public class FixedAttrTest extends BaseTest {
-
- protected String getXMLDocument() {
- return "fixedAttr.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- public FixedAttrTest(String name) {
- super(name);
- }
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefault() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("A", fRootNode.getElementDeclaration().getName());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("B", child.getElementDeclaration().getName());
-
- child = super.getChild(2);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("D", child.getElementDeclaration().getName());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/IdIdrefCheckingTest.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.xml.sax.SAXException;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-// duplicate IDs
-// reference to non-existent ID
-
-public class IdIdrefCheckingTest extends BaseTest {
- public static final String DUPLICATE_ID = "cvc-id.2";
-
- public static final String NO_ID_BINDING = "cvc-id.1";
-
- protected String getXMLDocument() {
- return "idIdref.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- protected String[] getRelevantErrorIDs() {
- return new String[] { DUPLICATE_ID, NO_ID_BINDING };
- }
-
- public IdIdrefCheckingTest(String name) {
- super(name);
- }
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefault() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkDefault();
- }
-
- @Test
- public void testSetFalse() {
- try {
- reset();
- fValidator.setFeature(ID_IDREF_CHECKING, false);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkValidResult();
- }
-
- @Test
- public void testSetTrue() {
- try {
- reset();
- fValidator.setFeature(ID_IDREF_CHECKING, true);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkDefault();
- }
-
- private void checkDefault() {
- assertError(DUPLICATE_ID);
- assertError(NO_ID_BINDING);
-
- assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("A", fRootNode.getElementDeclaration().getName());
- assertTypeName("X", fRootNode.getTypeDefinition().getName());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("idType", child.getTypeDefinition().getName());
-
- child = super.getChild(2);
- assertValidity(ItemPSVI.VALIDITY_INVALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("idType", child.getTypeDefinition().getName());
-
- child = super.getChild(3);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("idrefType", child.getTypeDefinition().getName());
- }
-
- private void checkValidResult() {
- assertNoError(DUPLICATE_ID);
- assertNoError(NO_ID_BINDING);
-
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("A", fRootNode.getElementDeclaration().getName());
- assertTypeName("X", fRootNode.getTypeDefinition().getName());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("idType", child.getTypeDefinition().getName());
-
- child = super.getChild(2);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("idType", child.getTypeDefinition().getName());
-
- child = super.getChild(3);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("idrefType", child.getTypeDefinition().getName());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/IdentityConstraintCheckingTest.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.xml.sax.SAXException;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class IdentityConstraintCheckingTest extends BaseTest {
- // These values are unstable, since they're not actually error keys, but
- // simply
- // the first part of the error message.
- public static final String DUPLICATE_UNIQUE = "cvc-identity-constraint.4.1";
-
- public static final String DUPLICATE_KEY = "cvc-identity-constraint.4.2.2";
-
- public static final String INVALID_KEYREF = "cvc-identity-constraint.4.3";
-
- protected String getXMLDocument() {
- return "idc.xml";
- }
-
- protected String getSchemaFile() {
- return "idc.xsd";
- }
-
- protected String[] getRelevantErrorIDs() {
- return new String[] { DUPLICATE_UNIQUE, DUPLICATE_KEY, INVALID_KEYREF };
- }
-
- public IdentityConstraintCheckingTest(String name) {
- super(name);
- }
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefault() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkDefault();
- }
-
- @Test
- public void testSetFalse() {
- try {
- reset();
- fValidator.setFeature(IDC_CHECKING, false);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkValidResult();
- }
-
- @Test
- public void testSetTrue() {
- try {
- reset();
- fValidator.setFeature(IDC_CHECKING, true);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkDefault();
- }
-
- private void checkDefault() {
- assertError(DUPLICATE_UNIQUE);
- assertError(DUPLICATE_KEY);
- assertError(INVALID_KEYREF);
-
- assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("itemList", fRootNode.getElementDeclaration()
- .getName());
- assertTypeName("itemListType", fRootNode.getTypeDefinition().getName());
-
- // this one is valid because it's the first one to define the unique
- // value
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("item", child.getElementDeclaration().getName());
- assertTypeName("itemType", child.getTypeDefinition().getName());
-
- // invalid because it repeats the unique value
- child = super.getChild(2);
- assertValidity(ItemPSVI.VALIDITY_INVALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("item", child.getElementDeclaration().getName());
- assertTypeName("itemType", child.getTypeDefinition().getName());
-
- // invalid because it repeats the key
- child = super.getChild(3);
- assertValidity(ItemPSVI.VALIDITY_INVALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("item", child.getElementDeclaration().getName());
- assertTypeName("itemType", child.getTypeDefinition().getName());
-
- // valid because key references aren't figured out until the validation
- // root
- child = super.getChild(4);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("itemRef", child.getElementDeclaration().getName());
- assertTypeName("string", child.getTypeDefinition().getName());
- }
-
- private void checkValidResult() {
- assertNoError(DUPLICATE_UNIQUE);
- assertNoError(DUPLICATE_KEY);
- assertNoError(INVALID_KEYREF);
-
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("itemList", fRootNode.getElementDeclaration()
- .getName());
- assertTypeName("itemListType", fRootNode.getTypeDefinition().getName());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("item", child.getElementDeclaration().getName());
- assertTypeName("itemType", child.getTypeDefinition().getName());
-
- child = super.getChild(2);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("item", child.getElementDeclaration().getName());
- assertTypeName("itemType", child.getTypeDefinition().getName());
-
- child = super.getChild(3);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("item", child.getElementDeclaration().getName());
- assertTypeName("itemType", child.getTypeDefinition().getName());
-
- child = super.getChild(4);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("itemRef", child.getElementDeclaration().getName());
- assertTypeName("string", child.getTypeDefinition().getName());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/IgnoreXSITypeTest_A_A.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * 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.
- */
-
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class IgnoreXSITypeTest_A_A extends BaseTest {
-
- protected String getXMLDocument() {
- return "xsitype_A_A.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- public IgnoreXSITypeTest_A_A(String name) {
- super(name);
- }
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefaultDocument() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testDefaultFragment() {
- try {
- reset();
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetTrueDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- @Test
- public void testSetTrueFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- private void checkTrueResult() {
- checkResult();
- }
-
- private void checkFalseResult() {
- checkResult();
- }
-
- private void checkResult() {
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("A", fRootNode.getElementDeclaration().getName());
- assertTypeName("Y", fRootNode.getTypeDefinition().getName());
- assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("Y", child.getTypeDefinition().getName());
- assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/IgnoreXSITypeTest_A_C.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class IgnoreXSITypeTest_A_C extends BaseTest {
-
- protected String getXMLDocument() {
- return "xsitype_A_C.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- public IgnoreXSITypeTest_A_C(String name) {
- super(name);
- }
-
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefaultDocument() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testDefaultFragment() {
- try {
- reset();
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetTrueDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- @Test
- public void testSetTrueFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- private void checkTrueResult() {
- checkResult();
- }
-
- private void checkFalseResult() {
- checkResult();
- }
-
- private void checkResult() {
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("A", fRootNode.getElementDeclaration().getName());
- assertTypeName("Y", fRootNode.getTypeDefinition().getName());
- assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementNull(child.getElementDeclaration());
- assertTypeName("Y", child.getTypeDefinition().getName());
- assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/IgnoreXSITypeTest_C_A.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class IgnoreXSITypeTest_C_A extends BaseTest {
-
- protected String getXMLDocument() {
- return "xsitype_C_A.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- public IgnoreXSITypeTest_C_A(String name) {
- super(name);
- }
-
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefaultDocument() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testDefaultFragment() {
- try {
- reset();
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetTrueDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- @Test
- public void testSetTrueFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- private void checkTrueResult() {
- assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_PARTIAL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertAnyType(fRootNode.getTypeDefinition());
-
- checkChild();
- }
-
- private void checkFalseResult() {
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertTypeName("Y", fRootNode.getTypeDefinition().getName());
- assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
-
- checkChild();
- }
-
- private void checkChild() {
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("Y", child.getTypeDefinition().getName());
- assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/IgnoreXSITypeTest_C_AC.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class IgnoreXSITypeTest_C_AC extends BaseTest {
-
- protected String getXMLDocument() {
- return "xsitype_C_AC.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- public IgnoreXSITypeTest_C_AC(String name) {
- super(name);
- }
-
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefaultDocument() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testDefaultFragment() {
- try {
- reset();
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetTrueDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- @Test
- public void testSetTrueFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- private void checkTrueResult() {
- assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_PARTIAL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertAnyType(fRootNode.getTypeDefinition());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("Y", child.getTypeDefinition().getName());
- assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
-
- child = super.getChild(2);
- assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
- .getValidationAttempted());
- assertElementNull(child.getElementDeclaration());
- assertAnyType(child.getTypeDefinition());
- }
-
- private void checkFalseResult() {
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertTypeName("Y", fRootNode.getTypeDefinition().getName());
- assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("Y", child.getTypeDefinition().getName());
- assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
-
- child = super.getChild(2);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementNull(child.getElementDeclaration());
- assertTypeName("Y", child.getTypeDefinition().getName());
- assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/IgnoreXSITypeTest_C_C.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class IgnoreXSITypeTest_C_C extends BaseTest {
-
- protected String getXMLDocument() {
- return "xsitype_C_C.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- public IgnoreXSITypeTest_C_C(String name) {
- super(name);
- }
-
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefaultDocument() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testDefaultFragment() {
- try {
- reset();
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetTrueDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- @Test
- public void testSetTrueFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- private void checkTrueResult() {
- assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_NONE, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertAnyType(fRootNode.getTypeDefinition());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
- .getValidationAttempted());
- assertElementNull(child.getElementDeclaration());
- assertAnyType(child.getTypeDefinition());
- }
-
- private void checkFalseResult() {
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertTypeName("Y", fRootNode.getTypeDefinition().getName());
- assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementNull(child.getElementDeclaration());
- assertTypeName("Y", child.getTypeDefinition().getName());
- assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/IgnoreXSITypeTest_C_CA.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class IgnoreXSITypeTest_C_CA extends BaseTest {
-
- protected String getXMLDocument() {
- return "xsitype_C_CA.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- public IgnoreXSITypeTest_C_CA(String name) {
- super(name);
- }
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefaultDocument() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testDefaultFragment() {
- try {
- reset();
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- // default value of the feature is false
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetFalseFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, false);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkFalseResult();
- }
-
- @Test
- public void testSetTrueDocument() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- @Test
- public void testSetTrueFragment() {
- try {
- reset();
- fValidator.setFeature(IGNORE_XSI_TYPE, true);
- validateFragment();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkTrueResult();
- }
-
- private void checkTrueResult() {
- assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_PARTIAL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertAnyType(fRootNode.getTypeDefinition());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
- .getValidationAttempted());
- assertElementNull(child.getElementDeclaration());
- assertAnyType(child.getTypeDefinition());
-
- child = super.getChild(2);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("Y", child.getTypeDefinition().getName());
- assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
- }
-
- private void checkFalseResult() {
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertTypeName("Y", fRootNode.getTypeDefinition().getName());
- assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
-
- PSVIElementNSImpl child = super.getChild(1);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementNull(child.getElementDeclaration());
- assertTypeName("Y", child.getTypeDefinition().getName());
- assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
-
- child = super.getChild(2);
- assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
- .getValidationAttempted());
- assertElementName("A", child.getElementDeclaration().getName());
- assertTypeName("Y", child.getTypeDefinition().getName());
- assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/RootTypeDefinitionTest.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/*
- * 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.
- */
-
-import javax.xml.namespace.QName;
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.impl.xs.SchemaSymbols;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class RootTypeDefinitionTest extends BaseTest {
- private QName unknownType;
-
- private QName typeX;
-
- private QName typeY;
-
- private QName typeZ;
-
- private QName typeOtherNamespace;
-
- private final static String UNKNOWN_TYPE_ERROR = "cvc-type.1";
-
- private final static String INVALID_DERIVATION_ERROR = "cvc-elt.4.3";
-
- protected String getXMLDocument() {
- return "base.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- protected String[] getRelevantErrorIDs() {
- return new String[] { UNKNOWN_TYPE_ERROR, INVALID_DERIVATION_ERROR };
- }
-
- public RootTypeDefinitionTest(String name) {
- super(name);
- unknownType = new QName("W");
- typeX = new QName("X");
- typeY = new QName("Y");
- typeZ = new QName("Z");
- typeOtherNamespace = new QName("xslt.unittests", "W", "unit");
- }
-
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefault() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkDefault();
- }
-
- @Test
- public void testSettingNull() {
- try {
- reset();
- fValidator.setProperty(ROOT_TYPE, null);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkDefault();
- }
-
- @Test
- public void testSettingToUnknownType() {
- try {
- reset();
- fValidator.setProperty(ROOT_TYPE, unknownType);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- assertError(UNKNOWN_TYPE_ERROR);
- checkDefault();
- }
-
- @Test
- public void testSettingToEqualType() {
- try {
- reset();
- fValidator.setProperty(ROOT_TYPE, typeX);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertTypeName("X", fRootNode.getTypeDefinition().getName());
- }
-
- @Test
- public void testSettingToDerivedType() {
- try {
- reset();
- // this is required to make it a valid type Y node
- ((PSVIElementNSImpl) fRootNode).setAttributeNS(null, "attr", "typeY");
- fValidator.setProperty(ROOT_TYPE, typeY);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertTypeName("Y", fRootNode.getTypeDefinition().getName());
- }
-
- @Test
- public void testSettingToNonDerivedType() {
- try {
- reset();
- fValidator.setProperty(ROOT_TYPE, typeZ);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertTypeName("Z", fRootNode.getTypeDefinition().getName());
- }
-
- @Test
- public void testSettingToOtherSchemaType() {
- try {
- reset();
- ((PSVIElementNSImpl) fRootNode).setAttributeNS(SchemaSymbols.URI_XSI,
- SchemaSymbols.XSI_SCHEMALOCATION,
- "xslt.unittests otherNamespace.xsd");
- fValidator.setProperty(ROOT_TYPE, typeOtherNamespace);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertTypeName("W", fRootNode.getTypeDefinition().getName());
- assertTypeNamespace("xslt.unittests", fRootNode.getTypeDefinition()
- .getNamespace());
- }
-
- @Test
- public void testSettingTypeAndXSIType() {
- try {
- reset();
- // this is required to make it a valid type Y node
- ((PSVIElementNSImpl) fRootNode).setAttributeNS(null, "attr", "typeY");
- ((PSVIElementNSImpl) fRootNode).setAttributeNS(SchemaSymbols.URI_XSI,
- SchemaSymbols.XSI_TYPE, "Y");
- fValidator.setProperty(ROOT_TYPE, typeX);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertTypeName("Y", fRootNode.getTypeDefinition().getName());
- }
-
- @Test
- public void testSettingTypeAndInvalidXSIType() {
- try {
- reset();
- ((PSVIElementNSImpl) fRootNode).setAttributeNS(SchemaSymbols.URI_XSI,
- SchemaSymbols.XSI_TYPE, "Z");
- fValidator.setProperty(ROOT_TYPE, typeX);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- assertError(INVALID_DERIVATION_ERROR);
- assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertTypeName("Z", fRootNode.getTypeDefinition().getName());
- }
-
- private void checkDefault() {
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("A", fRootNode.getElementDeclaration().getName());
- assertTypeName("X", fRootNode.getTypeDefinition().getName());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/SpecialCaseErrorHandler.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * 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.
- */
-
-import java.util.HashMap;
-
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-public class SpecialCaseErrorHandler implements ErrorHandler {
- public static final boolean DEBUG = false;
-
- private HashMap<String, Boolean> errors;
-
- public SpecialCaseErrorHandler(String[] specialCases) {
- errors = new HashMap<>();
- for (int i = 0; i < specialCases.length; ++i) {
- errors.put(specialCases[i], Boolean.FALSE);
- }
- }
-
- public void reset() {
- errors.keySet().stream().forEach((error) -> {
- errors.put(error, Boolean.FALSE);
- });
- }
-
- @Override
- public void warning(SAXParseException arg0) throws SAXException {
- if (DEBUG) {
- System.err.println(arg0.getMessage());
- }
- }
-
- @Override
- public void error(SAXParseException arg0) throws SAXException {
- if (DEBUG) {
- System.err.println(arg0.getMessage());
- }
- errors.keySet().stream().filter((error) -> (arg0.getMessage().startsWith(error))).forEach((error) -> {
- errors.put(error, Boolean.TRUE);
- });
- }
-
- public void fatalError(SAXParseException arg0) throws SAXException {
- throw arg0;
- }
-
- public boolean specialCaseFound(String key) {
- return ((Boolean) errors.get(key)).booleanValue();
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/TEST.properties Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-# This file identifies root(s) of the test-ng hierarchy.
-
-TestNG.dirs = .
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/UnparsedEntityCheckingTest.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class UnparsedEntityCheckingTest extends BaseTest {
- public static final String UNDECLARED_ENTITY = "UndeclaredEntity";
-
- protected String getXMLDocument() {
- return "unparsedEntity.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- protected String[] getRelevantErrorIDs() {
- return new String[] { UNDECLARED_ENTITY };
- }
-
- public UnparsedEntityCheckingTest(String name) {
- super(name);
- }
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- @Test
- public void testDefaultValid() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkDefault();
- }
-
- @Test
- public void testSetFalseValid() {
- try {
- reset();
- fValidator.setFeature(UNPARSED_ENTITY_CHECKING, false);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkDefault();
- }
-
- @Test
- public void testSetTrueValid() {
- try {
- reset();
- fValidator.setFeature(UNPARSED_ENTITY_CHECKING, true);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkDefault();
- }
-
- @Test
- public void testDefaultInvalid() {
- try {
- reset();
- ((PSVIElementNSImpl) fRootNode).setAttributeNS(null,
- "unparsedEntityAttr", "invalid");
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkInvalid();
- }
-
- @Test
- public void testSetFalseInvalid() {
- try {
- reset();
- ((PSVIElementNSImpl) fRootNode).setAttributeNS(null,
- "unparsedEntityAttr", "invalid");
- fValidator.setFeature(UNPARSED_ENTITY_CHECKING, false);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkDefault();
- }
-
- @Test
- public void testSetTrueInvalid() {
- try {
- reset();
- ((PSVIElementNSImpl) fRootNode).setAttributeNS(null,
- "unparsedEntityAttr", "invalid");
- fValidator.setFeature(UNPARSED_ENTITY_CHECKING, true);
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- checkInvalid();
- }
-
- private void checkDefault() {
- assertNoError(UNDECLARED_ENTITY);
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("A", fRootNode.getElementDeclaration().getName());
- assertTypeName("X", fRootNode.getTypeDefinition().getName());
- }
-
- private void checkInvalid() {
- assertError(UNDECLARED_ENTITY);
- assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("A", fRootNode.getElementDeclaration().getName());
- assertTypeName("X", fRootNode.getTypeDefinition().getName());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/UseGrammarPoolOnlyTest_False.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class UseGrammarPoolOnlyTest_False extends BaseTest {
- private final static String UNKNOWN_TYPE_ERROR = "cvc-type.1";
-
- private final static String INVALID_DERIVATION_ERROR = "cvc-elt.4.3";
-
- protected String getXMLDocument() {
- return "otherNamespace.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- protected String[] getRelevantErrorIDs() {
- return new String[] { UNKNOWN_TYPE_ERROR, INVALID_DERIVATION_ERROR };
- }
-
- protected boolean getUseGrammarPoolOnly() {
- return false;
- }
-
- public UseGrammarPoolOnlyTest_False(String name) {
- super(name);
- }
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- /**
- * The purpose of this test is to check if setting the USE_GRAMMAR_POOL_ONLY
- * feature to true causes external schemas to not be read. This
- * functionality already existed prior to adding the XSLT 2.0 validation
- * features; however, because the class that controlled it changed, this
- * test simply ensures that the existing functionality did not disappear.
- * -PM
- */
- @Test
- public void testUsingOnlyGrammarPool() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
- .getValidationAttempted());
- assertElementName("A", fRootNode.getElementDeclaration().getName());
- assertElementNamespace("xslt.unittests", fRootNode
- .getElementDeclaration().getNamespace());
- assertTypeName("W", fRootNode.getTypeDefinition().getName());
- assertTypeNamespace("xslt.unittests", fRootNode.getTypeDefinition()
- .getNamespace());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/UseGrammarPoolOnlyTest_True.java Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-
-import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class UseGrammarPoolOnlyTest_True extends BaseTest {
-
- protected String getXMLDocument() {
- return "otherNamespace.xml";
- }
-
- protected String getSchemaFile() {
- return "base.xsd";
- }
-
- protected boolean getUseGrammarPoolOnly() {
- return true;
- }
-
- public UseGrammarPoolOnlyTest_True(String name) {
- super(name);
- }
-
- @BeforeClass
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @AfterClass
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
- /**
- * The purpose of this test is to check if setting the USE_GRAMMAR_POOL_ONLY
- * feature to true causes external schemas to not be read. This
- * functionality already existed prior to adding the XSLT 2.0 validation
- * features; however, because the class that controlled it changed, this
- * test simply ensures that the existing functionality did not disappear.
- * -PM
- */
- @Test
- public void testUsingOnlyGrammarPool() {
- try {
- reset();
- validateDocument();
- } catch (Exception e) {
- fail("Validation failed: " + e.getMessage());
- }
-
- assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
- assertValidationAttempted(ItemPSVI.VALIDATION_NONE, fRootNode
- .getValidationAttempted());
- assertElementNull(fRootNode.getElementDeclaration());
- assertAnyType(fRootNode.getTypeDefinition());
- }
-}
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/base.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<?xml version="1.0"?>
-<A attr="typeX">
-</A>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/base.xsd Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:element name="A" type="X"/>
-
- <!-- The purpose of this element is:
- a) To have a fixed attribute use
- b) To have an attribute with a fixed attribute declaration
- c) To have a complex type with simple content and a fixed value
- d) To have an element declaration with a fixed value
- -->
- <xsd:element name="B" fixed="howdy">
- <xsd:complexType>
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute ref="fixedAttr" use="required" fixed="hello"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="D" type="xsd:string" fixed="hey"/>
-
- <xsd:attribute name="attr" type="xsd:string"/>
-
- <xsd:attribute name="unparsedEntityAttr" type="xsd:ENTITIES"/>
-
- <xsd:attribute name="fixedAttr" type="xsd:string" fixed="hello"/>
-
- <xsd:complexType name="X">
- <xsd:sequence>
- <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute ref="attr"/>
- <xsd:attribute ref="unparsedEntityAttr"/>
- </xsd:complexType>
-
- <xsd:complexType name="Y">
- <xsd:complexContent>
- <xsd:restriction base="X">
- <xsd:sequence>
- <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute ref="attr" fixed="typeY"/>
- <xsd:attribute ref="unparsedEntityAttr" use="prohibited"/>
- </xsd:restriction>
- </xsd:complexContent>
- </xsd:complexType>
-
- <!-- Z is the same as X, but is not derived from X. -->
- <xsd:complexType name="Z">
- <xsd:sequence>
- <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute ref="attr"/>
- <xsd:attribute ref="unparsedEntityAttr"/>
- </xsd:complexType>
-
- <xsd:complexType name="idType">
- <xsd:complexContent>
- <xsd:extension base="X">
- <xsd:attribute name="idAttr" type="xsd:ID"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="idrefType">
- <xsd:complexContent>
- <xsd:extension base="X">
- <xsd:attribute name="idrefAttr" type="xsd:IDREF"/>
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
-</xsd:schema>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/fixedAttr.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<A>
- <B fixedAttr="hello">howdy</B>
- <D>hey</D>
-</A>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/idIdref.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <A xsi:type="idType" idAttr="ONE"/>
- <A xsi:type="idType" idAttr="ONE"/>
- <A xsi:type="idrefType" idrefAttr="TWO"/>
-</A>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/idc.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<itemList>
- <item uniqueAttr="ONE">1</item>
- <item uniqueAttr="ONE">2</item>
- <item uniqueAttr="TWO">2</item>
- <itemRef>3</itemRef>
-</itemList>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/idc.xsd Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:element name="itemList" type="itemListType">
- <xsd:unique name="itemAttr">
- <xsd:selector xpath="item"/>
- <xsd:field xpath="@uniqueAttr"/>
- </xsd:unique>
-
- <xsd:key name="itemValueKey">
- <xsd:selector xpath="item"/>
- <xsd:field xpath="."/>
- </xsd:key>
-
- <xsd:keyref name="itemKeyRef" refer="itemValueKey">
- <xsd:selector xpath="itemRef"/>
- <xsd:field xpath="."/>
- </xsd:keyref>
- </xsd:element>
-
- <xsd:element name="item" type="itemType"/>
-
- <xsd:attribute name="uniqueAttr" type="xsd:string"/>
-
- <xsd:attribute name="unparsedEntityAttr" type="xsd:ENTITIES"/>
-
- <xsd:complexType name="itemListType">
- <xsd:sequence>
- <xsd:element ref="item" maxOccurs="unbounded"/>
- <xsd:element name="itemRef" type="xsd:string" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="itemType">
- <xsd:simpleContent>
- <xsd:extension base="xsd:string">
- <xsd:attribute ref="uniqueAttr" use="required"/>
- </xsd:extension>
- </xsd:simpleContent>
- </xsd:complexType>
-
-</xsd:schema>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/otherNamespace.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<unit:A xmlns:unit="xslt.unittests"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="xslt.unittests otherNamespace.xsd"
- attr="typeX">
-</unit:A>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/otherNamespace.xsd Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<xsd:schema
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:unit="xslt.unittests"
- targetNamespace="xslt.unittests">
-
- <xsd:import schemaLocation="base.xsd"/>
-
- <xsd:element name="A" type="unit:W"/>
-
- <xsd:complexType name="W">
- <xsd:sequence>
- <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute ref="attr"/>
- <xsd:attribute ref="unparsedEntityAttr"/>
- </xsd:complexType>
-
-</xsd:schema>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/unparsedEntity.dtd Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<!NOTATION myNotation SYSTEM "somethingElse" >
-<!ENTITY myUnparsedEntity SYSTEM "something" NDATA myNotation >
-
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/unparsedEntity.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE personnel SYSTEM "unparsedEntity.dtd">
-<A attr="blah" unparsedEntityAttr="myUnparsedEntity">
-</A>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/xsitype_A_A.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<A attr="typeY"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="Y">
- <A attr="typeY" xsi:type="Y"/>
-</A>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/xsitype_A_C.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<A attr="typeY"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="Y">
- <C attr="typeY" xsi:type="Y"/>
-</A>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/xsitype_C_A.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<C attr="typeY"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="Y">
- <A attr="typeY" xsi:type="Y"/>
-</C>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/xsitype_C_AC.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<C attr="typeY"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="Y">
- <A attr="typeY" xsi:type="Y"/>
- <C attr="typeY" xsi:type="Y"/>
-</C>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/xsitype_C_C.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<C attr="typeY"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="Y">
- <C attr="typeY" xsi:type="Y"/>
-</C>
--- a/jdk/test/javax/xml/jaxp/testng/validation/8037819/xsitype_C_CA.xml Mon Oct 13 18:16:29 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<C attr="typeY"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:type="Y">
- <C attr="typeY" xsi:type="Y"/>
- <A attr="typeY" xsi:type="Y"/>
-</C>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/BaseTest.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,326 @@
+package validation;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.net.URL;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar;
+import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import com.sun.org.apache.xerces.internal.xs.XSElementDeclaration;
+import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
+import java.security.Policy;
+import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+public abstract class BaseTest {
+ protected final static String ROOT_TYPE = Constants.XERCES_PROPERTY_PREFIX
+ + Constants.ROOT_TYPE_DEFINITION_PROPERTY;
+
+ protected final static String IGNORE_XSI_TYPE = Constants.XERCES_FEATURE_PREFIX
+ + Constants.IGNORE_XSI_TYPE_FEATURE;
+
+ protected final static String ID_IDREF_CHECKING = Constants.XERCES_FEATURE_PREFIX
+ + Constants.ID_IDREF_CHECKING_FEATURE;
+
+ protected final static String IDC_CHECKING = Constants.XERCES_FEATURE_PREFIX
+ + Constants.IDC_CHECKING_FEATURE;
+
+ protected final static String UNPARSED_ENTITY_CHECKING = Constants.XERCES_FEATURE_PREFIX
+ + Constants.UNPARSED_ENTITY_CHECKING_FEATURE;
+
+ protected final static String USE_GRAMMAR_POOL_ONLY = Constants.XERCES_FEATURE_PREFIX
+ + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
+
+ protected final static String DYNAMIC_VALIDATION = Constants.XERCES_FEATURE_PREFIX
+ + Constants.DYNAMIC_VALIDATION_FEATURE;
+
+ protected final static String DOCUMENT_CLASS_NAME = Constants.XERCES_PROPERTY_PREFIX
+ + Constants.DOCUMENT_CLASS_NAME_PROPERTY;
+
+ public static boolean isWindows = false;
+ static {
+ if (System.getProperty("os.name").indexOf("Windows")>-1) {
+ isWindows = true;
+ }
+ };
+
+ protected Schema schema;
+ protected Validator fValidator;
+
+ protected SpecialCaseErrorHandler fErrorHandler;
+
+ protected DocumentBuilder builder;
+ protected Document fDocument;
+
+ protected ElementPSVI fRootNode;
+ protected URL fDocumentURL;
+ protected URL fSchemaURL;
+
+ static String errMessage;
+
+ int passed = 0, failed = 0;
+ private boolean hasSM;
+ private Policy orig;
+
+ protected abstract String getSchemaFile();
+
+ protected abstract String getXMLDocument();
+
+ public BaseTest(String name) {
+ fErrorHandler = new SpecialCaseErrorHandler(getRelevantErrorIDs());
+ }
+
+ protected void setUp() throws Exception {
+ if (System.getSecurityManager() != null) {
+ hasSM = true;
+ System.setSecurityManager(null);
+ }
+
+ orig = Policy.getPolicy();
+
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory
+ .newInstance();
+ docFactory.setAttribute(DOCUMENT_CLASS_NAME,
+ "com.sun.org.apache.xerces.internal.dom.PSVIDocumentImpl");
+ docFactory.setNamespaceAware(true);
+ builder = docFactory.newDocumentBuilder();
+ // build the location URL of the document
+ String filepath = System.getProperty("test.src", ".");
+ String packageDir = this.getClass().getPackage().getName().replace('.',
+ '/');
+ String documentPath = filepath + "/" + packageDir + "/" + getXMLDocument();
+ String schemaPath = filepath + "/" + packageDir + "/" + getSchemaFile();
+
+ if (isWindows) {
+ fDocumentURL = new URL("file:/" + documentPath);
+ fSchemaURL = new URL("file:/" + schemaPath);
+ } else {
+ fDocumentURL = new URL("file:" + documentPath);
+ fSchemaURL = new URL("file:" + schemaPath);
+ }
+ if (fDocumentURL == null) {
+ throw new FileNotFoundException("Couldn't find xml file for test: " + documentPath);
+ }
+
+ SchemaFactory sf = SchemaFactory
+ .newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ sf.setFeature(USE_GRAMMAR_POOL_ONLY, getUseGrammarPoolOnly());
+
+ if (fSchemaURL == null) {
+ throw new FileNotFoundException("Couldn't find schema file for test: " + schemaPath);
+ }
+ schema = sf.newSchema(fSchemaURL);
+
+// String schemaPath = "./jaxp-ri/src/unit-test/apache/xerces/jdk8037819/" + getSchemaFile();
+// Schema schema = sf.newSchema(new StreamSource(new File(schemaPath)));
+ }
+
+ protected void tearDown() throws Exception {
+ System.setSecurityManager(null);
+ Policy.setPolicy(orig);
+ if (hasSM) {
+ System.setSecurityManager(new SecurityManager());
+ }
+
+ builder = null;
+ schema = null;
+ fRootNode = null;
+ fErrorHandler.reset();
+ System.out.println("\nNumber of tests passed: " + passed);
+ System.out.println("Number of tests failed: " + failed + "\n");
+
+ if (errMessage != null) {
+ throw new RuntimeException(errMessage);
+ }
+ }
+
+ protected void validateDocument() throws Exception {
+ Source source = new DOMSource(fDocument);
+ source.setSystemId(fDocumentURL.toExternalForm());
+ Result result = new DOMResult(fDocument);
+
+ fValidator.validate(source, result);
+ }
+
+ protected void validateFragment() throws Exception {
+ Source source = new DOMSource((Node) fRootNode);
+ source.setSystemId(fDocumentURL.toExternalForm());
+ Result result = new DOMResult((Node) fRootNode);
+ fValidator.validate(source, result);
+ }
+
+ protected void reset() throws Exception {
+// fDocument = builder.parse(new File("./jaxp-ri/src/unit-test/apache/xerces/jdk8037819/" + getXMLDocument()));
+ fDocument = builder.parse(fDocumentURL.toExternalForm());
+ fRootNode = (ElementPSVI) fDocument.getDocumentElement();
+ fValidator = schema.newValidator();
+ fErrorHandler.reset();
+ fValidator.setErrorHandler(fErrorHandler);
+ fValidator.setFeature(DYNAMIC_VALIDATION, false);
+ }
+
+ protected PSVIElementNSImpl getChild(int n) {
+ int numFound = 0;
+ Node child = ((Node) fRootNode).getFirstChild();
+ while (child != null) {
+ if (child.getNodeType() == Node.ELEMENT_NODE) {
+ numFound++;
+ if (numFound == n) {
+ return (PSVIElementNSImpl) child;
+ }
+ }
+ child = child.getNextSibling();
+ }
+ return null;
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] {};
+ }
+
+ protected boolean getUseGrammarPoolOnly() {
+ return false;
+ }
+
+ // specialized asserts
+
+ protected void assertValidity(short expectedValidity, short actualValidity) {
+ String expectedString = expectedValidity == ItemPSVI.VALIDITY_VALID ? "valid"
+ : (expectedValidity == ItemPSVI.VALIDITY_INVALID ? "invalid"
+ : "notKnown");
+ String actualString = actualValidity == ItemPSVI.VALIDITY_VALID ? "valid"
+ : (actualValidity == ItemPSVI.VALIDITY_INVALID ? "invalid"
+ : "notKnown");
+ String message = "{validity} was <" + actualString
+ + "> but it should have been <" + expectedString + ">";
+ assertEquals(message, expectedValidity, actualValidity);
+ }
+
+ protected void assertValidationAttempted(short expectedAttempted,
+ short actualAttempted) {
+ String expectedString = expectedAttempted == ItemPSVI.VALIDATION_FULL ? "full"
+ : (expectedAttempted == ItemPSVI.VALIDATION_PARTIAL ? "partial"
+ : "none");
+ String actualString = actualAttempted == ItemPSVI.VALIDATION_FULL ? "full"
+ : (actualAttempted == ItemPSVI.VALIDATION_PARTIAL ? "partial"
+ : "none");
+ String message = "{validity} was <" + actualString
+ + "> but it should have been <" + expectedString + ">";
+ assertEquals(message, expectedAttempted, actualAttempted);
+ }
+
+ protected void assertElementName(String expectedName, String actualName) {
+ assertEquals("Local name of element declaration is wrong.",
+ expectedName, actualName);
+ }
+
+ protected void assertElementNull(XSElementDeclaration elem) {
+ assertNull("Element declaration should be null.", elem);
+ }
+
+ protected void assertElementNamespace(String expectedName, String actualName) {
+ assertEquals("Namespace of element declaration is wrong.",
+ expectedName, actualName);
+ }
+
+ protected void assertElementNamespaceNull(String actualName) {
+ assertNull("Local name of element declaration should be null.",
+ actualName);
+ }
+
+ protected void assertTypeName(String expectedName, String actualName) {
+ assertEquals("Local name of type definition is wrong.", expectedName,
+ actualName);
+ }
+
+ protected void assertTypeNull(XSTypeDefinition type) {
+ assertNull("Type definition should be null.", type);
+ }
+
+ protected void assertTypeNamespace(String expectedName, String actualName) {
+ assertEquals("Namespace of type definition is wrong.", expectedName,
+ actualName);
+ }
+
+ protected void assertTypeNamespaceNull(String actualName) {
+ assertNull("Namespace of type definition should be null.", actualName);
+ }
+
+ protected void assertError(String error) {
+ assertTrue("Error <" + error + "> should have occured, but did not.",
+ fErrorHandler.specialCaseFound(error));
+ }
+
+ protected void assertNoError(String error) {
+ assertFalse("Error <" + error
+ + "> should not have occured (but it did)", fErrorHandler
+ .specialCaseFound(error));
+ }
+
+ protected void assertAnyType(XSTypeDefinition type) {
+ assertEquals("Type is supposed to be anyType", SchemaGrammar.fAnyType,
+ type);
+ }
+
+ void assertEquals(String msg, Object expected, Object actual) {
+ if (!expected.equals(actual)) {
+ fail(msg + " Expected: " + expected + " Actual: " + actual);
+ } else {
+ success(null);
+ }
+ }
+ void assertNull(String msg, Object value) {
+ if (value != null) {
+ fail(msg);
+ } else {
+ success(null);
+ }
+ }
+ public void assertTrue(String msg, boolean value) {
+ if (!value) {
+ fail(msg);
+ } else {
+ success(null);
+ }
+ }
+ public void assertFalse(String msg, boolean value) {
+ if (value) {
+ fail(msg);
+ } else {
+ success(null);
+ }
+ }
+ public void fail(String errMsg) {
+ if (errMessage == null) {
+ errMessage = errMsg;
+ } else {
+ errMessage = errMessage + "\n" + errMsg;
+ }
+ failed++;
+ }
+
+ public void success(String msg) {
+ passed++;
+ if (msg != null) {
+ if (msg.length() != 0) {
+ System.out.println(msg);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/SpecialCaseErrorHandler.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,54 @@
+package validation;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class SpecialCaseErrorHandler implements ErrorHandler {
+ public static final boolean DEBUG = false;
+
+ private HashMap errors;
+
+ public SpecialCaseErrorHandler(String[] specialCases) {
+ errors = new HashMap();
+ for (int i = 0; i < specialCases.length; ++i) {
+ errors.put(specialCases[i], Boolean.FALSE);
+ }
+ }
+
+ public void reset() {
+ for (Iterator iter = errors.keySet().iterator(); iter.hasNext();) {
+ String error = (String) iter.next();
+ errors.put(error, Boolean.FALSE);
+ }
+ }
+
+ public void warning(SAXParseException arg0) throws SAXException {
+ if (DEBUG) {
+ System.err.println(arg0.getMessage());
+ }
+ }
+
+ public void error(SAXParseException arg0) throws SAXException {
+ if (DEBUG) {
+ System.err.println(arg0.getMessage());
+ }
+ for (Iterator iter = errors.keySet().iterator(); iter.hasNext();) {
+ String error = (String) iter.next();
+ if (arg0.getMessage().startsWith(error)) {
+ errors.put(error, Boolean.TRUE);
+ }
+ }
+ }
+
+ public void fatalError(SAXParseException arg0) throws SAXException {
+ throw arg0;
+ }
+
+ public boolean specialCaseFound(String key) {
+ return ((Boolean) errors.get(key)).booleanValue();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/filelist Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,1 @@
+jdk8037819/BasicTest1.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/FeaturePropagationTest.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,196 @@
+/*
+ * 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 validation.jdk8036951;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.net.URL;
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import validation.BaseTest;
+
+/**
+ * @author Peter McCracken, IBM
+ * @version $Id$
+ */
+public class FeaturePropagationTest extends BaseTest {
+
+ public final String FEATURE_STRING_DEFAULT_FALSE = "http://apache.org/xml/features/honour-all-schemaLocations";
+ public final String FEATURE_STRING_DEFAULT_TRUE = "http://apache.org/xml/features/validation/schema-full-checking";
+ public final String SECURITY_MANAGER = "http://apache.org/xml/properties/security-manager";
+
+ public FeaturePropagationTest(String name) {
+ super(name);
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testPropertyReset() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = makeSchema(factory, null);
+ Validator validator = schema.newValidator();
+ Object beforeReset = validator.getProperty(SECURITY_MANAGER);
+ validator.setProperty(SECURITY_MANAGER, null);
+ Object changed = validator.getProperty(SECURITY_MANAGER);
+ //for JDK, this is changed since by default the security manager is set
+ assertTrue("Property value should have changed after calling setProperty().", beforeReset != changed);
+ validator.reset();
+ Object afterReset = validator.getProperty(SECURITY_MANAGER);
+ assertTrue("Property value should be the same after calling reset()", beforeReset == afterReset);
+ }
+
+ @Test
+ public void testFeatureReset() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = makeSchema(factory, null);
+ Validator validator = schema.newValidator();
+ validator.setFeature(FEATURE_STRING_DEFAULT_TRUE, false);
+ validator.setFeature(FEATURE_STRING_DEFAULT_FALSE, true);
+ validator.reset();
+ boolean value = validator.getFeature(FEATURE_STRING_DEFAULT_TRUE);
+ assertTrue("After reset, value of feature on Validator should be true.", value);
+ value = validator.getFeature(FEATURE_STRING_DEFAULT_FALSE);
+ assertFalse("After reset, value of feature on Validator should be false.", value);
+ }
+
+ @Test
+ public void testSecureProcessingFeaturePropagationAndReset() throws Exception {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ boolean value;
+ value = factory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING);
+ //default is true for JDK
+ //assertFalse("Default value of feature on SchemaFactory should have been false.", value);
+ assertTrue("Default value of feature on SchemaFactory should have been false.", value);
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ Schema schema = makeSchema(factory, null);
+ Validator validator = schema.newValidator();
+ value = validator.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING);
+ assertTrue("Value of feature on Validator should have been true.", value);
+ validator.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+ value = validator.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING);
+ assertFalse("Value of feature on Validator should have been false.", value);
+ validator.reset();
+ value = validator.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING);
+ assertTrue("After reset, value of feature on Validator should be true.", value);
+ }
+ /*
+ * Using four basically identical tests to try out the different
+ * instance classes of Schema. They shouldn't differ, because the relevant
+ * code is in a common base class.
+ */
+
+ @Test
+ public void testFeaturePropagationNull() throws Exception {
+ checkFeaturesOnValidator(null);
+ }
+
+ @Test
+ public void testFeaturePropagationEmpty() throws Exception {
+ checkFeaturesOnValidator(new Source[] {});
+ }
+
+ @Test
+ public void testFeaturePropagationSingle() throws Exception {
+ checkFeaturesOnValidator(new Source[] {makeSource("base.xsd")});
+ }
+
+ @Test
+ public void testFeaturePropagationMultiple() throws Exception {
+ checkFeaturesOnValidator(new Source[] {makeSource("base.xsd"), makeSource("idc.xsd")});
+ }
+
+ private void checkFeaturesOnValidator(Source[] sources) throws Exception {
+ try {
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema schema = makeSchema(factory, sources);
+ Validator validator = schema.newValidator();
+ boolean value;
+ value = validator.getFeature(FEATURE_STRING_DEFAULT_TRUE);
+ assertTrue("Default value of feature on Validator should have been true.", value);
+ value = validator.getFeature(FEATURE_STRING_DEFAULT_FALSE);
+ assertFalse("Default value of feature on Validator should have been false.", value);
+
+ // checking that the value propagates to the validator
+ factory.setFeature(FEATURE_STRING_DEFAULT_TRUE, false);
+ factory.setFeature(FEATURE_STRING_DEFAULT_FALSE, true);
+ schema = makeSchema(factory, sources);
+ validator = schema.newValidator();
+ value = validator.getFeature(FEATURE_STRING_DEFAULT_TRUE);
+ assertFalse("Value of feature on Validator should have been false.", value);
+ value = validator.getFeature(FEATURE_STRING_DEFAULT_FALSE);
+ assertTrue("Value of feature on Validator should have been true.", value);
+
+ // checking that the validator contains a copy of the features, not a reference
+ factory.setFeature(FEATURE_STRING_DEFAULT_TRUE, true);
+ factory.setFeature(FEATURE_STRING_DEFAULT_FALSE, false);
+ value = validator.getFeature(FEATURE_STRING_DEFAULT_TRUE);
+ assertFalse("Value of feature on Validator should have stayed false.", value);
+ value = validator.getFeature(FEATURE_STRING_DEFAULT_FALSE);
+ assertTrue("Value of feature on Validator should have stayed true.", value);
+ }
+ catch (SAXNotRecognizedException e) {
+ fail(e.getMessage());
+ }
+ catch (SAXNotSupportedException e) {
+ fail(e.getMessage());
+ }
+ }
+
+ private Schema makeSchema(SchemaFactory factory, Source[] sources) throws SAXException {
+ if (sources == null) {
+ return factory.newSchema();
+ }
+ else {
+ return factory.newSchema(sources);
+ }
+ }
+
+ private Source makeSource(String xsd) throws FileNotFoundException {
+ return new StreamSource(fSchemaURL.toExternalForm());
+ }
+
+ @Override
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ @Override
+ protected String getXMLDocument() {
+ //not needed
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/RootSimpleTypeDefinitionTest.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,118 @@
+/*
+ * 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 validation.jdk8036951;
+
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import validation.BaseTest;
+
+/**
+ * @author Peter McCracken, IBM
+ * @version $Id$
+ */
+public class RootSimpleTypeDefinitionTest extends BaseTest {
+
+ private QName typeString;
+ private QName typeNonNegInt;
+
+ private final static String INVALID_TYPE_ERROR = "cvc-type.3.1.3";
+ private final static String MININCLUSIVE_DERIVATION_ERROR = "cvc-minInclusive-valid";
+
+ protected String getXMLDocument() {
+ return "simpleType.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] { INVALID_TYPE_ERROR, MININCLUSIVE_DERIVATION_ERROR };
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public RootSimpleTypeDefinitionTest(String name) {
+ super(name);
+ // This is a roundabout way of making sure that we're not using an
+ // interned string (so that == doesn't work)
+ String ns = "x" + XMLConstants.W3C_XML_SCHEMA_NS_URI;
+ ns = ns.substring(1);
+ typeString = new QName(ns, "string", "xsd");
+ typeNonNegInt = new QName(ns, "nonNegativeInteger", "xsd");
+ }
+
+ @Test
+ public void testSettingSimpleType() throws Exception {
+ try {
+ reset();
+ fValidator.setProperty(ROOT_TYPE, typeString);
+ } catch (SAXException e1) {
+ fail("Problem setting property: " + e1.getMessage());
+ }
+
+ try {
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("string", fRootNode.getTypeDefinition().getName());
+ }
+
+ @Test
+ public void testSettingInvalidSimpleType() throws Exception {
+ try {
+ reset();
+ fValidator.setProperty(ROOT_TYPE, typeNonNegInt);
+ } catch (SAXException e1) {
+ fail("Problem setting property: " + e1.getMessage());
+ }
+
+ try {
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertError(INVALID_TYPE_ERROR);
+ assertError(MININCLUSIVE_DERIVATION_ERROR);
+ assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("nonNegativeInteger", fRootNode.getTypeDefinition().getName());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/RootTypeDefinitionTest.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,114 @@
+/*
+ * 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 validation.jdk8036951;
+
+
+import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.SchemaFactory;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import validation.BaseTest;
+
+/**
+ * @author Peter McCracken, IBM
+ * @version $Id$
+ */
+public class RootTypeDefinitionTest extends BaseTest {
+
+ private QName unknownType;
+ private QName typeX;
+ private QName typeY;
+ private QName typeZ;
+ private QName typeOtherNamespace;
+
+ private final static String UNKNOWN_TYPE_ERROR = "cvc-type.1";
+
+ private final static String INVALID_DERIVATION_ERROR = "cvc-elt.4.3";
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ protected String getXMLDocument() {
+ return "base.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] { UNKNOWN_TYPE_ERROR, INVALID_DERIVATION_ERROR };
+ }
+
+ public RootTypeDefinitionTest(String name) {
+ super(name);
+ unknownType = new QName("W");
+ typeX = new QName("X");
+ typeY = new QName("Y");
+ typeZ = new QName("Z");
+ typeOtherNamespace = new QName("xslt.unittests", "W", "unit");
+ }
+
+
+ /**
+ * XERCESJ-1141 root-type-definition property not read by XMLSchemaValidator during reset()
+ */
+ @Test
+ public void testUsingDocumentBuilderFactory() throws Exception {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setAttribute(ROOT_TYPE, typeX);
+ dbf.setAttribute(DOCUMENT_CLASS_NAME,"com.sun.org.apache.xerces.internal.dom.PSVIDocumentImpl");
+ dbf.setNamespaceAware(true);
+ dbf.setValidating(false);
+
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ dbf.setSchema(sf.newSchema(fSchemaURL));
+
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document document = db.parse(fDocumentURL.toExternalForm());
+ ElementPSVI rootNode = (ElementPSVI) document.getDocumentElement();
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, rootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, rootNode
+ .getValidationAttempted());
+ assertElementNull(rootNode.getElementDeclaration());
+ assertTypeName("X", rootNode.getTypeDefinition().getName());
+ }
+
+ private void checkDefault() {
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertTypeName("X", fRootNode.getTypeDefinition().getName());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/Xerces1128doc1Test.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,95 @@
+/*
+ * 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 validation.jdk8036951;
+
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class Xerces1128doc1Test extends BaseTest {
+
+ private final static String UNKNOWN_TYPE_ERROR = "cvc-type.1";
+
+ private final static String INVALID_DERIVATION_ERROR = "cvc-elt.4.3";
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ protected String getXMLDocument() {
+ return "xerces1128_1.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "xerces1128.xsd";
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] { UNKNOWN_TYPE_ERROR, INVALID_DERIVATION_ERROR };
+ }
+
+ public Xerces1128doc1Test(String name) {
+ super(name);
+ }
+
+
+ /**
+ * XERCESJ-1128 values for {validation attempted} property in PSVI
+ */
+ @Test
+ public void testDocument1() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkResult();
+ }
+
+ private void checkResult() {
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertTypeName("anyType", child.getTypeDefinition().getName());
+ assertTypeNamespace("http://www.w3.org/2001/XMLSchema",
+ child.getTypeDefinition().getNamespace());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertTypeName("X", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/Xerces1128doc2Test.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,96 @@
+/*
+ * 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 validation.jdk8036951;
+
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class Xerces1128doc2Test extends BaseTest {
+
+ private final static String UNKNOWN_TYPE_ERROR = "cvc-type.1";
+
+ private final static String INVALID_DERIVATION_ERROR = "cvc-elt.4.3";
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ protected String getXMLDocument() {
+ return "xerces1128_2.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "xerces1128.xsd";
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] { UNKNOWN_TYPE_ERROR, INVALID_DERIVATION_ERROR };
+ }
+
+ public Xerces1128doc2Test(String name) {
+ super(name);
+ }
+
+
+ /**
+ * XERCESJ-1128 values for {validation attempted} property in PSVI
+ */
+ @Test
+ public void testDocument1() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkResult();
+ }
+
+ private void checkResult() {
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertTypeName("X", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertTypeName("anyType", child.getTypeDefinition().getName());
+ assertTypeNamespace("http://www.w3.org/2001/XMLSchema",
+ child.getTypeDefinition().getNamespace());
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/base.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<A attr="typeX">
+</A>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/base.xsd Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,74 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="A" type="X"/>
+
+ <!-- The purpose of this element is:
+ a) To have a fixed attribute use
+ b) To have an attribute with a fixed attribute declaration
+ c) To have a complex type with simple content and a fixed value
+ d) To have an element declaration with a fixed value
+ -->
+ <xsd:element name="B" fixed="howdy">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="fixedAttr" use="required" fixed="hello"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="D" type="xsd:string" fixed="hey"/>
+
+ <xsd:attribute name="attr" type="xsd:string"/>
+
+ <xsd:attribute name="unparsedEntityAttr" type="xsd:ENTITIES"/>
+
+ <xsd:attribute name="fixedAttr" type="xsd:string" fixed="hello"/>
+
+ <xsd:complexType name="X">
+ <xsd:sequence>
+ <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute ref="attr"/>
+ <xsd:attribute ref="unparsedEntityAttr"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="Y">
+ <xsd:complexContent>
+ <xsd:restriction base="X">
+ <xsd:sequence>
+ <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute ref="attr" fixed="typeY"/>
+ <xsd:attribute ref="unparsedEntityAttr" use="prohibited"/>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <!-- Z is the same as X, but is not derived from X. -->
+ <xsd:complexType name="Z">
+ <xsd:sequence>
+ <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute ref="attr"/>
+ <xsd:attribute ref="unparsedEntityAttr"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="idType">
+ <xsd:complexContent>
+ <xsd:extension base="X">
+ <xsd:attribute name="idAttr" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="idrefType">
+ <xsd:complexContent>
+ <xsd:extension base="X">
+ <xsd:attribute name="idrefAttr" type="xsd:IDREF"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/idc.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<itemList>
+ <item uniqueAttr="ONE">1</item>
+ <item uniqueAttr="ONE">2</item>
+ <item uniqueAttr="TWO">2</item>
+ <itemRef>3</itemRef>
+</itemList>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/idc.xsd Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,41 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="itemList" type="itemListType">
+ <xsd:unique name="itemAttr">
+ <xsd:selector xpath="item"/>
+ <xsd:field xpath="@uniqueAttr"/>
+ </xsd:unique>
+
+ <xsd:key name="itemValueKey">
+ <xsd:selector xpath="item"/>
+ <xsd:field xpath="."/>
+ </xsd:key>
+
+ <xsd:keyref name="itemKeyRef" refer="itemValueKey">
+ <xsd:selector xpath="itemRef"/>
+ <xsd:field xpath="."/>
+ </xsd:keyref>
+ </xsd:element>
+
+ <xsd:element name="item" type="itemType"/>
+
+ <xsd:attribute name="uniqueAttr" type="xsd:string"/>
+
+ <xsd:attribute name="unparsedEntityAttr" type="xsd:ENTITIES"/>
+
+ <xsd:complexType name="itemListType">
+ <xsd:sequence>
+ <xsd:element ref="item" maxOccurs="unbounded"/>
+ <xsd:element name="itemRef" type="xsd:string" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="itemType">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="uniqueAttr" use="required"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/simpleType.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<S>-12345</S>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/xerces1128.xsd Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,6 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<xsd:complexType name="X">
+<xsd:sequence>
+</xsd:sequence>
+</xsd:complexType>
+</xsd:schema>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/xerces1128_1.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<B />
+<C xsi:type="X" />
+</A>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8036951/xerces1128_2.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<B xsi:type="X" />
+<C />
+</A>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/BasicTest.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,85 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class BasicTest extends BaseTest {
+
+ protected String getXMLDocument() {
+ return "base.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ public BasicTest(String name) {
+ super(name);
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testSimpleValidation() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+ doValidityAsserts();
+ }
+
+ @Test
+ public void testSimpleValidationWithTrivialXSIType() {
+ try {
+ reset();
+ ((PSVIElementNSImpl) fRootNode).setAttributeNS(
+ "http://www.w3.org/2001/XMLSchema-instance", "type", "X");
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+ doValidityAsserts();
+ }
+
+ private void doValidityAsserts() {
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertElementNamespaceNull(fRootNode.getElementDeclaration()
+ .getNamespace());
+ assertTypeName("X", fRootNode.getTypeDefinition().getName());
+ assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/BasicTest1.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,68 @@
+package validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import validation.BaseTest;
+
+public class BasicTest1 extends BaseTest {
+ public static void main(String[] args) throws Exception {
+ BasicTest1 test = new BasicTest1();
+ test.setUp();
+ test.testSimpleValidation();
+ test.testSimpleValidationWithTrivialXSIType();
+ test.tearDown();
+ }
+
+ protected String getXMLDocument() {
+ return "base.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ public BasicTest1() {
+ super("BasicTest1");
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testSimpleValidation() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+ doValidityAsserts();
+ }
+
+ public void testSimpleValidationWithTrivialXSIType() {
+ try {
+ reset();
+ ((PSVIElementNSImpl) fRootNode).setAttributeNS(
+ "http://www.w3.org/2001/XMLSchema-instance", "type", "X");
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+ doValidityAsserts();
+ }
+
+ private void doValidityAsserts() {
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertElementNamespaceNull(fRootNode.getElementDeclaration()
+ .getNamespace());
+ assertTypeName("X", fRootNode.getTypeDefinition().getName());
+ assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/FixedAttrTest.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,83 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+/**
+ * The purpose of this test is to execute all of the isComparable calls in
+ * XMLSchemaValidator. There are two calls in processElementContent and two
+ * calls in processOneAttribute.
+ *
+ * @author peterjm
+ */
+public class FixedAttrTest extends BaseTest {
+
+ protected String getXMLDocument() {
+ return "fixedAttr.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ public FixedAttrTest(String name) {
+ super(name);
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefault() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("B", child.getElementDeclaration().getName());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("D", child.getElementDeclaration().getName());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/IdIdrefCheckingTest.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,162 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.xml.sax.SAXException;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+// duplicate IDs
+// reference to non-existent ID
+
+public class IdIdrefCheckingTest extends BaseTest {
+ public static final String DUPLICATE_ID = "cvc-id.2";
+
+ public static final String NO_ID_BINDING = "cvc-id.1";
+
+ protected String getXMLDocument() {
+ return "idIdref.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] { DUPLICATE_ID, NO_ID_BINDING };
+ }
+
+ public IdIdrefCheckingTest(String name) {
+ super(name);
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefault() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkDefault();
+ }
+
+ @Test
+ public void testSetFalse() {
+ try {
+ reset();
+ fValidator.setFeature(ID_IDREF_CHECKING, false);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkValidResult();
+ }
+
+ @Test
+ public void testSetTrue() {
+ try {
+ reset();
+ fValidator.setFeature(ID_IDREF_CHECKING, true);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkDefault();
+ }
+
+ private void checkDefault() {
+ assertError(DUPLICATE_ID);
+ assertError(NO_ID_BINDING);
+
+ assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertTypeName("X", fRootNode.getTypeDefinition().getName());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("idType", child.getTypeDefinition().getName());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_INVALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("idType", child.getTypeDefinition().getName());
+
+ child = super.getChild(3);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("idrefType", child.getTypeDefinition().getName());
+ }
+
+ private void checkValidResult() {
+ assertNoError(DUPLICATE_ID);
+ assertNoError(NO_ID_BINDING);
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertTypeName("X", fRootNode.getTypeDefinition().getName());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("idType", child.getTypeDefinition().getName());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("idType", child.getTypeDefinition().getName());
+
+ child = super.getChild(3);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("idrefType", child.getTypeDefinition().getName());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/IdentityConstraintCheckingTest.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,188 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.xml.sax.SAXException;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class IdentityConstraintCheckingTest extends BaseTest {
+ // These values are unstable, since they're not actually error keys, but
+ // simply
+ // the first part of the error message.
+ public static final String DUPLICATE_UNIQUE = "cvc-identity-constraint.4.1";
+
+ public static final String DUPLICATE_KEY = "cvc-identity-constraint.4.2.2";
+
+ public static final String INVALID_KEYREF = "cvc-identity-constraint.4.3";
+
+ protected String getXMLDocument() {
+ return "idc.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "idc.xsd";
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] { DUPLICATE_UNIQUE, DUPLICATE_KEY, INVALID_KEYREF };
+ }
+
+ public IdentityConstraintCheckingTest(String name) {
+ super(name);
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefault() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkDefault();
+ }
+
+ @Test
+ public void testSetFalse() {
+ try {
+ reset();
+ fValidator.setFeature(IDC_CHECKING, false);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkValidResult();
+ }
+
+ @Test
+ public void testSetTrue() {
+ try {
+ reset();
+ fValidator.setFeature(IDC_CHECKING, true);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkDefault();
+ }
+
+ private void checkDefault() {
+ assertError(DUPLICATE_UNIQUE);
+ assertError(DUPLICATE_KEY);
+ assertError(INVALID_KEYREF);
+
+ assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("itemList", fRootNode.getElementDeclaration()
+ .getName());
+ assertTypeName("itemListType", fRootNode.getTypeDefinition().getName());
+
+ // this one is valid because it's the first one to define the unique
+ // value
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("item", child.getElementDeclaration().getName());
+ assertTypeName("itemType", child.getTypeDefinition().getName());
+
+ // invalid because it repeats the unique value
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_INVALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("item", child.getElementDeclaration().getName());
+ assertTypeName("itemType", child.getTypeDefinition().getName());
+
+ // invalid because it repeats the key
+ child = super.getChild(3);
+ assertValidity(ItemPSVI.VALIDITY_INVALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("item", child.getElementDeclaration().getName());
+ assertTypeName("itemType", child.getTypeDefinition().getName());
+
+ // valid because key references aren't figured out until the validation
+ // root
+ child = super.getChild(4);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("itemRef", child.getElementDeclaration().getName());
+ assertTypeName("string", child.getTypeDefinition().getName());
+ }
+
+ private void checkValidResult() {
+ assertNoError(DUPLICATE_UNIQUE);
+ assertNoError(DUPLICATE_KEY);
+ assertNoError(INVALID_KEYREF);
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("itemList", fRootNode.getElementDeclaration()
+ .getName());
+ assertTypeName("itemListType", fRootNode.getTypeDefinition().getName());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("item", child.getElementDeclaration().getName());
+ assertTypeName("itemType", child.getTypeDefinition().getName());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("item", child.getElementDeclaration().getName());
+ assertTypeName("itemType", child.getTypeDefinition().getName());
+
+ child = super.getChild(3);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("item", child.getElementDeclaration().getName());
+ assertTypeName("itemType", child.getTypeDefinition().getName());
+
+ child = super.getChild(4);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("itemRef", child.getElementDeclaration().getName());
+ assertTypeName("string", child.getTypeDefinition().getName());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/IgnoreXSITypeTest_A_A.java Mon Oct 13 14:11:20 2014 -0700
@@ -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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class IgnoreXSITypeTest_A_A extends BaseTest {
+
+ protected String getXMLDocument() {
+ return "xsitype_A_A.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ public IgnoreXSITypeTest_A_A(String name) {
+ super(name);
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefaultDocument() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testDefaultFragment() {
+ try {
+ reset();
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetTrueDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ @Test
+ public void testSetTrueFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ private void checkTrueResult() {
+ checkResult();
+ }
+
+ private void checkFalseResult() {
+ checkResult();
+ }
+
+ private void checkResult() {
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertTypeName("Y", fRootNode.getTypeDefinition().getName());
+ assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("Y", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/IgnoreXSITypeTest_A_C.java Mon Oct 13 14:11:20 2014 -0700
@@ -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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class IgnoreXSITypeTest_A_C extends BaseTest {
+
+ protected String getXMLDocument() {
+ return "xsitype_A_C.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ public IgnoreXSITypeTest_A_C(String name) {
+ super(name);
+ }
+
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefaultDocument() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testDefaultFragment() {
+ try {
+ reset();
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetTrueDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ @Test
+ public void testSetTrueFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ private void checkTrueResult() {
+ checkResult();
+ }
+
+ private void checkFalseResult() {
+ checkResult();
+ }
+
+ private void checkResult() {
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertTypeName("Y", fRootNode.getTypeDefinition().getName());
+ assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertTypeName("Y", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/IgnoreXSITypeTest_C_A.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,159 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class IgnoreXSITypeTest_C_A extends BaseTest {
+
+ protected String getXMLDocument() {
+ return "xsitype_C_A.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ public IgnoreXSITypeTest_C_A(String name) {
+ super(name);
+ }
+
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefaultDocument() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testDefaultFragment() {
+ try {
+ reset();
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetTrueDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ @Test
+ public void testSetTrueFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ private void checkTrueResult() {
+ assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_PARTIAL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertAnyType(fRootNode.getTypeDefinition());
+
+ checkChild();
+ }
+
+ private void checkFalseResult() {
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("Y", fRootNode.getTypeDefinition().getName());
+ assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
+
+ checkChild();
+ }
+
+ private void checkChild() {
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("Y", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/IgnoreXSITypeTest_C_AC.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,176 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class IgnoreXSITypeTest_C_AC extends BaseTest {
+
+ protected String getXMLDocument() {
+ return "xsitype_C_AC.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ public IgnoreXSITypeTest_C_AC(String name) {
+ super(name);
+ }
+
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefaultDocument() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testDefaultFragment() {
+ try {
+ reset();
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetTrueDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ @Test
+ public void testSetTrueFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ private void checkTrueResult() {
+ assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_PARTIAL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertAnyType(fRootNode.getTypeDefinition());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("Y", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertAnyType(child.getTypeDefinition());
+ }
+
+ private void checkFalseResult() {
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("Y", fRootNode.getTypeDefinition().getName());
+ assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("Y", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertTypeName("Y", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/IgnoreXSITypeTest_C_C.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,160 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class IgnoreXSITypeTest_C_C extends BaseTest {
+
+ protected String getXMLDocument() {
+ return "xsitype_C_C.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ public IgnoreXSITypeTest_C_C(String name) {
+ super(name);
+ }
+
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefaultDocument() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testDefaultFragment() {
+ try {
+ reset();
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetTrueDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ @Test
+ public void testSetTrueFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ private void checkTrueResult() {
+ assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_NONE, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertAnyType(fRootNode.getTypeDefinition());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertAnyType(child.getTypeDefinition());
+ }
+
+ private void checkFalseResult() {
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("Y", fRootNode.getTypeDefinition().getName());
+ assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertTypeName("Y", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/IgnoreXSITypeTest_C_CA.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,175 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class IgnoreXSITypeTest_C_CA extends BaseTest {
+
+ protected String getXMLDocument() {
+ return "xsitype_C_CA.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ public IgnoreXSITypeTest_C_CA(String name) {
+ super(name);
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefaultDocument() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testDefaultFragment() {
+ try {
+ reset();
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ // default value of the feature is false
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetFalseFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, false);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkFalseResult();
+ }
+
+ @Test
+ public void testSetTrueDocument() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ @Test
+ public void testSetTrueFragment() {
+ try {
+ reset();
+ fValidator.setFeature(IGNORE_XSI_TYPE, true);
+ validateFragment();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkTrueResult();
+ }
+
+ private void checkTrueResult() {
+ assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_PARTIAL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertAnyType(fRootNode.getTypeDefinition());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertAnyType(child.getTypeDefinition());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("Y", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+ }
+
+ private void checkFalseResult() {
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("Y", fRootNode.getTypeDefinition().getName());
+ assertTypeNamespaceNull(fRootNode.getTypeDefinition().getNamespace());
+
+ PSVIElementNSImpl child = super.getChild(1);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementNull(child.getElementDeclaration());
+ assertTypeName("Y", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+
+ child = super.getChild(2);
+ assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child
+ .getValidationAttempted());
+ assertElementName("A", child.getElementDeclaration().getName());
+ assertTypeName("Y", child.getTypeDefinition().getName());
+ assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/RootTypeDefinitionTest.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,237 @@
+/*
+ * 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 validation.jdk8037819;
+
+import javax.xml.namespace.QName;
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.impl.xs.SchemaSymbols;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class RootTypeDefinitionTest extends BaseTest {
+ private QName unknownType;
+
+ private QName typeX;
+
+ private QName typeY;
+
+ private QName typeZ;
+
+ private QName typeOtherNamespace;
+
+ private final static String UNKNOWN_TYPE_ERROR = "cvc-type.1";
+
+ private final static String INVALID_DERIVATION_ERROR = "cvc-elt.4.3";
+
+ protected String getXMLDocument() {
+ return "base.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] { UNKNOWN_TYPE_ERROR, INVALID_DERIVATION_ERROR };
+ }
+
+ public RootTypeDefinitionTest(String name) {
+ super(name);
+ unknownType = new QName("W");
+ typeX = new QName("X");
+ typeY = new QName("Y");
+ typeZ = new QName("Z");
+ typeOtherNamespace = new QName("xslt.unittests", "W", "unit");
+ }
+
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefault() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkDefault();
+ }
+
+ @Test
+ public void testSettingNull() {
+ try {
+ reset();
+ fValidator.setProperty(ROOT_TYPE, null);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkDefault();
+ }
+
+ @Test
+ public void testSettingToUnknownType() {
+ try {
+ reset();
+ fValidator.setProperty(ROOT_TYPE, unknownType);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertError(UNKNOWN_TYPE_ERROR);
+ checkDefault();
+ }
+
+ @Test
+ public void testSettingToEqualType() {
+ try {
+ reset();
+ fValidator.setProperty(ROOT_TYPE, typeX);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("X", fRootNode.getTypeDefinition().getName());
+ }
+
+ @Test
+ public void testSettingToDerivedType() {
+ try {
+ reset();
+ // this is required to make it a valid type Y node
+ ((PSVIElementNSImpl) fRootNode).setAttributeNS(null, "attr", "typeY");
+ fValidator.setProperty(ROOT_TYPE, typeY);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("Y", fRootNode.getTypeDefinition().getName());
+ }
+
+ @Test
+ public void testSettingToNonDerivedType() {
+ try {
+ reset();
+ fValidator.setProperty(ROOT_TYPE, typeZ);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("Z", fRootNode.getTypeDefinition().getName());
+ }
+
+ @Test
+ public void testSettingToOtherSchemaType() {
+ try {
+ reset();
+ ((PSVIElementNSImpl) fRootNode).setAttributeNS(SchemaSymbols.URI_XSI,
+ SchemaSymbols.XSI_SCHEMALOCATION,
+ "xslt.unittests otherNamespace.xsd");
+ fValidator.setProperty(ROOT_TYPE, typeOtherNamespace);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("W", fRootNode.getTypeDefinition().getName());
+ assertTypeNamespace("xslt.unittests", fRootNode.getTypeDefinition()
+ .getNamespace());
+ }
+
+ @Test
+ public void testSettingTypeAndXSIType() {
+ try {
+ reset();
+ // this is required to make it a valid type Y node
+ ((PSVIElementNSImpl) fRootNode).setAttributeNS(null, "attr", "typeY");
+ ((PSVIElementNSImpl) fRootNode).setAttributeNS(SchemaSymbols.URI_XSI,
+ SchemaSymbols.XSI_TYPE, "Y");
+ fValidator.setProperty(ROOT_TYPE, typeX);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("Y", fRootNode.getTypeDefinition().getName());
+ }
+
+ @Test
+ public void testSettingTypeAndInvalidXSIType() {
+ try {
+ reset();
+ ((PSVIElementNSImpl) fRootNode).setAttributeNS(SchemaSymbols.URI_XSI,
+ SchemaSymbols.XSI_TYPE, "Z");
+ fValidator.setProperty(ROOT_TYPE, typeX);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertError(INVALID_DERIVATION_ERROR);
+ assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertTypeName("Z", fRootNode.getTypeDefinition().getName());
+ }
+
+ private void checkDefault() {
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertTypeName("X", fRootNode.getTypeDefinition().getName());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/UnparsedEntityCheckingTest.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,154 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class UnparsedEntityCheckingTest extends BaseTest {
+ public static final String UNDECLARED_ENTITY = "UndeclaredEntity";
+
+ protected String getXMLDocument() {
+ return "unparsedEntity.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] { UNDECLARED_ENTITY };
+ }
+
+ public UnparsedEntityCheckingTest(String name) {
+ super(name);
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ @Test
+ public void testDefaultValid() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkDefault();
+ }
+
+ @Test
+ public void testSetFalseValid() {
+ try {
+ reset();
+ fValidator.setFeature(UNPARSED_ENTITY_CHECKING, false);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkDefault();
+ }
+
+ @Test
+ public void testSetTrueValid() {
+ try {
+ reset();
+ fValidator.setFeature(UNPARSED_ENTITY_CHECKING, true);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkDefault();
+ }
+
+ @Test
+ public void testDefaultInvalid() {
+ try {
+ reset();
+ ((PSVIElementNSImpl) fRootNode).setAttributeNS(null,
+ "unparsedEntityAttr", "invalid");
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkInvalid();
+ }
+
+ @Test
+ public void testSetFalseInvalid() {
+ try {
+ reset();
+ ((PSVIElementNSImpl) fRootNode).setAttributeNS(null,
+ "unparsedEntityAttr", "invalid");
+ fValidator.setFeature(UNPARSED_ENTITY_CHECKING, false);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkDefault();
+ }
+
+ @Test
+ public void testSetTrueInvalid() {
+ try {
+ reset();
+ ((PSVIElementNSImpl) fRootNode).setAttributeNS(null,
+ "unparsedEntityAttr", "invalid");
+ fValidator.setFeature(UNPARSED_ENTITY_CHECKING, true);
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ checkInvalid();
+ }
+
+ private void checkDefault() {
+ assertNoError(UNDECLARED_ENTITY);
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertTypeName("X", fRootNode.getTypeDefinition().getName());
+ }
+
+ private void checkInvalid() {
+ assertError(UNDECLARED_ENTITY);
+ assertValidity(ItemPSVI.VALIDITY_INVALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertTypeName("X", fRootNode.getTypeDefinition().getName());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/UseGrammarPoolOnlyTest_False.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,87 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class UseGrammarPoolOnlyTest_False extends BaseTest {
+ private final static String UNKNOWN_TYPE_ERROR = "cvc-type.1";
+
+ private final static String INVALID_DERIVATION_ERROR = "cvc-elt.4.3";
+
+ protected String getXMLDocument() {
+ return "otherNamespace.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ protected String[] getRelevantErrorIDs() {
+ return new String[] { UNKNOWN_TYPE_ERROR, INVALID_DERIVATION_ERROR };
+ }
+
+ protected boolean getUseGrammarPoolOnly() {
+ return false;
+ }
+
+ public UseGrammarPoolOnlyTest_False(String name) {
+ super(name);
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * The purpose of this test is to check if setting the USE_GRAMMAR_POOL_ONLY
+ * feature to true causes external schemas to not be read. This
+ * functionality already existed prior to adding the XSLT 2.0 validation
+ * features; however, because the class that controlled it changed, this
+ * test simply ensures that the existing functionality did not disappear.
+ * -PM
+ */
+ @Test
+ public void testUsingOnlyGrammarPool() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertValidity(ItemPSVI.VALIDITY_VALID, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_FULL, fRootNode
+ .getValidationAttempted());
+ assertElementName("A", fRootNode.getElementDeclaration().getName());
+ assertElementNamespace("xslt.unittests", fRootNode
+ .getElementDeclaration().getNamespace());
+ assertTypeName("W", fRootNode.getTypeDefinition().getName());
+ assertTypeNamespace("xslt.unittests", fRootNode.getTypeDefinition()
+ .getNamespace());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/UseGrammarPoolOnlyTest_True.java Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,76 @@
+/*
+ * 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 validation.jdk8037819;
+
+import com.sun.org.apache.xerces.internal.xs.ItemPSVI;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import validation.BaseTest;
+
+public class UseGrammarPoolOnlyTest_True extends BaseTest {
+
+ protected String getXMLDocument() {
+ return "otherNamespace.xml";
+ }
+
+ protected String getSchemaFile() {
+ return "base.xsd";
+ }
+
+ protected boolean getUseGrammarPoolOnly() {
+ return true;
+ }
+
+ public UseGrammarPoolOnlyTest_True(String name) {
+ super(name);
+ }
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * The purpose of this test is to check if setting the USE_GRAMMAR_POOL_ONLY
+ * feature to true causes external schemas to not be read. This
+ * functionality already existed prior to adding the XSLT 2.0 validation
+ * features; however, because the class that controlled it changed, this
+ * test simply ensures that the existing functionality did not disappear.
+ * -PM
+ */
+ @Test
+ public void testUsingOnlyGrammarPool() {
+ try {
+ reset();
+ validateDocument();
+ } catch (Exception e) {
+ fail("Validation failed: " + e.getMessage());
+ }
+
+ assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity());
+ assertValidationAttempted(ItemPSVI.VALIDATION_NONE, fRootNode
+ .getValidationAttempted());
+ assertElementNull(fRootNode.getElementDeclaration());
+ assertAnyType(fRootNode.getTypeDefinition());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/base.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<A attr="typeX">
+</A>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/base.xsd Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,74 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="A" type="X"/>
+
+ <!-- The purpose of this element is:
+ a) To have a fixed attribute use
+ b) To have an attribute with a fixed attribute declaration
+ c) To have a complex type with simple content and a fixed value
+ d) To have an element declaration with a fixed value
+ -->
+ <xsd:element name="B" fixed="howdy">
+ <xsd:complexType>
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="fixedAttr" use="required" fixed="hello"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="D" type="xsd:string" fixed="hey"/>
+
+ <xsd:attribute name="attr" type="xsd:string"/>
+
+ <xsd:attribute name="unparsedEntityAttr" type="xsd:ENTITIES"/>
+
+ <xsd:attribute name="fixedAttr" type="xsd:string" fixed="hello"/>
+
+ <xsd:complexType name="X">
+ <xsd:sequence>
+ <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute ref="attr"/>
+ <xsd:attribute ref="unparsedEntityAttr"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="Y">
+ <xsd:complexContent>
+ <xsd:restriction base="X">
+ <xsd:sequence>
+ <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute ref="attr" fixed="typeY"/>
+ <xsd:attribute ref="unparsedEntityAttr" use="prohibited"/>
+ </xsd:restriction>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <!-- Z is the same as X, but is not derived from X. -->
+ <xsd:complexType name="Z">
+ <xsd:sequence>
+ <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute ref="attr"/>
+ <xsd:attribute ref="unparsedEntityAttr"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="idType">
+ <xsd:complexContent>
+ <xsd:extension base="X">
+ <xsd:attribute name="idAttr" type="xsd:ID"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="idrefType">
+ <xsd:complexContent>
+ <xsd:extension base="X">
+ <xsd:attribute name="idrefAttr" type="xsd:IDREF"/>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+</xsd:schema>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/fixedAttr.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<A>
+ <B fixedAttr="hello">howdy</B>
+ <D>hey</D>
+</A>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/idIdref.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<A xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <A xsi:type="idType" idAttr="ONE"/>
+ <A xsi:type="idType" idAttr="ONE"/>
+ <A xsi:type="idrefType" idrefAttr="TWO"/>
+</A>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/idc.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<itemList>
+ <item uniqueAttr="ONE">1</item>
+ <item uniqueAttr="ONE">2</item>
+ <item uniqueAttr="TWO">2</item>
+ <itemRef>3</itemRef>
+</itemList>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/idc.xsd Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,41 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="itemList" type="itemListType">
+ <xsd:unique name="itemAttr">
+ <xsd:selector xpath="item"/>
+ <xsd:field xpath="@uniqueAttr"/>
+ </xsd:unique>
+
+ <xsd:key name="itemValueKey">
+ <xsd:selector xpath="item"/>
+ <xsd:field xpath="."/>
+ </xsd:key>
+
+ <xsd:keyref name="itemKeyRef" refer="itemValueKey">
+ <xsd:selector xpath="itemRef"/>
+ <xsd:field xpath="."/>
+ </xsd:keyref>
+ </xsd:element>
+
+ <xsd:element name="item" type="itemType"/>
+
+ <xsd:attribute name="uniqueAttr" type="xsd:string"/>
+
+ <xsd:attribute name="unparsedEntityAttr" type="xsd:ENTITIES"/>
+
+ <xsd:complexType name="itemListType">
+ <xsd:sequence>
+ <xsd:element ref="item" maxOccurs="unbounded"/>
+ <xsd:element name="itemRef" type="xsd:string" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="itemType">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute ref="uniqueAttr" use="required"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+ </xsd:complexType>
+
+</xsd:schema>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/otherNamespace.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<unit:A xmlns:unit="xslt.unittests"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="xslt.unittests otherNamespace.xsd"
+ attr="typeX">
+</unit:A>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/otherNamespace.xsd Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,18 @@
+<xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:unit="xslt.unittests"
+ targetNamespace="xslt.unittests">
+
+ <xsd:import schemaLocation="base.xsd"/>
+
+ <xsd:element name="A" type="unit:W"/>
+
+ <xsd:complexType name="W">
+ <xsd:sequence>
+ <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute ref="attr"/>
+ <xsd:attribute ref="unparsedEntityAttr"/>
+ </xsd:complexType>
+
+</xsd:schema>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/unparsedEntity.dtd Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,2 @@
+<!NOTATION myNotation SYSTEM "somethingElse" >
+<!ENTITY myUnparsedEntity SYSTEM "something" NDATA myNotation >
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/unparsedEntity.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<!DOCTYPE personnel SYSTEM "unparsedEntity.dtd">
+<A attr="blah" unparsedEntityAttr="myUnparsedEntity">
+</A>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/xsitype_A_A.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<A attr="typeY"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="Y">
+ <A attr="typeY" xsi:type="Y"/>
+</A>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/xsitype_A_C.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<A attr="typeY"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="Y">
+ <C attr="typeY" xsi:type="Y"/>
+</A>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/xsitype_C_A.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<C attr="typeY"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="Y">
+ <A attr="typeY" xsi:type="Y"/>
+</C>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/xsitype_C_AC.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<C attr="typeY"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="Y">
+ <A attr="typeY" xsi:type="Y"/>
+ <C attr="typeY" xsi:type="Y"/>
+</C>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/xsitype_C_C.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<C attr="typeY"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="Y">
+ <C attr="typeY" xsi:type="Y"/>
+</C>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/testng/validation/jdk8037819/xsitype_C_CA.xml Mon Oct 13 14:11:20 2014 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<C attr="typeY"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:type="Y">
+ <C attr="typeY" xsi:type="Y"/>
+ <A attr="typeY" xsi:type="Y"/>
+</C>