1/* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17package validation.jdk8037819; 18 19import com.sun.org.apache.xerces.internal.xs.ItemPSVI; 20import org.testng.annotations.AfterClass; 21import org.testng.annotations.BeforeClass; 22import org.testng.annotations.Test; 23import validation.BaseTest; 24 25public class UseGrammarPoolOnlyTest_True extends BaseTest { 26 27 protected String getXMLDocument() { 28 return "otherNamespace.xml"; 29 } 30 31 protected String getSchemaFile() { 32 return "base.xsd"; 33 } 34 35 protected boolean getUseGrammarPoolOnly() { 36 return true; 37 } 38 39 public UseGrammarPoolOnlyTest_True(String name) { 40 super(name); 41 } 42 43 @BeforeClass 44 protected void setUp() throws Exception { 45 super.setUp(); 46 } 47 48 @AfterClass 49 protected void tearDown() throws Exception { 50 super.tearDown(); 51 } 52 53 /** 54 * The purpose of this test is to check if setting the USE_GRAMMAR_POOL_ONLY 55 * feature to true causes external schemas to not be read. This 56 * functionality already existed prior to adding the XSLT 2.0 validation 57 * features; however, because the class that controlled it changed, this 58 * test simply ensures that the existing functionality did not disappear. 59 * -PM 60 */ 61 @Test 62 public void testUsingOnlyGrammarPool() { 63 try { 64 reset(); 65 validateDocument(); 66 } catch (Exception e) { 67 fail("Validation failed: " + e.getMessage()); 68 } 69 70 assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity()); 71 assertValidationAttempted(ItemPSVI.VALIDATION_NONE, fRootNode 72 .getValidationAttempted()); 73 assertElementNull(fRootNode.getElementDeclaration()); 74 assertAnyType(fRootNode.getTypeDefinition()); 75 } 76} 77