< prev index next >
test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -21,31 +21,34 @@
* questions.
*/
package javax.xml.parsers.ptests;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
import static jaxp.library.JAXPTestUtilities.FILE_SEP;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FilePermission;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertNotNull;
+
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
/**
* This checks for the methods of DocumentBuilder
*/
-public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest
- implements EntityResolver {
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentBuilderImpl01 implements EntityResolver {
/**
* Provide DocumentBuilder.
*
* @return data provider has single DocumentBuilder.
* @throws ParserConfigurationException if a DocumentBuilder cannot be
@@ -80,11 +83,11 @@
/**
* Test the parse(InputStream).
* @param docBuilder document builder instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+ @Test(dataProvider = "builder-provider")
public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder)
throws Exception {
try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
"DocumentBuilderImpl01.xml"))) {
assertNotNull(docBuilder.parse(fis));
@@ -95,11 +98,11 @@
* Test the parse(File).
*
* @param docBuilder document builder instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+ @Test(dataProvider = "builder-provider")
public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder)
throws Exception {
assertNotNull(docBuilder.parse(new File(XML_DIR,
"DocumentBuilderImpl01.xml")));
}
@@ -107,15 +110,13 @@
/**
* Test the parse(InputStream,systemId).
* @param docBuilder document builder instance.
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+ @Test(dataProvider = "builder-provider")
public void testCheckDocumentBuilderImpl06(DocumentBuilder docBuilder)
throws Exception {
- setPermissions(new FilePermission(XML_DIR + "../-",
- "read"));
try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
"DocumentBuilderImpl02.xml"))) {
assertNotNull(docBuilder.parse(fis, new File(XML_DIR).toURI()
.toASCIIString() + FILE_SEP));
}
< prev index next >