|
22 | 22 | */
|
23 | 23 | package common.jdkcatalog;
|
24 | 24 |
|
| 25 | +import static jaxp.library.JAXPTestUtilities.SRC_DIR; |
| 26 | +import static jaxp.library.JAXPTestUtilities.isWindows; |
| 27 | + |
25 | 28 | import java.io.StringReader;
|
26 | 29 | import java.nio.file.Files;
|
27 | 30 | import java.nio.file.Path;
|
|
37 | 40 | import jdk.xml.internal.JdkCatalog;
|
38 | 41 | import org.testng.Assert;
|
39 | 42 | import org.testng.Assert.ThrowingRunnable;
|
40 |
| -import org.testng.annotations.BeforeClass; |
41 | 43 | import org.testng.annotations.DataProvider;
|
42 | 44 | import org.testng.annotations.Test;
|
43 | 45 | import org.xml.sax.InputSource;
|
|
49 | 51 | * @test
|
50 | 52 | * @bug 8344800 8345353 8351969
|
51 | 53 | * @modules java.xml/jdk.xml.internal
|
| 54 | + * @library /javax/xml/jaxp/libs |
52 | 55 | * @run testng/othervm common.jdkcatalog.JDKCatalogTest
|
53 | 56 | * @summary Verifies the W3C DTDs and XSDs in the JDK built-in catalog.
|
54 | 57 | */
|
55 | 58 | public class JDKCatalogTest {
|
56 |
| - static String CLS_DIR = System.getProperty("test.classes"); |
57 |
| - static String SRC_DIR = System.getProperty("test.src"); |
58 |
| - public static boolean isWindows = false; |
| 59 | + private static final String JDKCATALOG_RESOLVE = "jdk.xml.jdkcatalog.resolve"; |
| 60 | + private static final String PUBLIC_ID = "{{publicId}}"; |
| 61 | + private static final String SYSTEM_ID = "{{systemId}}"; |
| 62 | + private static final String XSD_LOCATION = "{{SCHEMA_LOCATION}}"; |
| 63 | + private static final String TARGET_NAMESPACE = "{{targetNamespace}}"; |
| 64 | + private static final String ROOT_ELEMENT = "{{rootElement}}"; |
| 65 | + private static final Catalog JDKCATALOG; |
59 | 66 | static {
|
60 |
| - if (System.getProperty("os.name").contains("Windows")) { |
61 |
| - isWindows = true; |
62 |
| - } |
63 |
| - }; |
64 |
| - public static final String JDKCATALOG_RESOLVE = "jdk.xml.jdkcatalog.resolve"; |
65 |
| - static final String PUBLIC_ID = "{{publicId}}"; |
66 |
| - static final String SYSTEM_ID = "{{systemId}}"; |
67 |
| - static final String XSD_LOCATION = "{{SCHEMA_LOCATION}}"; |
68 |
| - static final String TARGET_NAMESPACE = "{{targetNamespace}}"; |
69 |
| - static final String ROOT_ELEMENT = "{{rootElement}}"; |
70 |
| - |
71 |
| - Catalog jdkCatalog; |
| 67 | + JdkCatalog.init("continue"); |
| 68 | + JDKCATALOG = JdkCatalog.catalog; |
| 69 | + } |
72 | 70 |
|
73 | 71 | /*
|
74 | 72 | * DataProvider: DTDs in the JDK built-in Catalog
|
75 | 73 | * Data provided: public and system Ids, see test testDTDsInJDKCatalog
|
76 | 74 | */
|
77 | 75 | @DataProvider(name = "DTDsInJDKCatalog")
|
78 |
| - public Object[][] getDTDsInJDKCatalog() throws Exception { |
| 76 | + public Object[][] getDTDsInJDKCatalog() { |
79 | 77 | return new Object[][]{
|
80 | 78 | // Schema 1.0
|
81 | 79 | {"-//W3C//DTD XMLSCHEMA 200102//EN", "http://www.w3.org/2001/XMLSchema.dtd"},
|
@@ -133,29 +131,16 @@ public Object[][] getXSD() throws Exception {
|
133 | 131 | };
|
134 | 132 | }
|
135 | 133 |
|
136 |
| - /* |
137 |
| - * Initializing fields |
138 |
| - */ |
139 |
| - @BeforeClass |
140 |
| - public void setUpClass() throws Exception { |
141 |
| - // initialize JDKCatalog |
142 |
| - JdkCatalog.init("continue"); |
143 |
| - jdkCatalog = JdkCatalog.catalog; |
144 |
| - } |
145 |
| - |
146 | 134 | /**
|
147 | 135 | * Verifies that the JDK built-in Catalog supports both the Public and System
|
148 | 136 | * identifiers for DTDs.
|
149 | 137 | * @param publicId the public Id
|
150 | 138 | * @param systemId the system Id
|
151 |
| - * @throws Exception if test fails unexpectedly |
152 | 139 | */
|
153 | 140 | @Test(dataProvider = "DTDsInJDKCatalog")
|
154 |
| - public void testDTDsInJDKCatalog(String publicId, String systemId) |
155 |
| - throws Exception { |
156 |
| - String matchingPubId = jdkCatalog.matchPublic(publicId); |
157 |
| - String matchingSysId = jdkCatalog.matchSystem(systemId); |
158 |
| - |
| 141 | + public void testDTDsInJDKCatalog(String publicId, String systemId) { |
| 142 | + String matchingPubId = JDKCATALOG.matchPublic(publicId); |
| 143 | + String matchingSysId = JDKCATALOG.matchSystem(systemId); |
159 | 144 | Assert.assertEquals(matchingPubId, matchingSysId);
|
160 | 145 | }
|
161 | 146 |
|
|
0 commit comments