Skip to content

Commit 4482d59

Browse files
committed
update the test: change variables and etc.
1 parent c423ef9 commit 4482d59

File tree

1 file changed

+18
-33
lines changed

1 file changed

+18
-33
lines changed

test/jaxp/javax/xml/jaxp/unittest/common/jdkcatalog/JDKCatalogTest.java

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
*/
2323
package common.jdkcatalog;
2424

25+
import static jaxp.library.JAXPTestUtilities.SRC_DIR;
26+
import static jaxp.library.JAXPTestUtilities.isWindows;
27+
2528
import java.io.StringReader;
2629
import java.nio.file.Files;
2730
import java.nio.file.Path;
@@ -37,7 +40,6 @@
3740
import jdk.xml.internal.JdkCatalog;
3841
import org.testng.Assert;
3942
import org.testng.Assert.ThrowingRunnable;
40-
import org.testng.annotations.BeforeClass;
4143
import org.testng.annotations.DataProvider;
4244
import org.testng.annotations.Test;
4345
import org.xml.sax.InputSource;
@@ -49,33 +51,29 @@
4951
* @test
5052
* @bug 8344800 8345353 8351969
5153
* @modules java.xml/jdk.xml.internal
54+
* @library /javax/xml/jaxp/libs
5255
* @run testng/othervm common.jdkcatalog.JDKCatalogTest
5356
* @summary Verifies the W3C DTDs and XSDs in the JDK built-in catalog.
5457
*/
5558
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;
5966
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+
}
7270

7371
/*
7472
* DataProvider: DTDs in the JDK built-in Catalog
7573
* Data provided: public and system Ids, see test testDTDsInJDKCatalog
7674
*/
7775
@DataProvider(name = "DTDsInJDKCatalog")
78-
public Object[][] getDTDsInJDKCatalog() throws Exception {
76+
public Object[][] getDTDsInJDKCatalog() {
7977
return new Object[][]{
8078
// Schema 1.0
8179
{"-//W3C//DTD XMLSCHEMA 200102//EN", "http://www.w3.org/2001/XMLSchema.dtd"},
@@ -133,29 +131,16 @@ public Object[][] getXSD() throws Exception {
133131
};
134132
}
135133

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-
146134
/**
147135
* Verifies that the JDK built-in Catalog supports both the Public and System
148136
* identifiers for DTDs.
149137
* @param publicId the public Id
150138
* @param systemId the system Id
151-
* @throws Exception if test fails unexpectedly
152139
*/
153140
@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);
159144
Assert.assertEquals(matchingPubId, matchingSysId);
160145
}
161146

0 commit comments

Comments
 (0)