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 */ |
|
17 |
|
18 import com.sun.org.apache.xerces.internal.xs.ItemPSVI; |
|
19 import org.testng.annotations.AfterClass; |
|
20 import org.testng.annotations.BeforeClass; |
|
21 import org.testng.annotations.Test; |
|
22 |
|
23 public class UseGrammarPoolOnlyTest_True extends BaseTest { |
|
24 |
|
25 protected String getXMLDocument() { |
|
26 return "otherNamespace.xml"; |
|
27 } |
|
28 |
|
29 protected String getSchemaFile() { |
|
30 return "base.xsd"; |
|
31 } |
|
32 |
|
33 protected boolean getUseGrammarPoolOnly() { |
|
34 return true; |
|
35 } |
|
36 |
|
37 public UseGrammarPoolOnlyTest_True(String name) { |
|
38 super(name); |
|
39 } |
|
40 |
|
41 @BeforeClass |
|
42 protected void setUp() throws Exception { |
|
43 super.setUp(); |
|
44 } |
|
45 |
|
46 @AfterClass |
|
47 protected void tearDown() throws Exception { |
|
48 super.tearDown(); |
|
49 } |
|
50 |
|
51 /** |
|
52 * The purpose of this test is to check if setting the USE_GRAMMAR_POOL_ONLY |
|
53 * feature to true causes external schemas to not be read. This |
|
54 * functionality already existed prior to adding the XSLT 2.0 validation |
|
55 * features; however, because the class that controlled it changed, this |
|
56 * test simply ensures that the existing functionality did not disappear. |
|
57 * -PM |
|
58 */ |
|
59 @Test |
|
60 public void testUsingOnlyGrammarPool() { |
|
61 try { |
|
62 reset(); |
|
63 validateDocument(); |
|
64 } catch (Exception e) { |
|
65 fail("Validation failed: " + e.getMessage()); |
|
66 } |
|
67 |
|
68 assertValidity(ItemPSVI.VALIDITY_NOTKNOWN, fRootNode.getValidity()); |
|
69 assertValidationAttempted(ItemPSVI.VALIDATION_NONE, fRootNode |
|
70 .getValidationAttempted()); |
|
71 assertElementNull(fRootNode.getElementDeclaration()); |
|
72 assertAnyType(fRootNode.getTypeDefinition()); |
|
73 } |
|
74 } |
|