Path: blob/master/test/jdk/javax/xml/jaxp/testng/validation/jdk8036951/Xerces1128doc2Test.java
41159 views
/*1* Licensed to the Apache Software Foundation (ASF) under one or more2* contributor license agreements. See the NOTICE file distributed with3* this work for additional information regarding copyright ownership.4* The ASF licenses this file to You under the Apache License, Version 2.05* (the "License"); you may not use this file except in compliance with6* the License. You may obtain a copy of the License at7*8* http://www.apache.org/licenses/LICENSE-2.09*10* Unless required by applicable law or agreed to in writing, software11* distributed under the License is distributed on an "AS IS" BASIS,12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13* See the License for the specific language governing permissions and14* limitations under the License.15*/1617package validation.jdk8036951;181920import com.sun.org.apache.xerces.internal.dom.PSVIElementNSImpl;21import com.sun.org.apache.xerces.internal.xs.ItemPSVI;22import org.testng.annotations.AfterClass;23import org.testng.annotations.BeforeClass;24import org.testng.annotations.Test;25import validation.BaseTest;2627public class Xerces1128doc2Test extends BaseTest {2829private final static String UNKNOWN_TYPE_ERROR = "cvc-type.1";3031private final static String INVALID_DERIVATION_ERROR = "cvc-elt.4.3";3233@BeforeClass34protected void setUp() throws Exception {35super.setUp();36}3738@AfterClass39protected void tearDown() throws Exception {40super.tearDown();41}4243protected String getXMLDocument() {44return "xerces1128_2.xml";45}4647protected String getSchemaFile() {48return "xerces1128.xsd";49}5051protected String[] getRelevantErrorIDs() {52return new String[] { UNKNOWN_TYPE_ERROR, INVALID_DERIVATION_ERROR };53}5455public Xerces1128doc2Test(String name) {56super(name);57}585960/**61* XERCESJ-1128 values for {validation attempted} property in PSVI62*/63@Test64public void testDocument1() {65try {66reset();67validateDocument();68} catch (Exception e) {69fail("Validation failed: " + e.getMessage());70}7172// default value of the feature is false73checkResult();74}7576private void checkResult() {77PSVIElementNSImpl child = super.getChild(1);78assertValidity(ItemPSVI.VALIDITY_VALID, child.getValidity());79assertValidationAttempted(ItemPSVI.VALIDATION_FULL, child80.getValidationAttempted());81assertElementNull(child.getElementDeclaration());82assertTypeName("X", child.getTypeDefinition().getName());83assertTypeNamespaceNull(child.getTypeDefinition().getNamespace());8485child = super.getChild(2);86assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, child.getValidity());87assertValidationAttempted(ItemPSVI.VALIDATION_NONE, child88.getValidationAttempted());89assertElementNull(child.getElementDeclaration());90assertTypeName("anyType", child.getTypeDefinition().getName());91assertTypeNamespace("http://www.w3.org/2001/XMLSchema",92child.getTypeDefinition().getNamespace());9394}95}969798