--- old/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java 2016-07-18 00:50:04.174871772 -0700 +++ new/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java 2016-07-18 00:50:04.046935771 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -23,26 +23,28 @@ package javax.xml.xpath.ptests; -import java.io.FilePermission; +import static javax.xml.xpath.XPathConstants.BOOLEAN; +import static javax.xml.xpath.XPathConstants.NODE; +import static javax.xml.xpath.XPathConstants.NODESET; +import static javax.xml.xpath.XPathConstants.NUMBER; +import static javax.xml.xpath.XPathConstants.STRING; +import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR; +import static org.testng.Assert.assertEquals; + import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; + import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; -import static javax.xml.xpath.XPathConstants.BOOLEAN; -import static javax.xml.xpath.XPathConstants.NODE; -import static javax.xml.xpath.XPathConstants.NODESET; -import static javax.xml.xpath.XPathConstants.NUMBER; -import static javax.xml.xpath.XPathConstants.STRING; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR; -import jaxp.library.JAXPFileReadOnlyBaseTest; -import static org.testng.Assert.assertEquals; + import org.testng.annotations.BeforeTest; +import org.testng.annotations.Listeners; import org.testng.annotations.Test; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -52,7 +54,8 @@ /** * Class containing the test cases for XPathExpression API. */ -public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest { +@Listeners({jaxp.library.FilePolicy.class}) +public class XPathExpressionTest { /** * Document object for testing XML file. */ @@ -89,7 +92,6 @@ */ @BeforeTest public void setup() throws Exception { - setPermissions(new FilePermission(XML_PATH.toFile().toString(), "read")); document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile()); xpath = XPathFactory.newInstance().newXPath(); } @@ -264,7 +266,7 @@ * * @throws Exception If any errors occur. */ - @Test (groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression15() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.compile(EXPRESSION_NAME_A). @@ -287,7 +289,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void testCheckXPathExpression17() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(null).evaluate(new InputSource(is)); @@ -300,7 +302,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPathExpression18() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile("-*&").evaluate(new InputSource(is)); @@ -313,7 +315,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPathExpression19() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(" ").evaluate(new InputSource(is)); @@ -326,7 +328,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression20() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.compile(EXPRESSION_NAME_A). @@ -351,7 +353,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void testCheckXPathExpression22() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(null).evaluate(new InputSource(is), STRING); @@ -364,7 +366,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class) + @Test(expectedExceptions = NullPointerException.class) public void testCheckXPathExpression23() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), null); @@ -377,7 +379,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPathExpression24() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile("-*&").evaluate(new InputSource(is), STRING); @@ -390,7 +392,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class) + @Test(expectedExceptions = XPathExpressionException.class) public void testCheckXPathExpression25() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(" ").evaluate(new InputSource(is), STRING); @@ -404,7 +406,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class) + @Test(expectedExceptions = IllegalArgumentException.class) public void testCheckXPathExpression26() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), TEST_QNAME); @@ -417,7 +419,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression27() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.compile(EXPRESSION_NAME_A). @@ -431,7 +433,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression28() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.compile(EXPRESSION_NAME_B). @@ -445,7 +447,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression29() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { assertEquals(xpath.compile(EXPRESSION_NAME_A). @@ -459,7 +461,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression30() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A). @@ -474,7 +476,7 @@ * * @throws Exception If any errors occur. */ - @Test(groups = {"readLocalFiles"}) + @Test public void testCheckXPathExpression31() throws Exception { try (InputStream is = Files.newInputStream(XML_PATH)) { NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).