uri:
startElement...
namespaceURI: <> localName: <> qName: Number of Attributes: <0> Line# <9>
characters...length is:77
< Welcome to the world of typography! Here is a book that you may find useful.>
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
characters...length is:5
<
>
-startPrefixMapping...
-prefix: uri:
-startPrefixMapping...
-prefix: uri:
startElement...
namespaceURI: <> localName: <> qName: Number of Attributes: <1> Line# <10>
characters...length is:18
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
-characters...length is:1
-< >
characters...length is:5
<
>
-startPrefixMapping...
-prefix: uri:
-startPrefixMapping...
-prefix: uri:
startElement...
namespaceURI: <> localName: <> qName: Number of Attributes: <0> Line# <11>
characters...length is:12
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
characters...length is:5
<
>
@@ -113,18 +63,10 @@ characters...length is:3
>
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
characters...length is:2
<
>
endElement...
namespaceURI: <> localName: <> qName:
-endPrefixMapping...
-prefix:
-endPrefixMapping...
-prefix:
endDocument...
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml
index 4c46f7b7175..e15cf988d30 100644
--- a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml
@@ -1,6 +1,5 @@
-
+
Publishers of the Music of New York Women Composers
The Publishers
diff --git a/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publishers.dtd b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publishers.dtd
new file mode 100644
index 00000000000..afbc4a9b7c5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publishers.dtd
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java
index d31fd23f605..8671a12242e 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/AstroTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -24,6 +24,7 @@
package test.astro;
import static java.lang.String.valueOf;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
import static org.testng.Assert.assertEquals;
import static test.astro.AstroConstants.ASTROCAT;
import static test.astro.AstroConstants.GOLDEN_DIR;
@@ -35,13 +36,16 @@ import java.util.List;
import javax.xml.transform.sax.TransformerHandler;
-import jaxp.library.JAXPFileBaseTest;
-
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.AstroTest
+ * @run testng/othervm test.astro.AstroTest
* @summary run astro application, test xslt
*
* There are vast amounts of textual astronomical data, typically user is
@@ -66,7 +70,8 @@ import org.testng.annotations.Test;
* AstroProcessor to test different JAXP classes and features.
*
*/
-public class AstroTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class AstroTest {
private FiltersAndGolden[] data;
@BeforeClass
@@ -107,7 +112,7 @@ public class AstroTest extends JAXPFileBaseTest {
for (int i = 0; i < filterCreators.length; i++)
filters[i] = filterCreators[i].createFilter(astro);
- String outputfile = Files.createTempFile(Paths.get("").toAbsolutePath(), "query" + processNum + ".out.", null).toString();
+ String outputfile = Files.createTempFile(Paths.get(USER_DIR), "query" + processNum + ".out.", null).toString();
System.out.println("output file: " + outputfile);
astro.process(outputfile, filters);
assertEquals(Files.readAllLines(Paths.get(outputfile)), goldenfileContent);
@@ -140,3 +145,4 @@ public class AstroTest extends JAXPFileBaseTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
index b0a76282f7d..20179d5f46b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -40,8 +40,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -52,9 +51,14 @@ import org.w3c.dom.ls.LSParser;
import org.w3c.dom.ls.LSSerializer;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.DocumentLSTest
+ * @run testng/othervm test.astro.DocumentLSTest
* @summary org.w3c.dom.ls tests
*/
-public class DocumentLSTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentLSTest {
/*
* Test creating an empty Document
*/
@@ -178,3 +182,4 @@ public class DocumentLSTest extends JAXPFileBaseTest {
return dbf.newDocumentBuilder();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java
index 6a1d0dd3d66..e9584a99579 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -28,14 +28,18 @@ import static org.testng.Assert.assertEquals;
import javax.xml.namespace.QName;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.NamespaceContextTest
+ * @run testng/othervm test.astro.NamespaceContextTest
* @summary javax.xml.namespace.QName tests
*/
-public class NamespaceContextTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class NamespaceContextTest {
private static final String PREFIX = "astro";
private static final String LOCAL_PART = "stardb";
private static final String NS_URI = "http://www.astro.com";
@@ -85,3 +89,4 @@ public class NamespaceContextTest extends JAXPBaseTest {
assertEquals(QName.valueOf(qname.toString()), qname);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java
index bcba454c126..d1bb70a3b8f 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -24,15 +24,19 @@ package test.astro;
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.XMLReader;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.SAX201Test
+ * @run testng/othervm test.astro.SAX201Test
* @summary verify SAX 2.0.1 allows to use null in setters
*/
-public class SAX201Test extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAX201Test {
@Test
public void test() throws Exception {
SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -44,3 +48,4 @@ public class SAX201Test extends JAXPBaseTest {
reader.setDTDHandler(null); // SAX 2.0.1 allows
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java
index c84fddb6882..6c557fb032b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -33,16 +33,20 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.SchemaValidationTest
+ * @run testng/othervm test.astro.SchemaValidationTest
* @summary test parser sets schema related properties to do validation
*/
-public class SchemaValidationTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class SchemaValidationTest {
/*
* Only set the schemaLanguage, without setting schemaSource. It should
* work.
@@ -72,3 +76,4 @@ public class SchemaValidationTest extends JAXPFileBaseTest {
return spf.newSAXParser();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java b/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java
index a97590fef38..ba3aae0fa2b 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -45,20 +45,24 @@ import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathVariableResolver;
-import jaxp.library.JAXPFileBaseTest;
-
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.astro.XPathAPITest
+ * @run testng/othervm test.astro.XPathAPITest
* @summary test XPath API
*/
@Test(singleThreaded = true)
-public class XPathAPITest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class XPathAPITest {
private static final String STARDB_STAR_3_CONSTELLATION = "//astro:stardb/astro:star[3]/astro:constellation";
private static final String STARDB_STAR = "//astro:stardb/astro:star";
private Document doc;
@@ -167,3 +171,4 @@ public class XPathAPITest extends JAXPFileBaseTest {
return new InputSource(filenameToURL(ASTROCAT));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java
index 576f44a154f..1238fb88967 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java
@@ -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
@@ -22,18 +22,23 @@
*/
package test.auctionportal;
-import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
-import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static jaxp.library.JAXPTestUtilities.bomStream;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
+import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.math.BigInteger;
import java.nio.file.Paths;
import java.util.GregorianCalendar;
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
import javax.xml.datatype.DatatypeConstants;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
@@ -46,8 +51,8 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static jaxp.library.JAXPTestUtilities.bomStream;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMConfiguration;
@@ -58,20 +63,25 @@ import org.w3c.dom.TypeInfo;
import org.w3c.dom.bootstrap.DOMImplementationRegistry;
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSSerializer;
-import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
-import static test.auctionportal.HiBidConstants.XML_DIR;
/**
* This is the user controller class for the Auction portal HiBid.com.
*/
-public class AuctionController extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.auctionportal.AuctionController
+ * @run testng/othervm test.auctionportal.AuctionController
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AuctionController {
/**
* Check for DOMErrorHandler handling DOMError. Before fix of bug 4890927
* DOMConfiguration.setParameter("well-formed",true) throws an exception.
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCreateNewItem2Sell() throws Exception {
String xmlFile = XML_DIR + "novelsInvalid.xml";
@@ -94,7 +104,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCreateNewItem2SellRetry() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
@@ -126,7 +136,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCreateID() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
@@ -147,7 +157,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckingUserData() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
@@ -184,7 +194,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
* @throws Exception If any errors occur.
* @see movies.xml
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testCheckingEncoding() throws Exception {
// Note since movies.xml is UTF-16 encoding. We're not using stanard XML
// file suffix.
@@ -206,7 +216,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
* @throws Exception If any errors occur.
* @see userDetails.xsd
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testGetOwnerInfo() throws Exception {
String schemaFile = XML_DIR + "userDetails.xsd";
String xmlFile = XML_DIR + "userDetails.xml";
@@ -241,7 +251,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
* @see coins.xsd
* @see coinsImportMe.xsd
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testGetOwnerItemList() throws Exception {
String xsdFile = XML_DIR + "coins.xsd";
String xmlFile = XML_DIR + "coins.xml";
@@ -277,7 +287,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
* @see coinsImportMe.xsd
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testGetOwnerItemList1() throws Exception {
String xsdFile = XML_DIR + "coins.xsd";
String xmlFile = XML_DIR + "coins.xml";
@@ -299,7 +309,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testGetItemDuration() throws Exception {
String xmlFile = XML_DIR + "itemsDuration.xml";
@@ -332,7 +342,7 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testGetTypeInfo() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
@@ -356,3 +366,5 @@ public class AuctionController extends JAXPFileReadOnlyBaseTest {
assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java
index 25e78643cb4..4ab09cf71c7 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java
@@ -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
@@ -22,18 +22,26 @@
*/
package test.auctionportal;
-import static test.auctionportal.HiBidConstants.SP_ENTITY_EXPANSION_LIMIT;
-import static test.auctionportal.HiBidConstants.SP_MAX_OCCUR_LIMIT;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
+import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_SOURCE;
-import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.SP_ENTITY_EXPANSION_LIMIT;
+import static test.auctionportal.HiBidConstants.SP_MAX_OCCUR_LIMIT;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.FilePermission;
import java.io.InputStream;
-import static javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING;
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.SAXParser;
@@ -41,20 +49,23 @@ import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
-import static org.testng.Assert.assertFalse;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXParseException;
-import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
-import static test.auctionportal.HiBidConstants.XML_DIR;
/**
* This is a test class for the Auction portal HiBid.com.
*/
-public class AuctionItemRepository extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.auctionportal.AuctionItemRepository
+ * @run testng/othervm test.auctionportal.AuctionItemRepository
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AuctionItemRepository {
/**
* XML file for parsing.
*/
@@ -84,7 +95,6 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
SAXParser parser = factory.newSAXParser();
MyErrorHandler fatalHandler = new MyErrorHandler();
- setPermissions(new FilePermission(ENTITY_XML, "read"));
parser.parse(new File(ENTITY_XML), fatalHandler);
assertFalse(fatalHandler.isAnyError());
}
@@ -107,7 +117,6 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
SAXParser parser = factory.newSAXParser();
MyErrorHandler fatalHandler = new MyErrorHandler();
- setPermissions(new FilePermission(ENTITY_XML, "read"));
parser.parse(new File(ENTITY_XML), fatalHandler);
}
@@ -127,7 +136,6 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
setSystemProperty(SP_MAX_OCCUR_LIMIT, String.valueOf(10000));
SAXParser parser = factory.newSAXParser();
parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA_NS_URI);
- setPermissions(new FilePermission(XML_DIR + "-", "read"));
parser.setProperty(JAXP_SCHEMA_SOURCE, new File(schema_file));
try (InputStream is = new FileInputStream(xml_file)) {
MyErrorHandler eh = new MyErrorHandler();
@@ -150,13 +158,8 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
MyErrorHandler eh = new MyErrorHandler();
dBuilder.setErrorHandler(eh);
- try {
- setPermissions(new FilePermission(ENTITY_XML, "read"));
- dBuilder.parse(ENTITY_XML);
- assertFalse(eh.isAnyError());
- } finally {
- setPermissions();
- }
+ dBuilder.parse(ENTITY_XML);
+ assertFalse(eh.isAnyError());
}
/**
@@ -174,7 +177,6 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
DocumentBuilder dBuilder = dfactory.newDocumentBuilder();
MyErrorHandler eh = new MyErrorHandler();
dBuilder.setErrorHandler(eh);
- setPermissions(new FilePermission(ENTITY_XML, "read"));
dBuilder.parse(ENTITY_XML);
}
@@ -369,3 +371,5 @@ public class AuctionItemRepository extends JAXPFileBaseTest {
assertTrue(compareDocumentWithGold(goldFile, resultFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java
index b32cb3d0d51..4ee18c423c4 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java
@@ -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
@@ -22,20 +22,26 @@
*/
package test.auctionportal;
-import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
+import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
+import static test.auctionportal.HiBidConstants.JAXP_SCHEMA_LANGUAGE;
+import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
+import static test.auctionportal.HiBidConstants.XML_DIR;
+
import java.io.FileOutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareDocumentWithGold;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
@@ -46,14 +52,18 @@ import org.w3c.dom.bootstrap.DOMImplementationRegistry;
import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSParser;
import org.w3c.dom.ls.LSSerializer;
-import static test.auctionportal.HiBidConstants.GOLDEN_DIR;
-import static test.auctionportal.HiBidConstants.PORTAL_ACCOUNT_NS;
-import static test.auctionportal.HiBidConstants.XML_DIR;
/**
* This is the user controller class for the Auction portal HiBid.com.
*/
-public class UserController extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.auctionportal.UserController
+ * @run testng/othervm test.auctionportal.UserController
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class UserController {
/**
* Checking when creating an XML document using DOM Level 2 validating
* it without having a schema source or a schema location It must throw a
@@ -150,7 +160,7 @@ public class UserController extends JAXPFileBaseTest {
*
* @throws Exception If any errors occur.
*/
- @Test(groups = {"readLocalFiles"})
+ @Test
public void testMoreUserInfo() throws Exception {
String xmlFile = XML_DIR + "accountInfo.xml";
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
@@ -294,3 +304,5 @@ public class UserController extends JAXPFileBaseTest {
assertTrue(compareDocumentWithGold(goldFile, resultFile));
}
}
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java
index fec94a13174..65e38a75e25 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java
@@ -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
@@ -29,16 +29,19 @@ import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4511326
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4511326
+ * @run testng/othervm test.gaptest.Bug4511326
* @summary In forwards-compatible mode the attribute isn't ignored
*/
-
-public class Bug4511326 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4511326 {
private static final String XSL = ""
@@ -61,3 +64,4 @@ public class Bug4511326 extends JAXPBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java
index 631b0919ec7..cfc74fd26f2 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java
@@ -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
@@ -34,15 +34,19 @@ import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4512806
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4512806
+ * @run testng/othervm test.gaptest.Bug4512806
* @summary test transformer.setOutputProperties(null)
*/
-public class Bug4512806 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4512806 {
@Test
public void testProperty() throws TransformerConfigurationException {
@@ -86,3 +90,4 @@ public class Bug4512806 extends JAXPBaseTest {
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java
index 0b822c810ef..a833c117a8f 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java
@@ -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
@@ -31,16 +31,19 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4515047
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4515047
+ * @run testng/othervm test.gaptest.Bug4515047
* @summary test transform an empty dom source
*/
-
-public class Bug4515047 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4515047 {
@Test
public void testCreateTxDoc() throws TransformerException, ParserConfigurationException {
@@ -59,3 +62,4 @@ public class Bug4515047 extends JAXPBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java
index 6f2c3140555..bff0d401d25 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java
@@ -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,6 +23,9 @@
package test.gaptest;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
import static org.testng.Assert.assertTrue;
import java.io.IOException;
@@ -39,21 +42,25 @@ import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.stream.StreamResult;
-import jaxp.library.JAXPBaseTest;
-
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
/*
+ * @test
* @bug 4515660
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4515660
+ * @run testng/othervm test.gaptest.Bug4515660
* @summary verify property org.xml.sax.driver is used by SAXTransformerFactory
*/
@Test(singleThreaded = true)
-public class Bug4515660 extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class Bug4515660 {
@BeforeClass
public void setSaxDrier() {
@@ -62,7 +69,7 @@ public class Bug4515660 extends JAXPBaseTest {
@AfterClass
public void clearSaxDrier() {
- setSystemProperty("org.xml.sax.driver", null);
+ clearSystemProperty("org.xml.sax.driver");
}
@Test
@@ -121,3 +128,4 @@ public class Bug4515660 extends JAXPBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java
index d7d586b584c..8db96ac91a6 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java
@@ -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
@@ -42,24 +42,28 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 4693341
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4693341
+ * @run testng/othervm test.gaptest.Bug4693341
* @summary test transforming to stream with external dtd
*/
-public class Bug4693341 extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug4693341 {
@Test
public void test() throws TransformerException, ParserConfigurationException, SAXException, IOException {
Transformer transformer = TransformerFactory.newInstance().newTransformer();
- String out = USER_DIR + File.separator + "Bug4693341.out";
+ String out = USER_DIR + "Bug4693341.out";
StreamResult result = new StreamResult(new File(out));
String in = XML_DIR + "Bug4693341.xml";
@@ -69,7 +73,7 @@ public class Bug4693341 extends JAXPFileBaseTest {
System.out.println(source.getSystemId());
Files.copy(Paths.get(XML_DIR + "Bug4693341.dtd"),
- Paths.get(USER_DIR + File.separator + "Bug4693341.dtd"), REPLACE_EXISTING);
+ Paths.get(USER_DIR + "Bug4693341.dtd"), REPLACE_EXISTING);
transformer.transform(source, result);
@@ -77,3 +81,4 @@ public class Bug4693341 extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java
index f4de7753162..4fa09ccc2dc 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java
@@ -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
@@ -32,8 +32,7 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
@@ -42,11 +41,15 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
/*
+ * @test
* @bug 4848653
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4848653
+ * @run testng/othervm test.gaptest.Bug4848653
* @summary Verify JAXP schemaLanguage property is ignored if setValidating(false)
*/
-
-public class Bug4848653 extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug4848653 {
@Test
public void test() throws IOException, SAXException, ParserConfigurationException {
@@ -78,3 +81,4 @@ public class Bug4848653 extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java
index 5dd54017c62..7bb8ea574ad 100644
--- a/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java
+++ b/jaxp/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java
@@ -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
@@ -37,19 +37,22 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/*
+ * @test
* @bug 4858685 4894410
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true test.gaptest.Bug4858685
+ * @run testng/othervm test.gaptest.Bug4858685
* @summary test transforming text node
*/
-
-public class Bug4858685 extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug4858685 {
@Test
public void test() throws TransformerException, IOException {
String uri = XML_DIR + "certificate.xml";
@@ -244,3 +247,4 @@ public class Bug4858685 extends JAXPFileBaseTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/TEST.properties b/jaxp/test/javax/xml/jaxp/internaltest/TEST.properties
deleted file mode 100644
index 9c5515637e5..00000000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/TEST.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-# jaxp test uses TestNG
-TestNG.dirs = javax/xml/common/bug6979306 javax/xml/parsers/bug8003147 javax/xml/transform/bug6551616 javax/xml/transform/cli
-
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java
deleted file mode 100644
index 2781c97f853..00000000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @modules java.xml/com.sun.org.apache.bcel.internal.classfile
- * java.xml/com.sun.org.apache.bcel.internal.generic
- * @bug 8003147
- * @summary Test port fix for BCEL bug 39695.
- */
-
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.sun.org.apache.bcel.internal.classfile.ClassParser;
-import com.sun.org.apache.bcel.internal.classfile.ConstantClass;
-import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
-import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
-import com.sun.org.apache.bcel.internal.classfile.JavaClass;
-import com.sun.org.apache.bcel.internal.classfile.Method;
-import com.sun.org.apache.bcel.internal.generic.ClassGen;
-import com.sun.org.apache.bcel.internal.generic.MethodGen;
-
-public class Bug8003147Test {
-
- @Test
- public void test() throws Exception {
- String classfile = getClass().getResource("Bug8003147Test.class").getPath();
- JavaClass jc = new ClassParser(classfile).parse();
- // rename class
- ConstantPool cp = jc.getConstantPool();
- int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex();
- cp.setConstant(cpIndex, new ConstantUtf8("Bug8003147TestPrime"));
- ClassGen gen = new ClassGen(jc);
- Method[] methods = jc.getMethods();
- int index;
- for (index = 0; index < methods.length; index++) {
- if (methods[index].getName().equals("doSomething")) {
- break;
- }
- }
- Method m = methods[index];
- MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool());
- gen.replaceMethod(m, mg.getMethod());
- String path = classfile.replace("Bug8003147Test", "Bug8003147TestPrime");
- gen.getJavaClass().dump(new FileOutputStream(path));
-
- try {
- Class.forName("Bug8003147TestPrime");
- } catch (ClassFormatError cfe) {
- cfe.printStackTrace();
- Assert.fail("modified version of class does not pass verification");
- }
- }
-
- public void doSomething(double d, ArrayList list) {
- }
-}
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml
deleted file mode 100644
index eeb3723c2bc..00000000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl b/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl
deleted file mode 100644
index 5b10fc88769..00000000000
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties b/jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties
deleted file mode 100644
index 95fac7b2aac..00000000000
--- a/jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-lib.dirs=/javax/xml/jaxp/libs
-
-# Declare module dependency
-modules=java.xml
\ No newline at end of file
diff --git a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
index 0e0ff9f194c..a0e83d5b810 100644
--- a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
@@ -37,6 +37,8 @@ import javax.xml.catalog.CatalogManager;
import javax.xml.catalog.CatalogResolver;
import javax.xml.catalog.CatalogUriResolver;
+import jaxp.library.JAXPTestUtilities;
+
/*
* Utilities for testing XML Catalog API.
*/
@@ -126,24 +128,10 @@ final class CatalogTestUtils {
static String getCatalogPath(String catalogName) {
return catalogName == null
? null
- : getPathByClassName(CatalogTestUtils.class, "catalogFiles")
+ : JAXPTestUtilities.getPathByClassName(CatalogTestUtils.class, "catalogFiles")
+ catalogName;
}
- /*
- * Acquire a full path string by given class name and relative path string.
- */
- private static String getPathByClassName(Class> clazz,
- String relativeDir) {
- String packageName = FILE_SEP
- + clazz.getPackage().getName().replaceAll("[.]", FILE_SEP);
- String javaSourcePath = System.getProperty("test.src").replaceAll(
- "\\" + File.separator, FILE_SEP) + packageName + FILE_SEP;
- String normalizedPath = Paths.get(javaSourcePath,
- relativeDir).normalize().toAbsolutePath().toString();
- return normalizedPath.replace("\\", FILE_SEP) + FILE_SEP;
- }
-
/* ********** jaxp.properties ********** */
/*
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java
new file mode 100644
index 00000000000..5289148ad74
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jaxp.library;
+
+import org.testng.ITestContext;
+import org.testng.ITestListener;
+import org.testng.ITestResult;
+
+/**
+ * This policy includes default permissions.
+ * It should be used as one listener: either TestListener or MethodListener.
+ */
+public class BasePolicy implements ITestListener {
+
+ @Override
+ public void onFinish(ITestContext arg0) {
+ try {
+ JAXPPolicyManager.teardownPolicyManager();
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to teardonw the policy manager", e);
+ }
+ }
+
+ @Override
+ public void onStart(ITestContext arg0) {
+ // suppose to only run othervm mode
+ if (isRunWithSecurityManager())
+ JAXPPolicyManager.getJAXPPolicyManager(true);
+ }
+
+ @Override
+ public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
+ }
+
+ @Override
+ public void onTestFailure(ITestResult arg0) {
+ }
+
+ @Override
+ public void onTestSkipped(ITestResult arg0) {
+ }
+
+ @Override
+ public void onTestStart(ITestResult arg0) {
+ }
+
+ @Override
+ public void onTestSuccess(ITestResult arg0) {
+ }
+
+ protected boolean isRunWithSecurityManager() {
+ final String runSecMngr = JAXPTestUtilities.getSystemProperty("runSecMngr");
+ return runSecMngr != null && runSecMngr.equals("true");
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java
new file mode 100644
index 00000000000..d40c0c58b2e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jaxp.library;
+
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
+import java.io.FilePermission;
+
+import org.testng.ITestContext;
+
+/**
+ * This policy can access local XML files.
+ */
+public class FilePolicy extends BasePolicy {
+
+ @Override
+ public void onStart(ITestContext arg0) {
+ // suppose to only run othervm mode
+ if (isRunWithSecurityManager()) {
+ JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true);
+ String userdir = getSystemProperty("user.dir");
+ policyManager.addPermission(new FilePermission(userdir + "/-", "read,write,delete"));
+ String testSrc = System.getProperty("test.src");
+ // to handle the directory structure of some functional test suite
+ if (testSrc.endsWith("ptests"))
+ testSrc = testSrc.substring(0, testSrc.length() - 7);
+ policyManager.addPermission(new FilePermission(testSrc + "/-", "read"));
+ policyManager.addPermission(new FilePermission(userdir, "read"));
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java
new file mode 100644
index 00000000000..b9431443b88
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jaxp.library;
+
+import org.testng.ITestContext;
+
+/**
+ * This policy can access internal jaxp packages.
+ */
+public class InternalAPIPolicy extends BasePolicy {
+
+ @Override
+ public void onStart(ITestContext arg0) {
+ // suppose to only run othervm mode
+ if (isRunWithSecurityManager()) {
+ JAXPPolicyManager policyManager = JAXPPolicyManager.getJAXPPolicyManager(true);
+ policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.xerces.internal.jaxp"));
+ policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.bcel.internal.classfile"));
+ policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.bcel.internal.generic"));
+ policyManager.addPermission(new RuntimePermission("accessClassInPackage.com.sun.org.apache.xalan.internal.xsltc.trax"));
+ }
+ }
+}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java
deleted file mode 100644
index 687ff7009d5..00000000000
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jaxp.library;
-
-import java.security.Permission;
-import java.security.Permissions;
-import java.security.Policy;
-import java.util.PropertyPermission;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-
-/**
- * This is a base class that every test class must extend if it needs to be run
- * with security mode.
- */
-public class JAXPBaseTest {
- /**
- * Backing up policy.
- */
- protected static Policy policy;
-
- /**
- * Backing up security manager.
- */
- private static SecurityManager sm;
-
- /*
- * Install a SecurityManager along with a base Policy to allow testNG to
- * run when there is a security manager.
- */
- @BeforeClass
- public void setUpClass() throws Exception {
- setPolicy(new TestPolicy());
- System.setSecurityManager(new SecurityManager());
- }
-
- /*
- * Install the original Policy and SecurityManager when there is a security
- * manager.
- */
- @AfterClass
- public void tearDownClass() throws Exception {
- System.setSecurityManager(sm);
- setPolicy(policy);
- }
-
- /*
- * Utility Method used to set the current Policy.
- */
- protected static void setPolicy(Policy p) {
- Policy.setPolicy(p);
- }
-
- /*
- * Add the specified permission(s) to the test policy.
- * Note there is no way to add permissions to current permissions. Reset
- * test policy by setting minimal permmisons in addition to specified
- * permissions when calling this method.
- */
- protected static void setPermissions(Permission... ps) {
- Policy.setPolicy(new TestPolicy(ps));
- }
-
- /*
- * Add the specified permission(s) to the test policy.
- * Note there is no way to add permissions to current permissions. Reset
- * test policy by setting minimal permmisons in addition to specified
- * permissions when calling this method.
- */
- protected static void setPermissions(Permissions ps) {
- Policy.setPolicy(new TestPolicy(ps));
- }
-
- /**
- * Backing up policy and security manager for restore when there is a
- * security manager.
- */
- public JAXPBaseTest() {
- policy = Policy.getPolicy();
- sm = System.getSecurityManager();
- }
-
- /**
- * Safety acquire a system property.
- * Note invocation of this method will restore permission to limited
- * minimal permission of tests. If there is additional permission set
- * already, you need restore permission by yourself.
- * @param propName System property name to be acquired.
- * @return property value
- */
- protected String getSystemProperty(final String propName) {
- setPermissions(new PropertyPermission(propName, "read"));
- try {
- return System.getProperty(propName);
- } finally {
- setPermissions();
- }
- }
-
- /**
- * Safety set a system property by given system value.
- *
- * @param propName System property name to be set.
- * @param propValue System property value to be set.
- */
- protected void setSystemProperty(final String propName, final String propValue) {
- setPermissions(new PropertyPermission(propName, "write"));
- try {
- if (propValue == null) {
- System.clearProperty(propName);
- } else {
- System.setProperty(propName, propValue);
- }
- } finally {
- setPermissions();
- }
- }
-}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java
deleted file mode 100644
index c45c6d3a270..00000000000
--- a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jaxp.library;
-
-import java.io.FilePermission;
-import java.security.Permission;
-import java.security.Permissions;
-import java.security.Policy;
-import static jaxp.library.JAXPBaseTest.setPolicy;
-import org.testng.annotations.BeforeClass;
-
-/**
- * This is a base class that every test class that need to access local XML
- * files must extend if it needs to be run with security mode.
- */
-public class JAXPFileBaseTest extends JAXPBaseTest {
- /*
- * Install a SecurityManager along with a base Policy to allow testNG to
- * run when there is a security manager.
- */
- @BeforeClass
- @Override
- public void setUpClass() throws Exception {
- setPolicy(new FileTestPolicy());
- System.setSecurityManager(new SecurityManager());
- }
-
- /*
- * Add the specified permission(s) to the test policy.
- * Note there is no way to add permissions to current permissions. Reset
- * test policy by setting minimal permmisons in addition to specified
- * permissions when calling this method.
- */
- protected static void setPermissions(Permission... ps) {
- Policy.setPolicy(new FileTestPolicy(ps));
- }
-
- /*
- * Add the specified permission(s) to the test policy.
- * Note there is no way to add permissions to current permissions. Reset
- * test policy by setting minimal permmisons in addition to specified
- * permissions when calling this method.
- */
- protected static void setPermissions(Permissions ps) {
- Policy.setPolicy(new FileTestPolicy(ps));
- }
-}
-
-/**
- * This policy is only given to tests that need access local files. Additional
- * permissions for accessing local files have been granted by default.
- * @author HaiboYan
- */
-class FileTestPolicy extends TestPolicy {
- /**
- * Constructor which sets the minimum permissions by default allowing testNG
- * to work with a SecurityManager.
- * @param ps permissions to be added.
- */
- public FileTestPolicy(Permissions ps) {
- super(ps);
- }
-
- /**
- * Constructor which sets the minimum permissions by default allowing testNG
- * to work with a SecurityManager.
- * @param ps permission array to be added.
- */
- public FileTestPolicy(Permission... ps) {
- super(ps);
- }
-
- /**
- * Defines the minimal permissions required by testNG when running these
- * tests
- */
- @Override
- protected void setMinimalPermissions() {
- super.setMinimalPermissions();
- permissions.add(new FilePermission(System.getProperty("user.dir") + "/-",
- "read, write"));
- permissions.add(new FilePermission(System.getProperty("test.src") + "/-",
- "read"));
- }
-}
diff --git a/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java
new file mode 100644
index 00000000000..a52c854a707
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java
@@ -0,0 +1,300 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jaxp.library;
+
+
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.security.SecurityPermission;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.PropertyPermission;
+import java.util.StringJoiner;
+
+
+/*
+ * This is a base class that every test class must extend if it needs to be run
+ * with security mode.
+ */
+public class JAXPPolicyManager {
+ /*
+ * Backing up policy.
+ */
+ private Policy policyBackup;
+
+ /*
+ * Backing up security manager.
+ */
+ private SecurityManager smBackup;
+
+ /*
+ * Current policy.
+ */
+ private TestPolicy policy = new TestPolicy();
+
+ /*
+ * JAXPPolicyManager singleton.
+ */
+ private static JAXPPolicyManager policyManager = null;
+
+ /*
+ * Install a SecurityManager along with a default Policy to allow testNG to
+ * run when there is a security manager.
+ */
+ private JAXPPolicyManager() {
+ // Backing up policy and security manager for restore
+ policyBackup = Policy.getPolicy();
+ smBackup = System.getSecurityManager();
+
+ // Set customized policy
+ setDefaultPermissions();
+ Policy.setPolicy(policy);
+ System.setSecurityManager(new SecurityManager());
+ }
+
+ static synchronized JAXPPolicyManager getJAXPPolicyManager(boolean createIfNone) {
+ if (policyManager == null & createIfNone)
+ policyManager = new JAXPPolicyManager();
+ return policyManager;
+ }
+
+ private void teardown() throws Exception {
+ System.setSecurityManager(smBackup);
+ Policy.setPolicy(policyBackup);
+ }
+
+ /*
+ * Restore the original Policy and SecurityManager.
+ */
+ static synchronized void teardownPolicyManager() throws Exception {
+ if (policyManager != null) {
+ policyManager.teardown();
+ policyManager = null;
+ }
+ }
+
+ /*
+ * Set default permissions, sub-class of JAXPBaseTest should override this
+ * method.
+ */
+ private void setDefaultPermissions() {
+ //Permissions to set security manager and policy
+ addPermission(new SecurityPermission("getPolicy"));
+ addPermission(new SecurityPermission("setPolicy"));
+ addPermission(new RuntimePermission("setSecurityManager"));
+ //Properties that jtreg and TestNG require
+ addPermission(new PropertyPermission("testng.show.stack.frames", "read"));
+ addPermission(new PropertyPermission("test.src", "read"));
+ addPermission(new PropertyPermission("test.classes", "read"));
+ addPermission(new PropertyPermission("dataproviderthreadcount", "read"));
+ addPermission(new PropertyPermission("experimental", "read"));
+ }
+
+ /*
+ * Add permission to the TestPolicy.
+ *
+ * @param permission to be added.
+ */
+ void addPermission(Permission p) {
+ policy.addPermission(p);
+ }
+
+ /*
+ * Add a temporary permission in current thread context. This won't impact
+ * global policy and doesn't support permission combination.
+ *
+ * @param permission
+ * to add.
+ * @return index of the added permission.
+ */
+ int addTmpPermission(Permission p) {
+ return policy.addTmpPermission(p);
+ }
+
+ /*
+ * set allowAll in current thread context.
+ */
+ void setAllowAll(boolean allow) {
+ policy.setAllowAll(allow);
+ }
+
+ /*
+ * Remove a temporary permission from current thread context.
+ *
+ * @param index to remove.
+ *
+ * @throws RuntimeException if no temporary permission list in current
+ * thread context or no permission correlated to the index.
+ */
+ void removeTmpPermission(int index) {
+ policy.removeTmpPermission(index);
+ }
+
+
+}
+
+/*
+ * Simple Policy class that supports the required Permissions to validate the
+ * JAXP concrete classes.
+ */
+class TestPolicy extends Policy {
+ private final PermissionCollection permissions = new Permissions();
+
+ private ThreadLocal";
private static final String xml = "";
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java b/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java
index 4c3e9de5f16..3b4a945a254 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/common/ValidationWarningsTest.java
@@ -23,8 +23,11 @@
package common;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
import java.io.ByteArrayInputStream;
import java.io.StringReader;
+
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.sax.SAXSource;
@@ -32,24 +35,29 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
-import org.testng.annotations.Test;
+
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
* @test
* @bug 8144593
* @key intermittent
- * @modules javax.xml/com.sun.org.apache.xerces.internal.jaxp
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true common.ValidationWarningsTest
+ * @run testng/othervm common.ValidationWarningsTest
* @summary Check that warnings about unsupported properties from SAX
* parsers are suppressed during the xml validation process.
*/
+@Listeners({jaxp.library.InternalAPIPolicy.class})
public class ValidationWarningsTest extends WarningsTestBase {
@BeforeClass
public void setup() {
//Set test SAX driver implementation.
- System.setProperty("org.xml.sax.driver", "common.TestSAXDriver");
+ setSystemProperty("org.xml.sax.driver", "common.TestSAXDriver");
}
@Test
@@ -76,3 +84,4 @@ public class ValidationWarningsTest extends WarningsTestBase {
private static final String xml = "Element";
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java
index 87d3829e658..5f92bd0a587 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6320118.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,12 +28,18 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6320118
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug6320118
+ * @run testng/othervm datatype.Bug6320118
* @summary Test xml datatype XMLGregorianCalendar.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6320118 {
DatatypeFactory df;
@@ -102,3 +108,4 @@ public class Bug6320118 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java
index 161f127b9b2..1c86badd13c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937951Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,12 +28,18 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6937951
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug6937951Test
+ * @run testng/othervm datatype.Bug6937951Test
* @summary Test midnight is same as the start of the next day in XMLGregorianCalendar.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6937951Test {
@Test
@@ -51,3 +57,4 @@ public class Bug6937951Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java
index 73ea2930cf2..9caf929ccf9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug6937964Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,12 +33,18 @@ import javax.xml.datatype.Duration;
import javax.xml.namespace.QName;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6937964
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug6937964Test
+ * @run testng/othervm datatype.Bug6937964Test
* @summary Test Duration is normalized.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6937964Test {
/**
* Print debugging to System.err.
@@ -264,3 +270,4 @@ public class Bug6937964Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java
index 3bf98f65bed..f680336edc2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/Bug7042647Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,12 +31,18 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 7042647
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.Bug7042647Test
+ * @run testng/othervm datatype.Bug7042647Test
* @summary Test getFirstDayOfWeek is correct after converting XMLGregorianCalendar to a GregorianCalendar.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug7042647Test {
@Test
@@ -54,3 +60,4 @@ public class Bug7042647Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java
index c6977e98967..6ca2985348e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/DatatypeFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -34,11 +34,17 @@ import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.DatatypeFactoryTest
+ * @run testng/othervm datatype.DatatypeFactoryTest
* @summary Test DatatypeFactory.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class DatatypeFactoryTest {
private static final boolean DEBUG = false;
@@ -634,3 +640,4 @@ public class DatatypeFactoryTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java
index ece77adc8fa..76023529624 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/DurationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -39,11 +39,17 @@ import javax.xml.namespace.QName;
import org.testng.Assert;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.DurationTest
+ * @run testng/othervm datatype.DurationTest
* @summary Test Duration.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class DurationTest {
private final static boolean DEBUG = true;
@@ -51,7 +57,7 @@ public class DurationTest {
protected Duration duration = null;
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
try {
duration = DatatypeFactory.newInstance().newDuration(100);
} catch (DatatypeConfigurationException dce) {
@@ -478,3 +484,4 @@ public class DurationTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java
index 87e46373e8b..915a63c71ee 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/FactoryFindTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,45 +23,45 @@
package datatype;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import java.net.URL;
import java.net.URLClassLoader;
import javax.xml.datatype.DatatypeFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.FactoryFindTest
+ * @run testng/othervm datatype.FactoryFindTest
* @summary Test Classloader for DatatypeFactory.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
- public FactoryFindTest(String name) {
- }
-
@Test
- public void testFactoryFind() {
- try {
- // System.setProperty("jaxp.debug", "true");
+ public void testFactoryFind() throws Exception {
+ DatatypeFactory factory = DatatypeFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
- DatatypeFactory factory = DatatypeFactory.newInstance();
- Assert.assertTrue(factory.getClass().getClassLoader() == null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
- Thread.currentThread().setContextClassLoader(null);
- factory = DatatypeFactory.newInstance();
- Assert.assertTrue(factory.getClass().getClassLoader() == null);
-
- Thread.currentThread().setContextClassLoader(new MyClassLoader());
- factory = DatatypeFactory.newInstance();
- if (System.getSecurityManager() == null)
- Assert.assertTrue(myClassLoaderUsed);
- else
- Assert.assertFalse(myClassLoaderUsed);
- } catch (Exception ex) {
- }
+ factory = DatatypeFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
+ factory = DatatypeFactory.newInstance();
+ if (System.getSecurityManager() == null)
+ Assert.assertTrue(myClassLoaderUsed);
+ else
+ Assert.assertFalse(myClassLoaderUsed);
}
class MyClassLoader extends URLClassLoader {
@@ -76,3 +76,4 @@ public class FactoryFindTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java
index 636cf680876..dd0720ded6e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/JDK8068839Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -27,12 +27,18 @@ import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 8068839
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.JDK8068839Test
+ * @run testng/othervm datatype.JDK8068839Test
* @summary Verifies that Duration's edge cases
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class JDK8068839Test {
@Test
@@ -45,3 +51,4 @@ public class JDK8068839Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java b/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java
index 4c3deb901ac..89c5fc63556 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/datatype/XMLGregorianCalendarTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,11 +30,17 @@ import javax.xml.datatype.XMLGregorianCalendar;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true datatype.XMLGregorianCalendarTest
+ * @run testng/othervm datatype.XMLGregorianCalendarTest
* @summary Test XMLGregorianCalendar.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XMLGregorianCalendarTest {
private static final boolean DEBUG = false;
@@ -46,7 +52,7 @@ public class XMLGregorianCalendarTest {
private XMLGregorianCalendar calendar;
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
try {
calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
} catch (DatatypeConfigurationException dce) {
@@ -222,3 +228,4 @@ public class XMLGregorianCalendarTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java
index 3540089c9ef..791146e6564 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4915524.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,16 +29,22 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4915524
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4915524
+ * @run testng/othervm dom.Bug4915524
* @summary Test Document.adoptNode() shall not throw Exception when the source document object is created from different implementation.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4915524 {
String data = "" + "" + "'.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4915748 {
@Test
@@ -68,3 +74,4 @@ public class Bug4915748 {
Assert.assertTrue(hadError[0]);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java
index b18f8094710..b24e9d5818b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966082.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -26,13 +26,19 @@ package dom;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 4966082
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966082
+ * @run testng/othervm dom.Bug4966082
* @summary Test Element.getSchemaTypeInfo() returns an instance of TypeInfo instead of null when the document's schema is an XML DTD.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966082 {
@Test
@@ -47,3 +53,4 @@ public class Bug4966082 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java
index 5244112fe3f..43f1e1aa410 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966138.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,14 +27,20 @@ import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.TypeInfo;
/*
+ * @test
* @bug 4966138
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966138
+ * @run testng/othervm dom.Bug4966138
* @summary Test Element's TypeInfo.getTypeName() returns a name instead of null in case the element is declared using anonymous simple type.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966138 {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -63,3 +69,4 @@ public class Bug4966138 {
Assert.assertTrue(typeNs.length() != 0, "returned typeNamespace shouldn't be empty");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java
index 890ada5f019..5bd158e7723 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966142.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,14 +27,20 @@ import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.TypeInfo;
/*
+ * @test
* @bug 4966142
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966142
+ * @run testng/othervm dom.Bug4966142
* @summary Test TypeInfo.isDerivedFrom(...) works instead of throws UnsupportedOperationException when the TypeInfo instance refers to a simple type.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966142 {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -55,3 +61,4 @@ public class Bug4966142 {
Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java
index 9cf87b200af..1cdbb466c14 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug4966143.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,15 +27,21 @@ import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.TypeInfo;
/*
+ * @test
* @bug 4966143
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug4966143
+ * @run testng/othervm dom.Bug4966143
* @summary Test isDerivedFrom(...) returns true only if the parameter is DERIVATION_EXTENSION,
* in case TypeInfo instance refers to a complex type derived from another complex type by extension.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966143 {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -60,3 +66,4 @@ public class Bug4966143 {
Assert.assertTrue(type.isDerivedFrom("testNS", "Test", 0));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java
index 7b611bd9993..df2eaf3f955 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6339023.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMImplementation;
@@ -36,9 +37,14 @@ import org.w3c.dom.ls.LSParser;
import org.w3c.dom.ls.LSSerializer;
/*
+ * @test
* @bug 6339023
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6339023
+ * @run testng/othervm dom.Bug6339023
* @summary Test normalize-characters.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6339023 {
/*
@@ -133,3 +139,4 @@ public class Bug6339023 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java
index cea41cc9a87..d2656690847 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6355326.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -34,6 +34,7 @@ import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
@@ -43,16 +44,21 @@ import org.w3c.dom.ls.LSParser;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6355326
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6355326
+ * @run testng/othervm dom.Bug6355326
* @summary Test DOM implementation encoding.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6355326 {
DOMImplementationLS implLS = null;
String encodingXML = "";
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
Document doc = null;
DocumentBuilder parser = null;
String xml1 = "";
@@ -112,3 +118,4 @@ public class Bug6355326 {
return p;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java
index c0a3e164834..b1ce0a16db9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6367542.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -24,14 +24,20 @@
package dom;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.bootstrap.DOMImplementationRegistry;
/*
+ * @test
* @bug 6367542
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6367542
+ * @run testng/othervm dom.Bug6367542
* @summary Test DOMImplementationRegistry.getDOMImplementation("XML") returns a DOMImplementation instance.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6367542 {
@Test
@@ -46,3 +52,4 @@ public class Bug6367542 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java
index 982d481014e..b1381c0b8aa 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6520131.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,6 +28,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMError;
@@ -37,9 +38,14 @@ import org.w3c.dom.Element;
import org.w3c.dom.Text;
/*
+ * @test
* @bug 6520131
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6520131
+ * @run testng/othervm dom.Bug6520131
* @summary Test DOMErrorHandler reports an error for invalid character.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6520131 {
@Test
@@ -77,3 +83,4 @@ public class Bug6520131 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java
index 3c9a97644eb..300bde2159a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6521260.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,15 +31,21 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6521260
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6521260
+ * @run testng/othervm dom.Bug6521260
* @summary Test setAttributeNS doesn't result in an unsorted internal list of attributes.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6521260 {
@Test
@@ -71,3 +77,4 @@ public class Bug6521260 {
Assert.assertEquals(systemId, systemId2);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java
index fec67cdfe20..9108af3d7f6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6582545Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +23,8 @@
package dom;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import java.io.File;
import java.io.IOException;
@@ -30,7 +32,10 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import jaxp.library.JAXPTestUtilities;
+
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
@@ -38,9 +43,14 @@ import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6582545
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6582545Test
+ * @run testng/othervm dom.Bug6582545Test
* @summary Test the value is correct when iterating attributes.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6582545Test {
private DocumentBuilder xmlParser = null;
private Document document = null;
@@ -90,7 +100,7 @@ public class Bug6582545Test {
}
// Test specifique a node
- String javaSpecificationVersion = System.getProperty("java.specification.version");
+ String javaSpecificationVersion = getSystemProperty("java.specification.version");
for (int k = 0; k < attributes.getLength(); k++) {
name = attributes.item(k).getNodeName();
value = attributes.item(k).getNodeValue();
@@ -113,3 +123,4 @@ public class Bug6582545Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java
index b19a28ba29a..ff5cf2cda6a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/Bug6879614Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,14 +30,20 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6879614
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.Bug6879614Test
+ * @run testng/othervm dom.Bug6879614Test
* @summary Test DocumentBuilder can parse the certain xml.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6879614Test {
@Test
@@ -72,3 +78,4 @@ public class Bug6879614Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java
index 84c06b829b4..f407e2612e8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6333993Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,14 +33,20 @@ import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
/*
+ * @test
* @bug 6333993
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6333993Test
+ * @run testng/othervm dom.CR6333993Test
* @summary Test NodeList.item(valid index) returns value after NodeList.item(NodeList.getLength()).
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class CR6333993Test {
@Test
@@ -82,3 +88,4 @@ public class CR6333993Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java
index 9bc2c6c3a0f..c8ee54a3acc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517707Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,6 +32,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
@@ -40,9 +41,14 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6517707
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6517707Test
+ * @run testng/othervm dom.CR6517707Test
* @summary Test Node.setNodeValue(value) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class CR6517707Test {
@Test
@@ -122,3 +128,4 @@ public class CR6517707Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java
index 44bab9c37f7..0b5d2e65b2f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6517717Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
@@ -39,9 +40,14 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6517717
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6517717Test
+ * @run testng/othervm dom.CR6517717Test
* @summary Test Node.setPrefix(prefix) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class CR6517717Test {
@Test
@@ -80,3 +86,4 @@ public class CR6517717Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java
index 15dc9636af6..4b46cf9fb60 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/CR6909336Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,14 +29,20 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.dom.DOMResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.bootstrap.DOMImplementationRegistry;
/*
+ * @test
* @bug 6909336
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.CR6909336Test
+ * @run testng/othervm dom.CR6909336Test
* @summary Test DOM writer can write more that 20 nested elements.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class CR6909336Test {
@Test
@@ -66,3 +72,4 @@ public class CR6909336Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java
index 0bc4669c4e6..b4341558e8e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMConfigurationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,6 +33,7 @@ import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
@@ -56,8 +57,13 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.DOMConfigurationTest
+ * @run testng/othervm dom.DOMConfigurationTest
* @summary Test DOMConfiguration for supported properties.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DOMConfigurationTest {
static class TestHandler implements DOMErrorHandler {
@@ -1622,3 +1628,4 @@ public class DOMConfigurationTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java
index ebd97facd4b..672c38e5fda 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/DOMXPathTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -26,13 +26,19 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMImplementation;
/*
+ * @test
* @bug 8042244
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.DOMXPathTest
+ * @run testng/othervm dom.DOMXPathTest
* @summary Verifies that the experimental DOM L3 XPath implementation is no longer available.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class DOMXPathTest {
/*
Verifies that DOMImplementation::hasFeature returns false and getFeature
@@ -48,3 +54,4 @@ public class DOMXPathTest {
Assert.assertEquals(domImpl.getFeature("+XPath", "3.0"), null);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java
index 9227e8f565f..ef87815d166 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ElementTraversal.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -29,6 +29,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.DOMImplementation;
@@ -36,10 +37,15 @@ import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 8135283 8138721
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ElementTraversal
+ * @run testng/othervm dom.ElementTraversal
* @summary Tests for the Element Traversal interface.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ElementTraversal {
/*
Verifies that ElementTraversal is supported.
@@ -111,7 +117,7 @@ public class ElementTraversal {
* DataProvider: a Document object
*/
@DataProvider(name = "doc")
- Object[][] getXPath() {
+ public Object[][] getXPath() {
return new Object[][]{{getDoc()}};
}
Document getDoc() {
@@ -129,3 +135,4 @@ public class ElementTraversal {
return doc;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java
index 4c1269cf79c..19523434cf2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/JdkXmlDomTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -22,19 +22,28 @@
*/
package dom;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 8078139
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.JdkXmlDomTest
+ * @run testng/othervm dom.JdkXmlDomTest
* @summary Verifies that jdk.xml.dom classes are loaded by the ext class loader.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class JdkXmlDomTest {
@Test
public void test() throws ClassNotFoundException {
- ClassLoader cl = ClassLoader.getSystemClassLoader().getParent();
+ ClassLoader cl = runWithAllPerm(() -> ClassLoader.getSystemClassLoader().getParent());
Class> cls = Class.forName("org.w3c.dom.xpath.XPathEvaluator", false, cl);
- Assert.assertTrue(cls.getClassLoader() != null);
+ Assert.assertTrue(runWithAllPerm(() -> cls.getClassLoader()) != null);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java
index 4f4ece1766a..6dc3a24b68d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/TCKEncodingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,14 +31,20 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.TCKEncodingTest
+ * @run testng/othervm dom.TCKEncodingTest
* @summary Test Document.getInputEncoding().
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class TCKEncodingTest {
/**
@@ -96,3 +102,4 @@ public class TCKEncodingTest {
System.out.println("OK");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java
index b16d06c6172..42d8d2457d0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug4973153.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -36,6 +36,7 @@ import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMError;
import org.w3c.dom.DOMErrorHandler;
@@ -49,9 +50,14 @@ import org.w3c.dom.ls.LSSerializer;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 4973153
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug4973153
+ * @run testng/othervm dom.ls.Bug4973153
* @summary Test LSSerialiser.setEncoding() raises 'unsupported-encoding' error if encoding is invalid.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4973153 {
DOMImplementationLS implLS = null;
@@ -94,7 +100,7 @@ public class Bug4973153 {
}
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
Document doc = null;
DocumentBuilder parser = null;
try {
@@ -116,7 +122,7 @@ public class Bug4973153 {
}
@AfterMethod
- protected void tearDown() {
+ public void tearDown() {
implLS = null;
}
@@ -198,3 +204,4 @@ class DOMErrorHandlerImpl implements DOMErrorHandler {
return true;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java
index 9ef91451fbe..f874107cf52 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6290947.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,6 +30,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMImplementation;
@@ -43,10 +44,15 @@ import org.w3c.dom.ls.LSSerializerFilter;
import org.w3c.dom.traversal.NodeFilter;
/*
+ * @test
* @bug 6290947
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6290947
+ * @run testng/othervm dom.ls.Bug6290947
* @summary Test LSSerializer writes the XML declaration when LSSerializerFilter is set that rejects all nodes and
* LSSerializer's configuration set parameter "xml-declaration" to "true".
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6290947 {
private static String XML_STRING = "test1";
@@ -141,3 +147,4 @@ public class Bug6290947 {
return src;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java
index cdaa0cf4d03..f693e33765a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6354955.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
@@ -40,9 +41,14 @@ import org.w3c.dom.ls.LSSerializer;
/*
+ * @test
* @bug 6354955
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6354955
+ * @run testng/othervm dom.ls.Bug6354955
* @summary Test LSSerializer can writeToString on DOM Text node with white space.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6354955 {
@Test
@@ -136,3 +142,4 @@ public class Bug6354955 {
return documentBuilder.newDocument();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java
index d4fcc32aeb9..afd0458ab22 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6376823.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,6 +30,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMImplementation;
@@ -43,9 +44,14 @@ import org.w3c.dom.ls.LSSerializerFilter;
import org.w3c.dom.traversal.NodeFilter;
/*
+ * @test
* @bug 6376823
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6376823
+ * @run testng/othervm dom.ls.Bug6376823
* @summary Test LSSerializer works.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6376823 {
private static String XML_STRING = "test1";
@@ -115,3 +121,4 @@ public class Bug6376823 {
return src;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java
index d0b95b99073..73584b3f16d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/Bug6710741Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -34,9 +35,14 @@ import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSException;
/*
+ * @test
* @bug 6710741
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.Bug6710741Test
+ * @run testng/othervm dom.ls.Bug6710741Test
* @summary Test there should be stack trace information if LSSerializer().writeToString reports an exception.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6710741Test {
@Test
@@ -74,3 +80,4 @@ public class Bug6710741Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java
index 8c609fc594d..3e4f8762b44 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTCKTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMImplementation;
@@ -47,8 +48,13 @@ import org.w3c.dom.traversal.NodeFilter;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.LSParserTCKTest
+ * @run testng/othervm dom.ls.LSParserTCKTest
* @summary Test Specifications and Descriptions for LSParser.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class LSParserTCKTest {
DOMImplementationLS implLS = null;
@@ -578,3 +584,4 @@ public class LSParserTCKTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java
index bf24b878037..1a3c5914942 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSParserTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,6 +27,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMError;
@@ -39,8 +40,13 @@ import org.w3c.dom.ls.LSParser;
import org.w3c.dom.ls.LSResourceResolver;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.LSParserTest
+ * @run testng/othervm dom.ls.LSParserTest
* @summary Test LSParser's DOMConfiguration for supported properties.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class LSParserTest {
@Test
@@ -103,3 +109,4 @@ public class LSParserTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java
index 172d3299d5b..d30baa8945f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/dom/ls/LSSerializerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,6 +33,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMError;
@@ -48,9 +49,14 @@ import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6439439 8080906
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true dom.ls.LSSerializerTest
+ * @run testng/othervm dom.ls.LSSerializerTest
* @summary Test LSSerializer.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class LSSerializerTest {
private static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print";
@@ -313,3 +319,4 @@ public class LSSerializerTest {
Assert.assertEquals(XML11_DOCUMENT_OUTPUT, defaultSerialization, "Invalid serialization of XML 1.1 document: ");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java
index 5c8248a065b..c0e833e318d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4674384_MAX_OCCURS_Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,13 +29,19 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 4674384
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4674384_MAX_OCCURS_Test
+ * @run testng/othervm parsers.Bug4674384_MAX_OCCURS_Test
* @summary Test large maxOccurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4674384_MAX_OCCURS_Test {
@Test
@@ -64,3 +70,4 @@ public class Bug4674384_MAX_OCCURS_Test {
System.out.println("Success: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java
index 50f5514f3af..65943390953 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4934208.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,6 +27,7 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -35,9 +36,14 @@ import org.xml.sax.XMLReader;
import util.DraconianErrorHandler;
/*
+ * @test
* @bug 4934208
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4934208
+ * @run testng/othervm parsers.Bug4934208
* @summary Test SAXParser can parse keyref constraint with a selector that is a union xpath expression selecting a node and its child.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4934208 {
@Test
public void test1() throws Exception {
@@ -68,3 +74,4 @@ public class Bug4934208 {
r.parse(is);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java
index 084323445a9..308b5b11bf0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4967002.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,16 +33,22 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4967002
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4967002
+ * @run testng/othervm parsers.Bug4967002
* @summary Test DocumentBuilderFactory.newDocumentBuilder() throws ParserConfigurationException
* when it uses the "http://java.sun.com/xml/jaxp/properties/schemaSource" property
* and/or the "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property
* in conjunction with setting a Schema object.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4967002 {
String schemaSource = "\n" + "\n" + " \n"
+ " \n" + " \n" + " \n"
@@ -95,3 +101,4 @@ public class Bug4967002 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java
index c87f47187c7..7cc3313fad9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4985486.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -26,14 +26,20 @@ package parsers;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 4985486
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4985486
+ * @run testng/othervm parsers.Bug4985486
* @summary Test SAXParser can parse large characters(more than 10000).
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4985486 {
@Test
@@ -62,3 +68,4 @@ public class Bug4985486 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java
index 6a50919122f..189f5efebee 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991020.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -26,12 +26,18 @@ package parsers;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4991020
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4991020
+ * @run testng/othervm parsers.Bug4991020
* @summary Test XPath like "node_name/." can be parsed.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4991020 {
protected static SAXParser createParser() throws Exception {
@@ -50,3 +56,4 @@ public class Bug4991020 {
parser.parse(Bug4991020.class.getResource("Bug4991020.xml").toExternalForm(), new util.DraconianErrorHandler());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java
index f48e0bdc783..a30cbd8fbc9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug4991946.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -26,12 +26,18 @@ package parsers;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4991946
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug4991946
+ * @run testng/othervm parsers.Bug4991946
* @summary Can parse the element type is anyType in the schema and is substituted by the simple type via the 'xsi:type' attribute in xml document.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4991946 {
protected static SAXParser createParser() throws Exception {
@@ -50,3 +56,4 @@ public class Bug4991946 {
parser.parse(Bug4991946.class.getResource("Bug4991946.xml").toExternalForm(), new util.DraconianErrorHandler());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java
index 68d9a170435..786a2225731 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5010072.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -26,15 +26,21 @@ package parsers;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 5010072
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug5010072
+ * @run testng/othervm parsers.Bug5010072
* @summary Test SchemaFactory throws SAXException if xpath is "@".
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug5010072 {
protected static class ErrorHandler extends DefaultHandler {
@@ -71,3 +77,4 @@ public class Bug5010072 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java
index 9a87104746b..86d766b282e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug5025825.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,15 +33,21 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 5025825
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug5025825
+ * @run testng/othervm parsers.Bug5025825
* @summary Test if SAXParserFactory set a Schema object, when SAXParser sets "http://java.sun.com/xml/jaxp/properties/schemaSource" property
* and/or "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property, it shall throw SAXException.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug5025825 {
String schemaSource = "\n" + "\n" + " \n"
@@ -83,3 +89,4 @@ public class Bug5025825 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java
index fc38d41c3e4..20e49c8a501 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6309988.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +23,9 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
import java.io.File;
import java.io.InputStream;
@@ -33,31 +36,28 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6309988
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6309988
+ * @run testng/othervm parsers.Bug6309988
* @summary Test elementAttributeLimit, maxOccurLimit, entityExpansionLimit.
*/
+@Test(singleThreaded = true)
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6309988 {
DocumentBuilderFactory dbf = null;
- static boolean _isSecureMode = false;
- static {
- if (System.getSecurityManager() != null) {
- _isSecureMode = true;
- System.out.println("Security Manager is present");
- } else {
- System.out.println("Security Manager is NOT present");
- }
- }
/*
* Given XML document has more than 10000 attributes. Exception is expected
*/
- @Test
public void testDOMParserElementAttributeLimit() {
try {
dbf = DocumentBuilderFactory.newInstance();
@@ -75,7 +75,6 @@ public class Bug6309988 {
* Given XML document has more than 10000 attributes. It should report an
* error.
*/
- @Test
public void testDOMNSParserElementAttributeLimit() {
try {
dbf = DocumentBuilderFactory.newInstance();
@@ -94,9 +93,8 @@ public class Bug6309988 {
* Given XML document has more than 10000 attributes. Parsing this XML
* document in non-secure mode, should not report any error.
*/
- @Test
public void testDOMNSParserElementAttributeLimitWithoutSecureProcessing() {
- if (_isSecureMode)
+ if (isSecureMode())
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
@@ -121,16 +119,15 @@ public class Bug6309988 {
* test should be the same as
* testSystemElementAttributeLimitWithSecureProcessing
*/
- @Test
public void testSystemElementAttributeLimitWithoutSecureProcessing() {
- if (_isSecureMode)
+ if (isSecureMode())
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
dbf.setNamespaceAware(true);
- System.setProperty("elementAttributeLimit", "2");
+ setSystemProperty("elementAttributeLimit", "2");
DocumentBuilder parser = dbf.newDocumentBuilder();
Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest3.xml"));
@@ -147,7 +144,7 @@ public class Bug6309988 {
Assert.fail("Unexpected error: " + e.getMessage());
}
} finally {
- System.clearProperty("elementAttributeLimit");
+ clearSystemProperty("elementAttributeLimit");
}
}
@@ -155,12 +152,11 @@ public class Bug6309988 {
* Given XML document has 3 attributes and System property is set to 2.
* Parsing this XML document in secure mode, should report an error.
*/
- @Test
public void testSystemElementAttributeLimitWithSecureProcessing() {
try {
dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
- System.setProperty("elementAttributeLimit", "2");
+ setSystemProperty("elementAttributeLimit", "2");
DocumentBuilder parser = dbf.newDocumentBuilder();
Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest3.xml"));
Assert.fail("SAXParserException is expected, as given XML document contains more than 2 attributes");
@@ -169,14 +165,13 @@ public class Bug6309988 {
} catch (Exception e) {
Assert.fail("Exception " + e.getMessage());
} finally {
- System.setProperty("elementAttributeLimit", "");
+ setSystemProperty("elementAttributeLimit", "");
}
}
/*
* Default value for secure processing feature should be true.
*/
- @Test
public void testDOMSecureProcessingDefaultValue() {
try {
dbf = DocumentBuilderFactory.newInstance();
@@ -190,7 +185,6 @@ public class Bug6309988 {
/*
* Default value for secure processing feature should be true.
*/
- @Test
public void testSAXSecureProcessingDefaultValue() {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -206,16 +200,15 @@ public class Bug6309988 {
* feature is off. Given doument contains more than 2 elements and hence an
* error should be reported.
*/
- @Test
public void testSystemMaxOccurLimitWithoutSecureProcessing() {
- if (_isSecureMode)
+ if (isSecureMode())
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
spf.setValidating(true);
- System.setProperty("maxOccurLimit", "2");
+ setSystemProperty("maxOccurLimit", "2");
// Set the properties for Schema Validation
String SCHEMA_LANG = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
String SCHEMA_TYPE = "http://www.w3.org/2001/XMLSchema";
@@ -230,7 +223,7 @@ public class Bug6309988 {
MyErrorHandler eh = new MyErrorHandler();
parser.parse(is, eh);
Assert.assertFalse(eh.errorOccured, "Not Expected Error");
- System.setProperty("maxOccurLimit", "");
+ setSystemProperty("maxOccurLimit", "");
} catch (Exception e) {
Assert.fail("Exception occured: " + e.getMessage());
}
@@ -242,9 +235,8 @@ public class Bug6309988 {
* maxOccur is '3002'. Since secure processing feature is off, document
* should be parsed without any errors.
*/
- @Test
public void testValidMaxOccurLimitWithOutSecureProcessing() {
- if (_isSecureMode)
+ if (isSecureMode())
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
@@ -279,13 +271,12 @@ public class Bug6309988 {
* test should be the same as
* testSystemElementAttributeLimitWithSecureProcessing
*/
- @Test
public void testSystemEntityExpansionLimitWithOutSecureProcessing() {
- if (_isSecureMode)
+ if (isSecureMode())
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
- System.setProperty("entityExpansionLimit", "2");
+ setSystemProperty("entityExpansionLimit", "2");
dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
dbf.setValidating(true);
@@ -304,7 +295,7 @@ public class Bug6309988 {
Assert.fail("Unexpected error: " + e.getMessage());
}
} finally {
- System.clearProperty("entityExpansionLimit");
+ clearSystemProperty("entityExpansionLimit");
}
}
@@ -312,12 +303,11 @@ public class Bug6309988 {
* System property is set to 2. Given XML document has more than 2 entity
* references. Parsing this document in secure mode, should report an error.
*/
- @Test
public void testSystemEntityExpansionLimitWithSecureProcessing() {
try {
dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(true);
- System.setProperty("entityExpansionLimit", "2");
+ setSystemProperty("entityExpansionLimit", "2");
DocumentBuilder parser = dbf.newDocumentBuilder();
Document doc = parser.parse(this.getClass().getResourceAsStream("entity.xml"));
Assert.fail("SAXParserException is expected, as given XML document contains more 2 entity references");
@@ -327,7 +317,7 @@ public class Bug6309988 {
} catch (Exception e) {
Assert.fail("Exception " + e.getMessage());
} finally {
- System.setProperty("entityExpansionLimit", "");
+ setSystemProperty("entityExpansionLimit", "");
}
}
@@ -335,7 +325,6 @@ public class Bug6309988 {
* Given XML document has more than 64000 entity references. Parsing this
* document in secure mode, should report an error.
*/
- @Test
public void testEntityExpansionLimitWithSecureProcessing() {
try {
dbf = DocumentBuilderFactory.newInstance();
@@ -349,7 +338,7 @@ public class Bug6309988 {
} catch (Exception e) {
Assert.fail("Exception " + e.getMessage());
} finally {
- System.setProperty("entityExpansionLimit", "");
+ setSystemProperty("entityExpansionLimit", "");
}
}
@@ -357,9 +346,8 @@ public class Bug6309988 {
* Given XML document has more than 64000 entity references. Parsing this
* document in non-secure mode, should not report any error.
*/
- @Test
public void testEntityExpansionLimitWithOutSecureProcessing() {
- if (_isSecureMode)
+ if (isSecureMode())
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
@@ -374,7 +362,12 @@ public class Bug6309988 {
} catch (Exception e) {
Assert.fail("Exception " + e.getMessage());
} finally {
- System.setProperty("entityExpansionLimit", "");
+ setSystemProperty("entityExpansionLimit", "");
}
}
+
+ private boolean isSecureMode() {
+ return System.getSecurityManager() != null;
+ }
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java
index 94873dfaab3..5a93c1a515e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6341770.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,29 +23,38 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.util.PropertyPermission;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6341770
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6341770
+ * @run testng/othervm parsers.Bug6341770
* @summary Test external entity linked to non-ASCII base URL.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6341770 {
// naming a file "aux" would fail on windows.
@Test
public void testNonAsciiURI() {
try {
- File dir = File.createTempFile("sko\u0159ice", null);
+ File dir = new File("sko\u0159ice");
dir.delete();
dir.mkdir();
File main = new File(dir, "main.xml");
@@ -60,11 +69,13 @@ public class Bug6341770 {
w.flush();
w.close();
System.out.println("Parsing: " + main);
- SAXParserFactory.newInstance().newSAXParser().parse(main, new DefaultHandler() {
- public void startElement(String uri, String localname, String qname, Attributes attr) throws SAXException {
- System.out.println("encountered <" + qname + ">");
- }
- });
+ tryRunWithTmpPermission(
+ () -> SAXParserFactory.newInstance().newSAXParser().parse(main, new DefaultHandler() {
+ public void startElement(String uri, String localname, String qname, Attributes attr)
+ throws SAXException {
+ System.out.println("encountered <" + qname + ">");
+ }
+ }), new PropertyPermission("user.dir", "read"));
} catch (Exception e) {
e.printStackTrace();
Assert.fail("Exception: " + e.getMessage());
@@ -72,3 +83,4 @@ public class Bug6341770 {
System.out.println("OK.");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java
index f3bfb88fce1..1e0e25a3bc0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6361283.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,12 +27,18 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6361283
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6361283
+ * @run testng/othervm parsers.Bug6361283
* @summary Test SAXParser returns version as 1.1 for XML 1.1 document.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6361283 {
@Test
@@ -50,3 +56,4 @@ public class Bug6361283 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java
index a7e82d51eab..eab6d6dbdb8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6506304Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,21 +23,29 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.XMLReader;
/*
+ * @test
* @bug 6506304
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6506304Test
+ * @run testng/othervm parsers.Bug6506304Test
* @summary Test MalformedURLException: unknown protocol won't be thrown when there is a space within the full path file name.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6506304Test {
public static boolean isWindows = false;
static {
- if (System.getProperty("os.name").indexOf("Windows") > -1) {
+ if (getSystemProperty("os.name").indexOf("Windows") > -1) {
isWindows = true;
}
};
@@ -63,3 +71,4 @@ public class Bug6506304Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java
index c6a03542a43..ab23e378732 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6518733.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,15 +29,21 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6518733
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6518733
+ * @run testng/othervm parsers.Bug6518733
* @summary Test SAX parser handles several attributes that each contain a newline within the attribute value.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6518733 {
@Test
@@ -61,3 +67,4 @@ public class Bug6518733 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java
index e7aa719dd81..1ae8c810fd9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6564400.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,6 +38,7 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -46,9 +47,14 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6564400
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6564400
+ * @run testng/othervm parsers.Bug6564400
* @summary Test ignorable whitespace handling with schema validation.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6564400 {
private boolean sawIgnorable = false;
Schema schema = null;
@@ -174,3 +180,4 @@ public class Bug6564400 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java
index ff3d19388e6..dd12ea5e254 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,12 +29,18 @@ import java.io.StringBufferInputStream;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6573786
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6573786
+ * @run testng/othervm parsers.Bug6573786
* @summary Test parser error messages are formatted.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6573786 {
String _cache = "";
@@ -67,3 +73,4 @@ public class Bug6573786 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java
index b938eb6eb6f..f4595896db7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6573786ErrorHandler.java
@@ -45,3 +45,4 @@ public class Bug6573786ErrorHandler extends DefaultHandler {
System.out.println(e.getMessage());
} // warning ()
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java
index a89d834642f..411bdf7c422 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6594813.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -34,14 +34,20 @@ import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6594813
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6594813
+ * @run testng/othervm parsers.Bug6594813
* @summary Test SAXParser output is wellformed with name space.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6594813 {
public Bug6594813(String name) {
@@ -169,3 +175,4 @@ public class Bug6594813 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java
index db724d83e86..67f596b284f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6608841.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,14 +30,20 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6608841
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6608841
+ * @run testng/othervm parsers.Bug6608841
* @summary Test SAX parses external parameter entity.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6608841 {
public Bug6608841(String name) {
}
@@ -53,3 +59,4 @@ public class Bug6608841 {
public class MyHandler extends DefaultHandler {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java
index 25f536f73bb..5d4359ae368 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6690015.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,6 +28,7 @@ import java.io.FileInputStream;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -37,9 +38,14 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 6518733
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6690015
+ * @run testng/othervm parsers.Bug6690015
* @summary Test SAX parser handles several attributes with newlines.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6690015 {
public Bug6690015() {
@@ -81,3 +87,4 @@ public class Bug6690015 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java
index cfd2fe26a74..9e6514aded4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6760982.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
@@ -39,9 +40,14 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 6518733
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6760982
+ * @run testng/othervm parsers.Bug6760982
* @summary Test SAX parser handles several attributes with containing ">".
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6760982 {
@Test
@@ -162,3 +168,4 @@ public class Bug6760982 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java
index c65bd1bc285..4c9f3c0e11f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug6849942Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,15 +29,21 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.ProcessingInstruction;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 6849942
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug6849942Test
+ * @run testng/othervm parsers.Bug6849942Test
* @summary Test parsing an XML that starts with a processing instruction and no prolog.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6849942Test {
@Test
@@ -75,3 +81,4 @@ public class Bug6849942Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java
index bd1e303dc17..26f3f8a595a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7157608Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +23,8 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import java.io.File;
import java.io.IOException;
@@ -31,6 +33,7 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
@@ -39,13 +42,18 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 7157608
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug7157608Test
+ * @run testng/othervm parsers.Bug7157608Test
* @summary Test feature standard-uri-conformant works.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug7157608Test {
public static boolean isWindows = false;
static {
- if (System.getProperty("os.name").indexOf("Windows") > -1) {
+ if (getSystemProperty("os.name").indexOf("Windows") > -1) {
isWindows = true;
}
};
@@ -53,7 +61,7 @@ public class Bug7157608Test {
String xml1, xml2;
@BeforeMethod
- protected void setUp() throws IOException {
+ public void setUp() throws IOException {
File file1 = new File(getClass().getResource("Bug7157608.xml").getFile());
xml1 = file1.getPath().replace("\\", "\\\\");
File file2 = new File(getClass().getResource("Bug7157608_1.xml").getFile());
@@ -210,3 +218,4 @@ public class Bug7157608Test {
boolean validating = false;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java
index 7230f9c1488..ed727064128 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug7166896Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,14 +30,20 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 7166896
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug7166896Test
+ * @run testng/othervm parsers.Bug7166896Test
* @summary Test DocumentBuilder.parse(String uri) supports IPv6 format.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug7166896Test {
@Test
@@ -74,3 +80,4 @@ public class Bug7166896Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java
new file mode 100644
index 00000000000..efa75ed9838
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147Test.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003147
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @compile Bug8003147TestClass.java
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug8003147Test
+ * @run testng/othervm parsers.Bug8003147Test
+ * @summary Test port fix for BCEL bug 39695.
+ */
+
+package parsers;
+
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
+import java.io.FileOutputStream;
+import java.io.FilePermission;
+
+import jaxp.library.JAXPTestUtilities;
+
+import org.testng.Assert;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
+import com.sun.org.apache.bcel.internal.classfile.ClassParser;
+import com.sun.org.apache.bcel.internal.classfile.ConstantClass;
+import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
+import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
+import com.sun.org.apache.bcel.internal.classfile.JavaClass;
+import com.sun.org.apache.bcel.internal.classfile.Method;
+import com.sun.org.apache.bcel.internal.generic.ClassGen;
+import com.sun.org.apache.bcel.internal.generic.MethodGen;
+
+@Listeners({ jaxp.library.FilePolicy.class, jaxp.library.InternalAPIPolicy.class })
+public class Bug8003147Test {
+
+ @Test
+ public void test() throws Exception {
+ // Note: com.sun.org.apache.bcel.internal.classfile.JavaClass doesn't
+ // support InvokeDynamic, so can't use lambda, also can't use string1 +
+ // string2, because javac will generate a dynamic call where invoking
+ // string1.concat(string2), so create a separate Bug8003147TestClass
+ JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+ String classfile = getSystemProperty("test.classes") + "/parsers/Bug8003147TestClass.class";
+ JavaClass jc = new ClassParser(classfile).parse();
+
+ // rename class
+ ConstantPool cp = jc.getConstantPool();
+ int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex();
+ cp.setConstant(cpIndex, new ConstantUtf8("parsers/Bug8003147TestClassPrime"));
+ ClassGen gen = new ClassGen(jc);
+ Method[] methods = jc.getMethods();
+ int index;
+ for (index = 0; index < methods.length; index++) {
+ if (methods[index].getName().equals("doSomething")) {
+ break;
+ }
+ }
+ Method m = methods[index];
+ MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool());
+ gen.replaceMethod(m, mg.getMethod());
+ String path = classfile.replace("Bug8003147TestClass", "Bug8003147TestClassPrime");
+ gen.getJavaClass().dump(new FileOutputStream(path));
+
+ try {
+ Class.forName("parsers.Bug8003147TestClassPrime");
+ } catch (ClassFormatError cfe) {
+ cfe.printStackTrace();
+ Assert.fail("modified version of class does not pass verification");
+ }
+ }, new FilePermission(getSystemProperty("test.classes") + "/-", "read,write"));
+ }
+}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147TestClass.java
similarity index 77%
rename from jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java
rename to jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147TestClass.java
index 340f5de7d55..f9da51202e1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8003147TestClass.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 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
@@ -21,15 +21,15 @@
* questions.
*/
-package policy;
+package parsers;
-import java.security.Policy;
+import java.util.ArrayList;
-public class PolicyUtil {
-
- public static void changePolicy(String policyFile) {
- System.setProperty("java.security.policy", policyFile);
- Policy.getPolicy().refresh();
+/*
+ * Class for Bug8003147Test, includes a method, which has a generic argument
+ */
+public class Bug8003147TestClass {
+ public void doSomething(double d, ArrayList list) {
}
-
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java
index 5a034c378b9..eae5319f34d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/Bug8073385.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,37 +23,46 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+import static org.testng.Assert.assertTrue;
+
import java.io.StringReader;
import java.util.Locale;
-import javax.xml.parsers.DocumentBuilderFactory;
+
import javax.xml.parsers.DocumentBuilder;
-import org.xml.sax.SAXException;
-import org.xml.sax.InputSource;
+import javax.xml.parsers.DocumentBuilderFactory;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
-import static org.testng.Assert.assertTrue;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
/**
+ * @test
* @bug 8073385
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.Bug8073385
+ * @run testng/othervm parsers.Bug8073385
* @summary test that invalid XML character exception string contains
* information about character value, element and attribute names
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug8073385 {
private Locale defLoc;
@BeforeClass
- private void setup() {
+ public void setup() {
defLoc = Locale.getDefault();
- Locale.setDefault(Locale.ENGLISH);
+ runWithAllPerm(() -> Locale.setDefault(Locale.ENGLISH));
}
@AfterClass
- private void cleanup() {
- Locale.setDefault(defLoc);
+ public void cleanup() {
+ runWithAllPerm(() -> Locale.setDefault(defLoc));
}
@DataProvider(name = "illegalCharactersData")
@@ -91,3 +100,4 @@ public class Bug8073385 {
assertTrue(exceptionText.contains("Unicode: " + hexString));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java
index 031b0fea2a2..2a4d7c17514 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/FactoryFindTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,42 +23,44 @@
package parsers;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import java.net.URL;
import java.net.URLClassLoader;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.FactoryFindTest
+ * @run testng/othervm parsers.FactoryFindTest
* @summary Test Classloader for SAXParserFactory.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
@Test
public void testFactoryFind() {
- try {
- // System.setProperty("jaxp.debug", "true");
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
- SAXParserFactory factory = SAXParserFactory.newInstance();
- Assert.assertTrue(factory.getClass().getClassLoader() == null);
-
- Thread.currentThread().setContextClassLoader(null);
- factory = SAXParserFactory.newInstance();
- Assert.assertTrue(factory.getClass().getClassLoader() == null);
-
- Thread.currentThread().setContextClassLoader(new MyClassLoader());
- factory = SAXParserFactory.newInstance();
- if (System.getSecurityManager() == null)
- Assert.assertTrue(myClassLoaderUsed);
- else
- Assert.assertFalse(myClassLoaderUsed);
- } catch (Exception ex) {
- }
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
+ factory = SAXParserFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
+ factory = SAXParserFactory.newInstance();
+ if (System.getSecurityManager() == null)
+ Assert.assertTrue(myClassLoaderUsed);
+ else
+ Assert.assertFalse(myClassLoaderUsed);
}
class MyClassLoader extends URLClassLoader {
@@ -73,3 +75,4 @@ public class FactoryFindTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java
index c690163eb86..52874b90362 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyDefaultHandler.java
@@ -45,3 +45,4 @@ public class MyDefaultHandler extends DefaultHandler {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java
index 695c932f603..fb01c19171a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/MyErrorHandler.java
@@ -53,3 +53,4 @@ public class MyErrorHandler extends DefaultHandler {
errorOccured = true;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java
index a6dafccba4c..079f25304c9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/ParseEmptyStream.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,13 +29,19 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.ParseEmptyStream
+ * @run testng/othervm parsers.ParseEmptyStream
* @summary Test SAXParser doesn't accept empty stream.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class ParseEmptyStream {
SAXParserFactory factory = null;
@@ -86,3 +92,4 @@ public class ParseEmptyStream {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java
index 7430e03f5c4..63e2371d75e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/SupplementaryChars.java
@@ -5,18 +5,24 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/**
+ * @test
* @bug 8072081
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.SupplementaryChars
+ * @run testng/othervm parsers.SupplementaryChars
* @summary verifies that supplementary characters are supported as character
* data in xml 1.0, and also names in xml 1.1.
*
* Joe Wang (huizhe.wang@oracle.com)
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class SupplementaryChars {
@Test(dataProvider = "supported")
@@ -34,7 +40,7 @@ public class SupplementaryChars {
}
@DataProvider(name = "supported")
- private Object[][] supported() {
+ public Object[][] supported() {
return new Object[][] {
{"\uD840\uDC0B"},
@@ -47,7 +53,7 @@ public class SupplementaryChars {
}
@DataProvider(name = "unsupported")
- private Object[][] unsupported() {
+ public Object[][] unsupported() {
return new Object[][] {
{"in tag name"},
{"in attribute name"}
@@ -65,3 +71,4 @@ public class SupplementaryChars {
return parser;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java b/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java
index 841191704eb..a1c83eb9c00 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/parsers/xinclude/Bug6794483Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -37,15 +37,21 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
/*
+ * @test
* @bug 6794483 8080908
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true parsers.xinclude.Bug6794483Test
+ * @run testng/othervm parsers.xinclude.Bug6794483Test
* @summary Test JAXP parser can resolve the included content properly if the
* included xml contains an empty tag that ends with "/>", refer to XERCESJ-1134.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6794483Test {
@Test
@@ -101,3 +107,4 @@ public class Bug6794483Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy b/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy
deleted file mode 100644
index 0ca5f742c09..00000000000
--- a/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy
+++ /dev/null
@@ -1,27 +0,0 @@
-grant {
- permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
- permission java.lang.RuntimePermission "accessDeclaredMembers";
-
- permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
- permission java.io.FilePermission ".", "read, write, delete";
- permission java.util.PropertyPermission "*", "read, write";
-
- permission java.lang.RuntimePermission "setSecurityManager";
- permission java.lang.RuntimePermission "createSecurityManager";
- permission java.lang.RuntimePermission "createClassLoader";
- permission java.lang.RuntimePermission "setIO";
- permission java.lang.RuntimePermission "setContextClassLoader";
- permission java.security.SecurityPermission "getPolicy";
-
- permission java.io.FilePermission "${test.src}/-", "read, write, delete";
- permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
- permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
-
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.bcel.internal.classfile";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.bcel.internal.generic";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.stream.writers";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xerces.internal.impl";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal.xsltc.trax";
- permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal.xslt";
-};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java
index e8a1bba6864..a792405cce5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Attributes2ImplTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -24,12 +24,18 @@
package sax;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ext.Attributes2Impl;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Attributes2ImplTest
+ * @run testng/othervm sax.Attributes2ImplTest
* @summary Test Attributes2Impl.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Attributes2ImplTest {
@Test
@@ -147,3 +153,4 @@ public class Attributes2ImplTest {
Assert.assertTrue(impl1.getQName(2).equals(impl3.getQName(2)));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java
index e5043aa0f48..651e804a89d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6889654Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,15 +30,21 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6889654
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6889654Test
+ * @run testng/othervm sax.Bug6889654Test
* @summary Test SAXException includes whole information.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6889654Test {
final String MSG = "Failed to parse XML";
@@ -81,3 +87,4 @@ public class Bug6889654Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java
index 5679ed6b262..96303049be7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6925410Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -25,14 +25,20 @@ package sax;
import javax.xml.datatype.DatatypeConfigurationException;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import org.xml.sax.helpers.XMLReaderFactory;
/*
+ * @test
* @bug 6925410
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6925410Test
+ * @run testng/othervm sax.Bug6925410Test
* @summary Test XMLReaderFactory can createXMLReader repeatedly.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6925410Test {
@Test
@@ -54,3 +60,4 @@ public class Bug6925410Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java
index d8fd89cd29a..7a6c8618110 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6949607Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,15 +29,21 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6949607
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6949607Test
+ * @run testng/othervm sax.Bug6949607Test
* @summary Test Attributes.getValue returns null when parameter uri is empty.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6949607Test {
final String MSG = "Failed to parse XML";
@@ -75,3 +81,4 @@ public class Bug6949607Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java
index d82fe101f47..47f076553ff 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug6992561Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
@@ -40,9 +41,14 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6992561
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug6992561Test
+ * @run testng/othervm sax.Bug6992561Test
* @summary Test encoding of SystemId in Locator.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6992561Test {
@Test
@@ -80,3 +86,4 @@ public class Bug6992561Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java
index 77809766d5e..198ade37101 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/Bug7057778Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +23,9 @@
package sax;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -33,13 +36,15 @@ import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
+import java.util.PropertyPermission;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import org.testng.annotations.Test;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -48,9 +53,14 @@ import org.xml.sax.XMLReader;
import org.xml.sax.ext.DefaultHandler2;
/*
+ * @test
* @bug 7057778
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.Bug7057778Test
+ * @run testng/othervm sax.Bug7057778Test
* @summary Test the file can be deleted after SAXParser.parse(File, DefaultHandler).
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug7057778Test {
static final String xml = "Bug7057778.xml";
@@ -59,20 +69,22 @@ public class Bug7057778Test {
@Test
public void testParse() {
File src = new File(getClass().getResource(xml).getFile());
- File dst = new File(src.getParent() + File.separator + xml1);
+ File dst = new File(xml1);
try {
copyFile(src, dst);
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser parser = spf.newSAXParser();
XMLReader xmlReader = parser.getXMLReader();
xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", new MyHandler1());
- parser.parse(dst, new MyHandler1());
+ tryRunWithTmpPermission(() -> parser.parse(dst, new MyHandler1()),
+ new PropertyPermission("user.dir", "read"));
} catch (SAXException ex) {
ex.printStackTrace();
} catch (IOException ex) {
// shouldn't happen
} catch (ParserConfigurationException ex) {
// shouldn't happen
+ } catch (Exception ex) {
}
if (dst != null) {
if (dst.delete()) {
@@ -173,7 +185,7 @@ public class Bug7057778Test {
// Start a new line
// and indent the next line appropriately
private void nl() throws SAXException {
- String lineEnd = System.getProperty("line.separator");
+ String lineEnd = getSystemProperty("line.separator");
try {
out.write(lineEnd);
@@ -187,3 +199,4 @@ public class Bug7057778Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java
index 15205d745cb..7d3ff8c0e2e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/DefaultHandler2Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@ import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
@@ -42,8 +43,13 @@ import org.xml.sax.helpers.XMLFilterImpl;
import org.xml.sax.helpers.XMLReaderFactory;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.DefaultHandler2Test
+ * @run testng/othervm sax.DefaultHandler2Test
* @summary Test DefaultHandler2.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DefaultHandler2Test {
@Test
@@ -245,3 +251,4 @@ public class DefaultHandler2Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java b/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java
index b5a46472f34..6c52f6d69bd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/IssueTracker56Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@ import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.ErrorHandler;
@@ -39,9 +40,14 @@ import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6809409
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.IssueTracker56Test
+ * @run testng/othervm sax.IssueTracker56Test
* @summary Test SAXException has Cause.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class IssueTracker56Test {
@Test
@@ -136,3 +142,4 @@ public class IssueTracker56Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java b/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java
index 44ac9fde73d..b36ae9aa88a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/MyDefaultHandler2.java
@@ -198,3 +198,4 @@ public class MyDefaultHandler2 extends DefaultHandler2 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java b/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java
index c04ecc7ab54..4ade4a8d76a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/NSSupportTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,12 +27,18 @@ import java.util.Enumeration;
import org.testng.Assert;
import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.helpers.NamespaceSupport;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.NSSupportTest
+ * @run testng/othervm sax.NSSupportTest
* @summary Test NamespaceSupport.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class NSSupportTest {
@Test
@@ -226,3 +232,4 @@ public class NSSupportTest {
Assert.assertNull(nssupport.getURI(""));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java b/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java
index 9b9800d27fa..a4c0e184458 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/SAXExceptionExt.java
@@ -38,3 +38,4 @@ public class SAXExceptionExt extends SAXException {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java
index 5b0120418cd..73c92da706a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/sax/XMLReaderTest.java
@@ -23,18 +23,27 @@
package sax;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
+
import org.testng.annotations.AfterClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLReaderAdapter;
/*
+ * @test
* @bug 8158246
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true sax.XMLReaderTest
+ * @run testng/othervm sax.XMLReaderTest
* @summary This class contains tests that cover the creation of XMLReader.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XMLReaderTest {
private final String SAX_PROPNAME = "org.xml.sax.driver";
@@ -43,7 +52,7 @@ public class XMLReaderTest {
*/
@AfterClass
public void cleanUp() throws Exception {
- System.clearProperty(SAX_PROPNAME);
+ clearSystemProperty(SAX_PROPNAME);
}
/*
@@ -57,7 +66,8 @@ public class XMLReaderTest {
public void testcreateXMLReader() throws SAXException, ParserConfigurationException {
String className = SAXParserFactory.newInstance().newSAXParser()
.getXMLReader().getClass().getName();
- System.setProperty(SAX_PROPNAME, className + "nosuch");
+ setSystemProperty(SAX_PROPNAME, className + "nosuch");
XMLReaderAdapter adapter = new XMLReaderAdapter();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
index 01d54e05785..f9dbc0d4591 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.AttributeLocalNameTest.AttributeLocalNameTest
+ * @run testng/othervm stream.AttributeLocalNameTest.AttributeLocalNameTest
* @summary Test XMLStreamReader.getAttributeLocalName().
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class AttributeLocalNameTest {
static final String XML = "" + "";
@@ -60,3 +66,4 @@ public class AttributeLocalNameTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java
index f386e5d5a30..97cf8292b5e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6370703.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,12 +27,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6370703
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6370703
+ * @run testng/othervm stream.Bug6370703
* @summary Test StAX parser can parse attribute default value when START_ELEMENT.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6370703 {
private static String INPUT_FILE = "sgml.xml";
@@ -63,3 +69,4 @@ public class Bug6370703 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java
index f273d1f002e..8848cb4f76f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6378422.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -26,12 +26,18 @@ package stream;
import javax.xml.stream.XMLInputFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6378422
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6378422
+ * @run testng/othervm stream.Bug6378422
* @summary Test setting reuse-instance property on StAX factory.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6378422 {
@Test
@@ -45,3 +51,4 @@ public class Bug6378422 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java
index 8eb6a7ffad9..6ad9bfc092a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6380870.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,12 +27,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6380870
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6380870
+ * @run testng/othervm stream.Bug6380870
* @summary Test StAX parser can parse VoiceXML DTD.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6380870 {
private static String INPUT_FILE = "basic-form.vxml";
@@ -52,3 +58,4 @@ public class Bug6380870 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java
index 9cc264a4fd6..39cdcb0f9db 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6489502.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6489502
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6489502
+ * @run testng/othervm stream.Bug6489502
* @summary Test XMLInputFactory works correctly in case it repeats to create reader.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6489502 {
public java.io.File input;
@@ -77,3 +83,4 @@ public class Bug6489502 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java
index b92f4bf0757..54eeb8b60e4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6509774.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,12 +28,18 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6509774
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6509774
+ * @run testng/othervm stream.Bug6509774
* @summary Test Property javax.xml.stream.supportDTD, DTD events are now returned even if supportDTD=false.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6509774 {
@Test
@@ -168,3 +174,4 @@ public class Bug6509774 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java
index 57bb97ed144..dca27beec11 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6688002Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -34,12 +34,18 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6688002
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6688002Test
+ * @run testng/othervm stream.Bug6688002Test
* @summary Test single instance of XMLOutputFactory/XMLInputFactory create multiple Writer/Readers in parallel.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6688002Test {
private static final XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
@@ -107,3 +113,4 @@ public class Bug6688002Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java
index ac317469cd7..a3f09aa7334 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/Bug6976938Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,12 +31,18 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6976938
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.Bug6976938Test
+ * @run testng/othervm stream.Bug6976938Test
* @summary Test StAX parser won't throw StackOverflowError while reading valid XML file, in case the text content of an XML element contains many lines like "< ... >".
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6976938Test {
private static final String INPUT_FILE = "Bug6976938.xml";
@@ -94,3 +100,4 @@ public class Bug6976938Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java
index 70f286cefbe..0b00c3c654c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/CoalesceTest/CoalesceTest.java
@@ -32,11 +32,17 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.CoalesceTest.CoalesceTest
+ * @run testng/othervm stream.CoalesceTest.CoalesceTest
* @summary Test Coalesce property works.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CoalesceTest {
String countryElementContent = "START India CS}}}}}} India END";
@@ -104,3 +110,4 @@ public class CoalesceTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java
index aa72e3fb139..b7947fd2f44 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EntitiesTest/EntityTest.java
@@ -37,18 +37,24 @@ import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EntitiesTest.EntityTest
+ * @run testng/othervm stream.EntitiesTest.EntityTest
* @summary Test StAX parses entity.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class EntityTest {
XMLInputFactory factory = null;
String output = "";
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
try {
factory = XMLInputFactory.newInstance();
} catch (Exception ex) {
@@ -57,7 +63,7 @@ public class EntityTest {
}
@AfterMethod
- protected void tearDown() {
+ public void tearDown() {
factory = null;
}
@@ -173,3 +179,4 @@ public class EntityTest {
return true;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java
index b314ff7a022..87246ebd13b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventReaderDelegateTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +23,7 @@
package stream;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
@@ -39,8 +40,13 @@ import javax.xml.stream.events.XMLEvent;
import javax.xml.stream.util.EventReaderDelegate;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventReaderDelegateTest
+ * @run testng/othervm stream.EventReaderDelegateTest
* @summary Test EventReaderDelegate.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class EventReaderDelegateTest {
public EventReaderDelegateTest(String name) {
@@ -225,3 +231,4 @@ public class EventReaderDelegateTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java
index 738f4e3329a..56f97c54b48 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue41Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -48,12 +48,18 @@ import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6631268
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue41Test
+ * @run testng/othervm stream.EventsTest.Issue41Test
* @summary Test XMLEvent.writeAsEncodedUnicode can output the event content.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Issue41Test {
public java.io.File input;
@@ -172,3 +178,4 @@ public class Issue41Test {
System.out.println(sw.toString());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java
index b5673029449..4d3b144aca6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue48Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -37,12 +37,18 @@ import javax.xml.stream.events.NotationDeclaration;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6620632
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue48Test
+ * @run testng/othervm stream.EventsTest.Issue48Test
* @summary Test XMLEventReader can parse notation and entity information from DTD Event.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Issue48Test {
public java.io.File input;
@@ -109,3 +115,4 @@ public class Issue48Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java
index 7193d27e48f..1e30efb2ca4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue53Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,11 +27,17 @@ import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.events.StartDocument;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue53Test
+ * @run testng/othervm stream.EventsTest.Issue53Test
* @summary Test encodingSet/standaloneSet returns correct result in case encoding/standalone is set when constructing StartDocument.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Issue53Test {
@Test
@@ -65,3 +71,4 @@ public class Issue53Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java
index 3c467411b70..8e00999acb4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/EventsTest/Issue58Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,11 +32,17 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.EventsTest.Issue58Test
+ * @run testng/othervm stream.EventsTest.Issue58Test
* @summary Test XMLEvent.getLocation() returns a non-volatile Location.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Issue58Test {
public java.io.File input;
@@ -78,3 +84,4 @@ public class Issue58Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java
index f016df38df4..8e908b0e37e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/FactoryFindTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +23,9 @@
package stream;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -36,33 +39,38 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.FactoryFindTest
+ * @run testng/othervm stream.FactoryFindTest
* @summary Test SaTX factory using factory property and using ContextClassLoader.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory";
- @BeforeClass
- public void setup(){
- policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile());
- }
+// @BeforeClass
+// public void setup(){
+// policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile());
+// }
- @Test
+ @Test(enabled=false) // due to 8156508
public void testFactoryFindUsingStaxProperties() {
// If property is defined, will take precendence so this test
// is ignored :(
- if (System.getProperty(FACTORY_KEY) != null) {
+ if (getSystemProperty(FACTORY_KEY) != null) {
return;
}
Properties props = new Properties();
- String configFile = System.getProperty("java.home") + File.separator + "lib" + File.separator + "stax.properties";
+ String configFile = getSystemProperty("java.home") + File.separator + "lib" + File.separator + "stax.properties";
File f = new File(configFile);
if (f.exists()) {
@@ -96,17 +104,18 @@ public class FactoryFindTest {
@Test
public void testFactoryFind() {
try {
- // System.setProperty("jaxp.debug", "true");
+ // setSystemProperty("jaxp.debug", "true");
XMLInputFactory factory = XMLInputFactory.newInstance();
Assert.assertTrue(factory.getClass().getClassLoader() == null);
- Thread.currentThread().setContextClassLoader(null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
factory = XMLInputFactory.newInstance();
Assert.assertTrue(factory.getClass().getClassLoader() == null);
- Thread.currentThread().setContextClassLoader(new MyClassLoader());
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
factory = XMLInputFactory.newInstance();
+ // because it's decided by having sm or not in FactoryFind code
if (System.getSecurityManager() == null)
Assert.assertTrue(myClassLoaderUsed);
else
@@ -115,11 +124,11 @@ public class FactoryFindTest {
XMLOutputFactory ofactory = XMLOutputFactory.newInstance();
Assert.assertTrue(ofactory.getClass().getClassLoader() == null);
- Thread.currentThread().setContextClassLoader(null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
ofactory = XMLOutputFactory.newInstance();
Assert.assertTrue(ofactory.getClass().getClassLoader() == null);
- Thread.currentThread().setContextClassLoader(new MyClassLoader());
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
ofactory = XMLOutputFactory.newInstance();
if (System.getSecurityManager() == null)
Assert.assertTrue(myClassLoaderUsed);
@@ -142,3 +151,4 @@ public class FactoryFindTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java
index 5475cba5d6e..44708b22e3e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/IgnoreExternalDTDTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.IgnoreExternalDTDTest
+ * @run testng/othervm stream.IgnoreExternalDTDTest
* @summary Test feature ignore-external-dtd.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class IgnoreExternalDTDTest {
final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory";
@@ -71,3 +77,4 @@ public class IgnoreExternalDTDTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java
index 1234a37a803..44a7dea91c3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/ProcessingInstructionTest/ProcessingInstructionTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.ProcessingInstructionTest.ProcessingInstructionTest
+ * @run testng/othervm stream.ProcessingInstructionTest.ProcessingInstructionTest
* @summary Test XMLStreamReader parses Processing Instruction.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class ProcessingInstructionTest {
@Test
@@ -61,3 +67,4 @@ public class ProcessingInstructionTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java
index d7f9f485fc2..0568bca28bf 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/StreamReaderDelegateTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,11 +38,17 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.util.StreamReaderDelegate;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.StreamReaderDelegateTest
+ * @run testng/othervm stream.StreamReaderDelegateTest
* @summary Test StreamReaderDelegate.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class StreamReaderDelegateTest {
/**
@@ -377,3 +383,4 @@ public class StreamReaderDelegateTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java
index 6c760382c58..75bb79566f2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventLocationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -28,11 +28,17 @@ import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventLocationTest
+ * @run testng/othervm stream.XMLEventLocationTest
* @summary Test XMLEvent Location.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XMLEventLocationTest {
@Test
@@ -76,3 +82,4 @@ public class XMLEventLocationTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java
index 0d554808f79..5ac6f1a221a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6489890.java
@@ -29,12 +29,18 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6489890
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6489890
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6489890
* @summary Test XMLEventReader's initial state is an undefined state, and nextEvent() is START_DOCUMENT.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6489890 {
@Test
@@ -71,3 +77,4 @@ public class Bug6489890 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java
index 566186c4c33..79533441e96 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6555001.java
@@ -22,6 +22,7 @@
*/
package stream.XMLEventReaderTest;
+import java.io.FilePermission;
import java.io.StringReader;
import javax.xml.stream.XMLEventReader;
@@ -29,76 +30,90 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.events.EntityReference;
import javax.xml.stream.events.XMLEvent;
+import jaxp.library.JAXPTestUtilities;
+
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6555001
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6555001
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6555001
* @summary Test StAX parser replaces the entity reference as setting.
*/
+@Listeners({ jaxp.library.BasePolicy.class })
public class Bug6555001 {
- private static final String XML = "" + "'>" + "]>"
- + "&def;&undef;";
+ private static final String XML = ""
+ + "'>" + "]>" + "&def;&undef;";
@Test
public void testReplacing() throws Exception {
- XMLInputFactory factory = XMLInputFactory.newInstance();
- factory.setProperty("javax.xml.stream.isReplacingEntityReferences", true);
+ JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ factory.setProperty("javax.xml.stream.isReplacingEntityReferences", true);
- StringReader sr = new StringReader(XML);
- XMLEventReader reader = factory.createXMLEventReader(sr);
+ StringReader sr = new StringReader(XML);
+ XMLEventReader reader = factory.createXMLEventReader(sr);
- boolean sawUndef = false;
- boolean sawDef = false;
+ boolean sawUndef = false;
+ boolean sawDef = false;
- while (reader.hasNext()) {
- XMLEvent event = reader.nextEvent();
- // System.out.println("Event: " + event);
- if (event.isEntityReference()) {
- EntityReference ref = (EntityReference) event;
- if ("def".equals(ref.getName())) {
- sawDef = true;
- } else if ("undef".equals(ref.getName())) {
- sawUndef = true;
- } else {
- throw new IllegalArgumentException("Unexpected entity name");
+ while (reader.hasNext()) {
+ XMLEvent event = reader.nextEvent();
+ // System.out.println("Event: " + event);
+ if (event.isEntityReference()) {
+ EntityReference ref = (EntityReference) event;
+ if ("def".equals(ref.getName())) {
+ sawDef = true;
+ } else if ("undef".equals(ref.getName())) {
+ sawUndef = true;
+ } else {
+ throw new IllegalArgumentException("Unexpected entity name");
+ }
}
}
- }
- Assert.assertEquals(false, sawDef);
- Assert.assertEquals(true, sawUndef);
- reader.close();
+ Assert.assertEquals(false, sawDef);
+ Assert.assertEquals(true, sawUndef);
+ reader.close();
+ }, new FilePermission("/tmp/this/does/not/exist/but/that/is/ok", "read"));
}
@Test
public void testNotReplacing() throws Exception {
- XMLInputFactory factory = XMLInputFactory.newInstance();
- factory.setProperty("javax.xml.stream.isReplacingEntityReferences", false);
+ JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ factory.setProperty("javax.xml.stream.isReplacingEntityReferences", false);
- StringReader sr = new StringReader(XML);
- XMLEventReader reader = factory.createXMLEventReader(sr);
+ StringReader sr = new StringReader(XML);
+ XMLEventReader reader = factory.createXMLEventReader(sr);
- boolean sawUndef = false;
- boolean sawDef = false;
+ boolean sawUndef = false;
+ boolean sawDef = false;
- while (reader.hasNext()) {
- XMLEvent event = reader.nextEvent();
- // System.out.println("Event: " + event);
- if (event.isEntityReference()) {
- EntityReference ref = (EntityReference) event;
- if ("def".equals(ref.getName())) {
- sawDef = true;
- } else if ("undef".equals(ref.getName())) {
- sawUndef = true;
- } else {
- throw new IllegalArgumentException("Unexpected entity name");
+ while (reader.hasNext()) {
+ XMLEvent event = reader.nextEvent();
+ // System.out.println("Event: " + event);
+ if (event.isEntityReference()) {
+ EntityReference ref = (EntityReference) event;
+ if ("def".equals(ref.getName())) {
+ sawDef = true;
+ } else if ("undef".equals(ref.getName())) {
+ sawUndef = true;
+ } else {
+ throw new IllegalArgumentException("Unexpected entity name");
+ }
}
}
- }
- Assert.assertEquals(true, sawDef);
- Assert.assertEquals(true, sawUndef);
- reader.close();
+ Assert.assertEquals(true, sawDef);
+ Assert.assertEquals(true, sawUndef);
+ reader.close();
+ }, new FilePermission("/tmp/this/does/not/exist/but/that/is/ok", "read"));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java
index 319c50ad7fa..86f2437fc85 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6586466Test.java
@@ -23,6 +23,7 @@
package stream.XMLEventReaderTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import java.io.ByteArrayInputStream;
@@ -33,9 +34,14 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
/*
+ * @test
* @bug 6586466
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6586466Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6586466Test
* @summary Test XMLEventReader.nextTag() shall update internal event state.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6586466Test {
@Test
@@ -60,3 +66,4 @@ public class Bug6586466Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java
index 88d0be0c17d..43e8a6165f1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6613059Test.java
@@ -23,6 +23,7 @@
package stream.XMLEventReaderTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import javax.xml.namespace.QName;
@@ -33,9 +34,14 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
/*
+ * @test
* @bug 6613059
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6613059Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6613059Test
* @summary Test XMLEventReader.nextTag() shall update internal event state, same as 6586466.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6613059Test {
@Test
@@ -83,3 +89,4 @@ public class Bug6613059Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java
index 188d003621a..07309465f99 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6668115Test.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6668115
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6668115Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6668115Test
* @summary Test XMLEventReader.getElementText() shall update last event even if no peek.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6668115Test {
public java.io.File input;
@@ -94,3 +100,4 @@ public class Bug6668115Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java
index 16bf959dc45..a89b976b618 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug6846133Test.java
@@ -26,12 +26,18 @@ package stream.XMLEventReaderTest;
import javax.xml.stream.XMLStreamException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6846133
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug6846133Test
+ * @run testng/othervm stream.XMLEventReaderTest.Bug6846133Test
* @summary Test method getDocumentTypeDeclaration() of DTD Event returns a valid value.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6846133Test {
private static final String xml = "" + "I am some simple html
";
@@ -77,3 +83,4 @@ public class Bug6846133Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java
index f973b3bf33d..2ac01596c50 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Bug8153781.java
@@ -31,15 +31,21 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
/*
+ * @test
* @bug 8153781
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Bug8153781
+ * @run testng/othervm stream.XMLEventReaderTest.Bug8153781
* @summary Test if method skipDTD of class XMLDTDScannerImpl will correctly skip the DTD section,
* even if a call to XMLEntityScanner.scanData for skipping to the closing ']' returns true.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug8153781 {
public static int DOCTYPE_SECTION_LENGTH = XMLEntityManager.DEFAULT_BUFFER_SIZE * 2;
public static int DOCUMENT_LENGTH = DOCTYPE_SECTION_LENGTH + 4096;
@@ -88,3 +94,4 @@ public class Bug8153781 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java
index 161b6e6dcdb..4c6e0c0ffb7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/Issue40Test.java
@@ -32,11 +32,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.Issue40Test
+ * @run testng/othervm stream.XMLEventReaderTest.Issue40Test
* @summary Test XMLEventReader.getElementText() works after calling peek().
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Issue40Test {
public java.io.File input;
@@ -94,3 +100,4 @@ public class Issue40Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java
index 1805e9922f0..d96eea1a1b4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/ReaderToWriterTest.java
@@ -40,11 +40,17 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventWriterTest.ReaderToWriterTest
+ * @run testng/othervm stream.XMLEventWriterTest.ReaderToWriterTest
* @summary Test XMLEventWriter.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ReaderToWriterTest {
private static final XMLEventFactory XML_EVENT_FACTORY = XMLEventFactory.newInstance();
@@ -208,3 +214,4 @@ public class ReaderToWriterTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java
index ab076f27d6e..e04a349d92e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLEventWriterTest/XMLEventWriterTest.java
@@ -36,11 +36,17 @@ import javax.xml.stream.events.XMLEvent;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventWriterTest.XMLEventWriterTest
+ * @run testng/othervm stream.XMLEventWriterTest.XMLEventWriterTest
* @summary Test XMLEventWriter.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class XMLEventWriterTest {
/**
@@ -150,3 +156,4 @@ public class XMLEventWriterTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java
index 17604ac6d09..3ba9ca7776b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6756677Test.java
@@ -23,30 +23,42 @@
package stream.XMLInputFactoryTest;
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
+import java.util.PropertyPermission;
+
import javax.xml.stream.XMLInputFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6756677
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @compile MyInputFactory.java
+ * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.Bug6756677Test
+ * @run testng/othervm stream.XMLInputFactoryTest.Bug6756677Test
* @summary Test XMLInputFactory.newFactory(String factoryId, ClassLoader classLoader).
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6756677Test {
@Test
public void testNewInstance() {
String myFactory = "stream.XMLInputFactoryTest.MyInputFactory";
try {
- System.setProperty("MyInputFactory", myFactory);
- XMLInputFactory xif = XMLInputFactory.newInstance("MyInputFactory", null);
+ setSystemProperty("MyInputFactory", myFactory);
+ XMLInputFactory xif = runWithTmpPermission(() -> XMLInputFactory.newInstance("MyInputFactory", null),
+ new PropertyPermission("MyInputFactory", "read"));
System.out.println(xif.getClass().getName());
Assert.assertTrue(xif.getClass().getName().equals(myFactory));
} catch (UnsupportedOperationException oe) {
Assert.fail(oe.getMessage());
}
-
}
// newFactory was added in StAX 1.2
@@ -55,36 +67,22 @@ public class Bug6756677Test {
String myFactory = "stream.XMLInputFactoryTest.MyInputFactory";
ClassLoader cl = null;
try {
- System.setProperty("MyInputFactory", myFactory);
- XMLInputFactory xif = XMLInputFactory.newFactory("MyInputFactory", cl);
+ setSystemProperty("MyInputFactory", myFactory);
+ XMLInputFactory xif = runWithTmpPermission(() -> XMLInputFactory.newFactory("MyInputFactory", cl),
+ new PropertyPermission("MyInputFactory", "read"));
System.out.println(xif.getClass().getName());
Assert.assertTrue(xif.getClass().getName().equals(myFactory));
} catch (UnsupportedOperationException oe) {
Assert.fail(oe.getMessage());
}
-
}
- String Temp_Result = "";
- boolean PASSED = true;
- boolean FAILED = false;
String XMLInputFactoryClassName = "com.sun.xml.internal.stream.XMLInputFactoryImpl";
String XMLInputFactoryID = "javax.xml.stream.XMLInputFactory";
ClassLoader CL = null;
- // jaxp-test jaxp-product-tests javax.xml.jaxp14.ptests.FactoryTest
- @Test
- public void test() {
- if (!test29()) {
- Assert.fail(Temp_Result);
- }
- if (!test31()) {
- Assert.fail(Temp_Result);
- }
- }
-
/*
* test for XMLInputFactory.newInstance(java.lang.String factoryClassName,
* java.lang.ClassLoader classLoader) classloader is null and
@@ -93,27 +91,10 @@ public class Bug6756677Test {
* XMLInputFactory
*/
@Test
- public boolean test29() {
- try {
- System.setProperty(XMLInputFactoryID, XMLInputFactoryClassName);
- XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, CL);
- if (xif instanceof XMLInputFactory) {
- System.out.println(" test29() passed");
- return PASSED;
- } else {
- System.out.println(" test29() failed");
- Temp_Result = "test29() failed: xif not an instance of XMLInputFactory ";
- return FAILED;
- }
- } catch (javax.xml.stream.FactoryConfigurationError fce) {
- System.out.println("Failed : FactoryConfigurationError in test29 " + fce);
- Temp_Result = "test29() failed ";
- return FAILED;
- } catch (Exception e) {
- System.out.println("Failed : Exception in test29 " + e);
- Temp_Result = "test29() failed ";
- return FAILED;
- }
+ public void test29() throws Exception {
+ setSystemProperty(XMLInputFactoryID, XMLInputFactoryClassName);
+ XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, CL);
+ Assert.assertTrue(xif instanceof XMLInputFactory, "xif should be an instance of XMLInputFactory");
}
/*
@@ -124,28 +105,12 @@ public class Bug6756677Test {
* newInstance of XMLInputFactory
*/
@Test
- public boolean test31() {
- try {
- Bug6756677Test test3 = new Bug6756677Test();
- ClassLoader cl = (test3.getClass()).getClassLoader();
- System.setProperty(XMLInputFactoryID, XMLInputFactoryClassName);
- XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, cl);
- if (xif instanceof XMLInputFactory) {
- System.out.println(" test31() passed");
- return PASSED;
- } else {
- System.out.println(" test31() failed");
- Temp_Result = "test31() failed: xif not an instance of XMLInputFactory ";
- return FAILED;
- }
- } catch (javax.xml.stream.FactoryConfigurationError fce) {
- System.out.println("Failed : FactoryConfigurationError in test31 " + fce);
- Temp_Result = "test31() failed ";
- return FAILED;
- } catch (Exception e) {
- System.out.println("Failed : Exception in test31 " + e);
- Temp_Result = "test31() failed ";
- return FAILED;
- }
+ public void test31() throws Exception {
+ Bug6756677Test test3 = new Bug6756677Test();
+ ClassLoader cl = (test3.getClass()).getClassLoader();
+ setSystemProperty(XMLInputFactoryID, XMLInputFactoryClassName);
+ XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, cl);
+ Assert.assertTrue(xif instanceof XMLInputFactory, "xif should be an instance of XMLInputFactory");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java
index 36cc136dadd..d2e29713e2b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/Bug6909759Test.java
@@ -29,12 +29,18 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6909759
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.Bug6909759Test
+ * @run testng/othervm stream.XMLInputFactoryTest.Bug6909759Test
* @summary Test createXMLStreamReader with StreamSource.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6909759Test {
@@ -60,3 +66,4 @@ public class Bug6909759Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java
index 448a854d45f..dea8f732b46 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/IssueTracker38.java
@@ -31,11 +31,17 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLInputFactoryTest.IssueTracker38
+ * @run testng/othervm stream.XMLInputFactoryTest.IssueTracker38
* @summary Test createXMLEventReader from DOM or SAX source is unsupported.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class IssueTracker38 {
@Test
@@ -86,3 +92,4 @@ public class IssueTracker38 {
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java
index 551d3f0f8d2..d9db7a08344 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLInputFactoryTest/MyInputFactory.java
@@ -158,3 +158,4 @@ public class MyInputFactory extends javax.xml.stream.XMLInputFactory {
throw new UnsupportedOperationException("Not supported yet.");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java
index 15afdafd751..fa764c154a5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/Bug6846132Test.java
@@ -29,13 +29,19 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.sax.SAXResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6846132
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.Bug6846132Test
+ * @run testng/othervm stream.XMLOutputFactoryTest.Bug6846132Test
* @summary Test createXMLStreamWriter with SAXResult won't throw a NullPointerException.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6846132Test {
@Test
@@ -83,3 +89,4 @@ public class Bug6846132Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
index 884c9235d24..8fec5b107da 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
@@ -31,11 +31,17 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.DuplicateNSDeclarationTest
+ * @run testng/othervm stream.XMLOutputFactoryTest.DuplicateNSDeclarationTest
* @summary Test the writing of duplicate namespace declarations when IS_REPAIRING_NAMESPACES is ture.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class DuplicateNSDeclarationTest {
@Test
@@ -77,3 +83,4 @@ public class DuplicateNSDeclarationTest {
Assert.assertEquals(EXPECTED_OUTPUT, buffer.toString());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java
index 96d928c6572..e44a20c3138 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLOutputFactoryTest/StreamResultTest.java
@@ -23,6 +23,8 @@
package stream.XMLOutputFactoryTest;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import java.io.ByteArrayOutputStream;
import javax.xml.stream.XMLEventFactory;
@@ -33,11 +35,17 @@ import javax.xml.transform.stax.StAXResult;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLOutputFactoryTest.StreamResultTest
+ * @run testng/othervm stream.XMLOutputFactoryTest.StreamResultTest
* @summary Test create XMLWriter with variant Result.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class StreamResultTest {
@Test
@@ -85,7 +93,7 @@ public class StreamResultTest {
@Test
public void testEventWriterWithStAXResultNStreamWriter() {
String encoding = "";
- if (System.getProperty("file.encoding").equals("UTF-8")) {
+ if (getSystemProperty("file.encoding").equals("UTF-8")) {
encoding = " encoding=\"UTF-8\"";
}
final String EXPECTED_OUTPUT = "";
@@ -114,7 +122,7 @@ public class StreamResultTest {
@Test
public void testEventWriterWithStAXResultNEventWriter() {
String encoding = "";
- if (System.getProperty("file.encoding").equals("UTF-8")) {
+ if (getSystemProperty("file.encoding").equals("UTF-8")) {
encoding = " encoding=\"UTF-8\"";
}
final String EXPECTED_OUTPUT = "";
@@ -154,3 +162,4 @@ public class StreamResultTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java
index 1a0780398d6..12e7e9a74d9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLResolverTest/XMLResolverTest.java
@@ -34,11 +34,17 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLResolverTest.XMLResolverTest
+ * @run testng/othervm stream.XMLResolverTest.XMLResolverTest
* @summary Test XMLResolver.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class XMLResolverTest {
@Test
@@ -90,3 +96,4 @@ public class XMLResolverTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java
index 3e0dda7d042..403c609db91 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamExceptionTest/ExceptionTest.java
@@ -28,11 +28,17 @@ import java.io.IOException;
import javax.xml.stream.XMLStreamException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamExceptionTest.ExceptionTest
+ * @run testng/othervm stream.XMLStreamExceptionTest.ExceptionTest
* @summary Test XMLStreamException contains the message of the wrapped exception.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class ExceptionTest {
@Test
@@ -47,3 +53,4 @@ public class ExceptionTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java
index 1aa221969d3..5ab83c987f8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481615.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6481615
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.Bug6481615
+ * @run testng/othervm stream.XMLStreamFilterTest.Bug6481615
* @summary Test Filtered XMLStreamReader can return the event type if current state is START_ELEMENT.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6481615 {
static final String XML = "" + "";
@@ -62,3 +68,4 @@ public class Bug6481615 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java
index 9b3273ac09e..ea79d530b11 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/Bug6481678.java
@@ -35,12 +35,18 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6481678
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.Bug6481678
+ * @run testng/othervm stream.XMLStreamFilterTest.Bug6481678
* @summary Test Filtered XMLStreamReader parses namespace correctly.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6481678 {
String rootElement = "fruits";
@@ -219,3 +225,4 @@ public class Bug6481678 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java
index 3df73ae0472..c573a8dfb6b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTest.java
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamFilterTest.HasNextTest
+ * @run testng/othervm stream.XMLStreamFilterTest.HasNextTest
* @summary Test Filtered XMLStreamReader hasNext() always return the correct value if repeat to call it.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class HasNextTest {
private static String INPUT_FILE = "HasNextTest.xml";
@@ -139,3 +145,4 @@ public class HasNextTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java
index 1fd6e20fe08..19748b3afdb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamFilterTest/HasNextTypeFilter.java
@@ -47,3 +47,4 @@ public class HasNextTypeFilter implements EventFilter, StreamFilter {
return types[r.getEventType()];
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java
index b253e95b1b0..3fa5bec18e7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BOMTest.java
@@ -27,12 +27,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6218794
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.BOMTest
+ * @run testng/othervm stream.XMLStreamReaderTest.BOMTest
* @summary Test XMLStreamReader parses BOM UTF-8 and BOM UTF-16 big endian stream.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class BOMTest {
// UTF-8 BOM test file
private static final String INPUT_FILE1 = "UTF8-BOM.xml.data";
@@ -61,3 +67,4 @@ public class BOMTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java
index c73348c744c..a981ba10c77 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6388460.java
@@ -35,13 +35,19 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 6388460
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6388460
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6388460
* @summary Test StAX parser can parse UTF-16 wsdl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6388460 {
@Test
@@ -70,3 +76,4 @@ public class Bug6388460 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java
index c22dde736de..cd083359e1d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6472982Test.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6472982
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6472982Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6472982Test
* @summary Test XMLStreamReader.getNamespaceContext().getPrefix("") won't throw IllegalArgumentException.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6472982Test {
String namespaceURI = "foobar.com";
String rootElement = "foo";
@@ -73,3 +79,4 @@ public class Bug6472982Test {
return sbuffer.toString();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java
index b9ffde7fefd..5a4c0be28a7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6767322Test.java
@@ -29,12 +29,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6767322
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6767322Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6767322Test
* @summary Test XMLStreamReader.getVersion() returns null if a version isn't declared.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6767322Test {
private static final String INPUT_FILE = "Bug6767322.xml";
@@ -70,3 +76,4 @@ public class Bug6767322Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java
index 2480b727d90..cfe1ade63ad 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Bug6847819Test.java
@@ -23,6 +23,7 @@
package stream.XMLStreamReaderTest;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import java.io.StringReader;
@@ -31,9 +32,14 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
/*
+ * @test
* @bug 6847819
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Bug6847819Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Bug6847819Test
* @summary Test StAX parser shall throw XMLStreamException for illegal xml declaration.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6847819Test {
@Test
@@ -63,3 +69,4 @@ public class Bug6847819Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java
index 15e01a21896..a2cf3c2ae9b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/BugTest.java
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.BugTest
+ * @run testng/othervm stream.XMLStreamReaderTest.BugTest
* @summary Test StAX parser can parse xml without declaration.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class BugTest {
@Test
@@ -45,3 +51,4 @@ public class BugTest {
Assert.assertEquals(XMLStreamConstants.START_DOCUMENT, r.getEventType());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java
index 6ce3bd4568d..10db94b8203 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DefaultAttributeTest.java
@@ -34,11 +34,17 @@ import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.DefaultAttributeTest
+ * @run testng/othervm stream.XMLStreamReaderTest.DefaultAttributeTest
* @summary Test StAX parses namespace and attribute.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DefaultAttributeTest {
private static final String INPUT_FILE = "ExternalDTD.xml";
@@ -102,3 +108,4 @@ public class DefaultAttributeTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
index df1ced6bb61..493d6b31545 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.DoubleXmlnsTest
+ * @run testng/othervm stream.XMLStreamReaderTest.DoubleXmlnsTest
* @summary Test double namespaces and nested namespaces.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class DoubleXmlnsTest {
@Test
@@ -112,3 +118,4 @@ public class DoubleXmlnsTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java
index 06dc2665a7f..1f447928aa7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IsValidatingTest.java
@@ -28,12 +28,18 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6440324
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IsValidatingTest
+ * @run testng/othervm stream.XMLStreamReaderTest.IsValidatingTest
* @summary Test StAX can accept non-existent DTD if IS_VALIDATING if false.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class IsValidatingTest {
/**
@@ -159,3 +165,4 @@ public class IsValidatingTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java
index 082aa87d0c4..9ef51e64d02 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue44Test.java
@@ -27,12 +27,18 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6631262
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Issue44Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Issue44Test
* @summary Test XMLStreamReader.getName() shall throw IllegalStateException if current event is not start/end element.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Issue44Test {
@Test
@@ -53,3 +59,4 @@ public class Issue44Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java
index 7d868423677..ad2d8dc0293 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Issue47Test.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6631265
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Issue47Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Issue47Test
* @summary Test XMLStreamReader.standaloneSet() presents if input document has a value for "standalone" attribute in xml declaration.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Issue47Test {
@Test
@@ -83,3 +89,4 @@ public class Issue47Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java
index dd0fb1a0bf9..b259576202c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker24.java
@@ -29,11 +29,17 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker24
+ * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker24
* @summary Test no prefix is represented by "", not null.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class IssueTracker24 {
@Test
@@ -55,3 +61,4 @@ public class IssueTracker24 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java
index 1aa8d6b4c7c..d98e249c48e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker35.java
@@ -30,11 +30,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker35
+ * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker35
* @summary Test StAX parse xsd document including external DTD.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class IssueTracker35 {
@Test
@@ -53,3 +59,4 @@ public class IssueTracker35 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java
index c616a3aa669..33cc4b87574 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/IssueTracker70.java
@@ -31,11 +31,17 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.IssueTracker70
+ * @run testng/othervm stream.XMLStreamReaderTest.IssueTracker70
* @summary Test it can retrieve attribute with null or empty name space.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class IssueTracker70 {
static private final File testFile = new File(IssueTracker70.class.getResource("IssueTracker70.xml").getFile());
@@ -70,3 +76,4 @@ public class IssueTracker70 {
Assert.assertNotNull(value, "should have attribute value");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
index 50dfed8a487..3505fd59f50 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
@@ -28,11 +28,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Jsr173MR1Req5Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Jsr173MR1Req5Test
* @summary Test XMLStreamReader parses namespace declaration within element when NamespaceAware turns off and on.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Jsr173MR1Req5Test {
private static final String INPUT_FILE1 = "Jsr173MR1Req5.xml";
@@ -85,3 +91,4 @@ public class Jsr173MR1Req5Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
index d1c007402ff..b6e703e93f8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
@@ -28,11 +28,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.Jsr173MR1Req8Test
+ * @run testng/othervm stream.XMLStreamReaderTest.Jsr173MR1Req8Test
* @summary Test XMLStreamReader parses attribute with namespace aware.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Jsr173MR1Req8Test {
private static final String INPUT_FILE1 = "Jsr173MR1Req8.xml";
@@ -63,3 +69,4 @@ public class Jsr173MR1Req8Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java
index 5c9440d0998..2ea93e90950 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/NamespaceTest.java
@@ -32,11 +32,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.NamespaceTest
+ * @run testng/othervm stream.XMLStreamReaderTest.NamespaceTest
* @summary Test StAX parser processes namespace.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class NamespaceTest {
String namespaceURI = "foobar.com";
@@ -147,3 +153,4 @@ public class NamespaceTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java
index cbaa37863cf..cc01f89ebda 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java
@@ -28,11 +28,17 @@ import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.StreamReaderTest
+ * @run testng/othervm stream.XMLStreamReaderTest.StreamReaderTest
* @summary Test XMLStreamReader.hasName() returns false for ENTITY_REFERENCE.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class StreamReaderTest {
/**
@@ -56,3 +62,4 @@ public class StreamReaderTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java
index 1a2e325fdd2..ca51c6e1094 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/SupportDTDTest.java
@@ -38,9 +38,14 @@ import javax.xml.stream.events.EntityReference;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.SupportDTDTest
+ * @run testng/othervm stream.XMLStreamReaderTest.SupportDTDTest
* @summary Test SUPPORT_DTD and IS_REPLACING_ENTITY_REFERENCES.
*/
@@ -72,6 +77,7 @@ import org.testng.annotations.Test;
* The current jaxp implementation actually throws a nullpointexception. A better error message could be used.
*
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SupportDTDTest {
final boolean DEBUG = false;
final String _file = "ExternalDTD.xml";
@@ -282,3 +288,4 @@ public class SupportDTDTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
index 5befcb70609..216bf0d6536 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
@@ -27,11 +27,17 @@ import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.VoiceXMLDTDTest
+ * @run testng/othervm stream.XMLStreamReaderTest.VoiceXMLDTDTest
* @summary Test parsing Voice XML DTD.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class VoiceXMLDTDTest {
private static final String INPUT_FILE1 = "voicexml.xml";
@@ -52,3 +58,4 @@ public class VoiceXMLDTDTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java
index ac98279175d..f69166a2be8 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/XML11Test.java
@@ -27,11 +27,17 @@ import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.XML11Test
+ * @run testng/othervm stream.XMLStreamReaderTest.XML11Test
* @summary Test parsing xml 1.1.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class XML11Test {
@Test
@@ -48,3 +54,4 @@ public class XML11Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java
index 7a426c93f8d..811f0bf1173 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/AttributeEscapeTest.java
@@ -34,13 +34,19 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.AttributeEscapeTest
+ * @run testng/othervm stream.XMLStreamWriterTest.AttributeEscapeTest
* @summary Test XMLStreamWriter shall escape the illegal characters.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class AttributeEscapeTest {
/**
@@ -97,3 +103,4 @@ public class AttributeEscapeTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java
index b3148c60502..595c58d44a2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6452107.java
@@ -31,12 +31,18 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6452107
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6452107
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug6452107
* @summary Test StAX can write ISO-8859-1 encoding XML.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6452107 {
/**
@@ -58,3 +64,4 @@ public class Bug6452107 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java
index f34b559f86c..f8cb256404c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6600882Test.java
@@ -29,12 +29,18 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6600882
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6600882Test
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug6600882Test
* @summary Test toString(), hashCode() of XMLStreamWriter .
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6600882Test {
@@ -53,3 +59,4 @@ public class Bug6600882Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java
index e52fb4acbd4..25cd9327513 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug6675332Test.java
@@ -30,14 +30,20 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import util.BaseStAXUT;
/*
+ * @test
* @bug 6675332
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug6675332Test
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug6675332Test
* @summary Test XMLStreamWriter writeAttribute when IS_REPAIRING_NAMESPACES is true.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6675332Test extends BaseStAXUT {
private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
@@ -158,3 +164,4 @@ public class Bug6675332Test extends BaseStAXUT {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java
index 7c1e50264d5..a157d7c84a1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/Bug7037352Test.java
@@ -30,12 +30,18 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 7037352
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.Bug7037352Test
+ * @run testng/othervm stream.XMLStreamWriterTest.Bug7037352Test
* @summary Test XMLStreamWriter.getNamespaceContext().getPrefix with XML_NS_URI and XMLNS_ATTRIBUTE_NS_URI.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug7037352Test {
@Test
@@ -59,3 +65,4 @@ public class Bug7037352Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java
index f59ef011018..929cbda273f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DOMUtil.java
@@ -221,3 +221,4 @@ public class DOMUtil {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java
index d2c2491e36e..466a51ce506 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/DomUtilTest.java
@@ -41,18 +41,23 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.DomUtilTest
+ * @run testng/othervm stream.XMLStreamWriterTest.DomUtilTest
* @summary Test XMLStreamWriter writes a soap message.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DomUtilTest {
private XMLOutputFactory staxOut;
- final File folder = new File(System.getProperty("tempdir") + "/classes/soapmessages");
private static final String INPUT_FILE1 = "message_12.xml";
public void setup() {
@@ -119,3 +124,4 @@ public class DomUtilTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java
index b813ef5607c..be4cc62d4a3 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EmptyElementTest.java
@@ -29,11 +29,17 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.EmptyElementTest
+ * @run testng/othervm stream.XMLStreamWriterTest.EmptyElementTest
* @summary Test XMLStreamWriter writes namespace and attribute after writeEmptyElement.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class EmptyElementTest {
// expected output
@@ -79,3 +85,4 @@ public class EmptyElementTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java
index 50973152487..deff9cc9d1e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/EncodingTest.java
@@ -29,11 +29,17 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.EncodingTest
+ * @run testng/othervm stream.XMLStreamWriterTest.EncodingTest
* @summary Test XMLStreamWriter writes a document with encoding setting.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class EncodingTest {
private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
@@ -104,3 +110,4 @@ public class EncodingTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java
index 24d89a08ba6..04ad1d7b12e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NamespaceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,11 +32,17 @@ import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.NamespaceTest
+ * @run testng/othervm stream.XMLStreamWriterTest.NamespaceTest
* @summary Test the writing of Namespaces.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class NamespaceTest {
/** debug output? */
@@ -1428,3 +1434,4 @@ public class NamespaceTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java
index 3eb0222cbaf..e4d0bfc9c92 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/NullUriDetectionTest.java
@@ -28,12 +28,18 @@ import java.io.StringWriter;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6391922
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.NullUriDetectionTest
+ * @run testng/othervm stream.XMLStreamWriterTest.NullUriDetectionTest
* @summary Test XMLStreamWriter can writeDefaultNamespace(null).
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class NullUriDetectionTest {
@Test
public void test1() throws Exception {
@@ -48,3 +54,4 @@ public class NullUriDetectionTest {
w.writeCharacters("---");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java
index 90ca0f313a2..a5d76495376 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SqeLinuxTest.java
@@ -29,11 +29,17 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.SqeLinuxTest
+ * @run testng/othervm stream.XMLStreamWriterTest.SqeLinuxTest
* @summary Test XMLStreamWriter can output multiple declarations if IS_REPAIRING_NAMESPACES is false.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class SqeLinuxTest {
// note that expected output will have multiple declarations,
@@ -82,3 +88,4 @@ public class SqeLinuxTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
index a24c6b8b54f..4208cc9b24d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/SurrogatesTest.java
@@ -38,6 +38,7 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
@@ -45,10 +46,15 @@ import org.testng.annotations.DataProvider;
* @test
* @bug 8145974
* @modules javax.xml
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.SurrogatesTest
+ * @run testng/othervm stream.XMLStreamWriterTest.SurrogatesTest
* @summary Check that XMLStreamWriter generates valid xml with surrogate pair
* used within element text
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class SurrogatesTest {
// Test that valid surrogate characters can be written/readen by xml stream
@@ -152,7 +158,7 @@ public class SurrogatesTest {
}
@DataProvider(name = "validData")
- Object[][] getValidData() {
+ public Object[][] getValidData() {
return new Object[][] {
{"Don't Worry Be \uD83D\uDE0A"},
{"BMP characters \uE000\uFFFD"},
@@ -161,7 +167,7 @@ public class SurrogatesTest {
}
@DataProvider(name = "invalidData")
- Object[][] getInvalidData() {
+ public Object[][] getInvalidData() {
return new Object[][] {
{"Unbalanced surrogate \uD83D"},
{"Unbalanced surrogate \uD83Dis here"},
@@ -169,3 +175,4 @@ public class SurrogatesTest {
};
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java
index 5e05fd82394..95bb8965ab7 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/UnprefixedNameTest.java
@@ -28,12 +28,18 @@ import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6394074
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.UnprefixedNameTest
+ * @run testng/othervm stream.XMLStreamWriterTest.UnprefixedNameTest
* @summary Test XMLStreamWriter namespace prefix with writeDefaultNamespace.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class UnprefixedNameTest {
@Test
@@ -119,3 +125,4 @@ public class UnprefixedNameTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java
index adb43d95e0a..c7148edb187 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/WriterTest.java
@@ -40,11 +40,17 @@ import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.WriterTest
+ * @run testng/othervm stream.XMLStreamWriterTest.WriterTest
* @summary Test XMLStreamWriter functionality.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class WriterTest {
final String ENCODING = "UTF-8";
@@ -57,7 +63,7 @@ public class WriterTest {
String output = "";
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
try {
outputFactory = XMLOutputFactory.newInstance();
inputFactory = XMLInputFactory.newInstance();
@@ -67,7 +73,7 @@ public class WriterTest {
}
@AfterMethod
- protected void tearDown() {
+ public void tearDown() {
outputFactory = null;
inputFactory = null;
}
@@ -778,3 +784,4 @@ public class WriterTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
index 2bc71a315ce..0d063043ba0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
@@ -29,24 +29,20 @@ import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6347190
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLStreamWriterTest.XMLStreamWriterTest
+ * @run testng/othervm stream.XMLStreamWriterTest.XMLStreamWriterTest
* @summary Test StAX Writer won't insert comment into element inside.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XMLStreamWriterTest {
- @BeforeMethod
- protected void setUp() throws Exception {
- }
-
- @AfterMethod
- protected void tearDown() throws Exception {
- }
-
/**
* Test of main method, of class TestXMLStreamWriter.
*/
@@ -77,3 +73,4 @@ public class XMLStreamWriterTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java
index 8daef2e5cce..63869afc6ec 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4693341Test.java
@@ -37,14 +37,20 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 4693341
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug4693341Test
+ * @run testng/othervm transform.Bug4693341Test
* @summary Test transform with external dtd.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4693341Test {
// save dtd file to current working directory to avoid writing into source repository
public void copyDTDtoWorkDir() throws IOException {
@@ -88,3 +94,4 @@ public class Bug4693341Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java
index e65bdaf6058..ed348885b33 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug4892774.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -36,6 +36,7 @@ import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import transform.util.DOMUtil;
@@ -44,10 +45,15 @@ import transform.util.StAXUtil;
import transform.util.StreamUtil;
/*
+ * @test
* @bug 4892774
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug4892774
+ * @run testng/othervm transform.Bug4892774
* @summary Test identity transformer with all possible types of Source and Result combinations for doucment version and encoding information.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4892774 {
private final String XML_FILE = "catalog.xml";
@@ -62,7 +68,7 @@ public class Bug4892774 {
private static StAXUtil staxUtil = null;
@BeforeMethod
- protected void setUp() {
+ public void setUp() {
File tmpFile = new File(TEMP_FILE);
if (tmpFile.exists())
tmpFile.delete();
@@ -81,7 +87,7 @@ public class Bug4892774 {
}
@AfterMethod
- protected void tearDown() {
+ public void tearDown() {
File tmpFile = new File(TEMP_FILE);
if (tmpFile.exists())
tmpFile.delete();
@@ -371,3 +377,4 @@ public class Bug4892774 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java
index 4d406747c8a..750f38c811c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug5073477.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,13 +27,19 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.dom.DOMResult;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 5073477
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug5073477
+ * @run testng/othervm transform.Bug5073477
* @summary Test DOMResult.setNextSibling works correctly.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug5073477 {
@Test
@@ -49,3 +55,4 @@ public class Bug5073477 {
r.setNextSibling(r.getNode().getFirstChild());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java
index bb3c7d61a29..0cfcfa0e05e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6175602.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,12 +29,18 @@ import javax.xml.transform.Templates;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6175602
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6175602
+ * @run testng/othervm transform.Bug6175602
* @summary Test compilation of MsWordXMLImport.xsl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6175602 {
public Bug6175602() {
@@ -48,3 +54,4 @@ public class Bug6175602 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java
index eaaa3f77908..1947d7e7f93 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6206491.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -39,15 +39,21 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6206491
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6206491
+ * @run testng/othervm transform.Bug6206491
* @summary Test key searches over more than one document.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6206491 {
private String getResource(String s) {
@@ -128,3 +134,4 @@ public class Bug6206491 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java
index 275fd8c5af1..291eb372eeb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6216226Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,8 +23,11 @@
package transform;
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+
import java.io.File;
import java.io.StringReader;
+import java.util.PropertyPermission;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
@@ -32,12 +35,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6216226
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6216226Test
+ * @run testng/othervm transform.Bug6216226Test
* @summary Test StreamResult(File) is closed after transform().
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6216226Test {
@Test
@@ -48,7 +57,7 @@ public class Bug6216226Test {
Transformer xformer = tf.newTransformer();
StringReader st = new StringReader("");
StreamSource s = new StreamSource(st);
- StreamResult r = new StreamResult(test);
+ StreamResult r = runWithTmpPermission(() -> new StreamResult(test), new PropertyPermission("user.dir", "read"));
xformer.transform(s, r);
if (!test.delete()) {
Assert.fail("cannot delete file: " + test.getPath());
@@ -60,3 +69,4 @@ public class Bug6216226Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java
index db6925d00e4..adc49f1ed3d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6311448.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,14 +33,20 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/*
+ * @test
* @bug 6311448
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6311448
+ * @run testng/othervm transform.Bug6311448
* @summary Test XML transformer can output Unicode surrorate pair.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6311448 {
@Test
@@ -79,3 +85,4 @@ public class Bug6311448 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java
index 680398bf037..3e7bc97d12f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6384805.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,12 +35,18 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6384805
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6384805
+ * @run testng/othervm transform.Bug6384805
* @summary Test XSLTC can parse XML namespace when nodeset is created within a template.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6384805 {
@Test
@@ -88,3 +94,4 @@ public class Bug6384805 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java
index 80d5139e7c3..881bd808038 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6465722.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -34,13 +34,19 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 6465722
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6465722
+ * @run testng/othervm transform.Bug6465722
* @summary Test Transformer can transform the node attribute prefixed with a namespace.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6465722 {
public Bug6465722(String name) {
@@ -66,3 +72,4 @@ public class Bug6465722 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java
index 7a7fb1aa074..86f9436c9f6 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6467808.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,12 +33,18 @@ import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6467808
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6467808
+ * @run testng/othervm transform.Bug6467808
* @summary Test Transformer can parse re-declare prefixed namespace mappings.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6467808 {
private static final String TESTXML = "\n"
@@ -70,3 +76,4 @@ public class Bug6467808 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java
index 4385fb245bf..7301108e272 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490380.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,12 +32,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6490380
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6490380
+ * @run testng/othervm transform.Bug6490380
* @summary Test only a single DOCTYPE declaration is generated through transforming.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6490380 {
@Test
@@ -55,3 +61,4 @@ public class Bug6490380 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java
index 38f72d5a89f..759467caffc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6490921.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +23,8 @@
package transform;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
@@ -37,15 +39,21 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.XMLFilterImpl;
/*
+ * @test
* @bug 6490921
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6490921
+ * @run testng/othervm transform.Bug6490921
* @summary Test property org.xml.sax.driver is always applied in transformer API.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6490921 {
public static class ReaderStub extends XMLFilterImpl {
@@ -71,7 +79,7 @@ public class Bug6490921 {
public void test01() {
String xml = "";
ReaderStub.used = false;
- System.setProperty("org.xml.sax.driver", "");
+ setSystemProperty("org.xml.sax.driver", "");
// Don't set 'org.xml.sax.driver' here, just use default
try {
@@ -91,7 +99,7 @@ public class Bug6490921 {
public void test02() {
String xml = "";
ReaderStub.used = false;
- System.setProperty("org.xml.sax.driver", ReaderStub.class.getName());
+ setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName());
try {
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer();
@@ -111,7 +119,7 @@ public class Bug6490921 {
+ " Hello World!\n" + "\n";
ReaderStub.used = false;
- System.setProperty("org.xml.sax.driver", ReaderStub.class.getName());
+ setSystemProperty("org.xml.sax.driver", ReaderStub.class.getName());
try {
TransformerFactory transFactory = TransformerFactory.newInstance();
if (transFactory.getFeature(SAXTransformerFactory.FEATURE) == false) {
@@ -137,3 +145,4 @@ public class Bug6490921 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java
index da26d64e2ec..26a51f339e5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6513892.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -34,13 +34,19 @@ import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 6513892
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6513892
+ * @run testng/othervm transform.Bug6513892
* @summary Test the output encoding of the transform is the same as that of the redirect extension.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6513892 {
@BeforeClass
public void setup(){
@@ -71,3 +77,4 @@ public class Bug6513892 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java
index c75ff71b584..b77ec5d5900 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6537167.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,12 +32,18 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6537167
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6537167
+ * @run testng/othervm transform.Bug6537167
* @summary Test transforming for particular xsl files.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6537167 {
@Test
@@ -79,3 +85,4 @@ public class Bug6537167 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java
index 2c76ad694fa..90cbfccd0f4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6540545.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,12 +31,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6540545
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6540545
+ * @run testng/othervm transform.Bug6540545
* @summary Test XSLT as expected.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6540545 {
@Test
@@ -58,3 +64,4 @@ public class Bug6540545 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6551616.java
similarity index 86%
rename from jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java
rename to jaxp/test/javax/xml/jaxp/unittest/transform/Bug6551616.java
index 6a072573c1f..3bd1e7adbc9 100644
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6551616.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,21 +23,27 @@
/*
* @test
- * @modules java.xml/com.sun.org.apache.xalan.internal.xsltc.trax
* @bug 6551616
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6551616
+ * @run testng/othervm transform.Bug6551616
* @summary Test SAX2StAXEventWriter.
*/
+package transform;
+
import java.io.InputStream;
import java.io.StringBufferInputStream;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLOutputFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import com.sun.org.apache.xalan.internal.xsltc.trax.SAX2StAXEventWriter;
+@Listeners({jaxp.library.InternalAPIPolicy.class})
public class Bug6551616 {
String _cache = "";
@@ -62,3 +68,4 @@ public class Bug6551616 {
// if it doesn't blow up, it succeeded.
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java
index 162c92a2e8a..05a5e1c9e83 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6559595.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,12 +35,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6559595
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6559595
+ * @run testng/othervm transform.Bug6559595
* @summary Test ampersand in href attribute is not handled specially even if output is set to HTML.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6559595 {
@Test
@@ -64,3 +70,4 @@ public class Bug6559595 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java
index 3b0f6361b1d..6a56d55518b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6565260.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,12 +31,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6565260
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6565260
+ * @run testng/othervm transform.Bug6565260
* @summary Test use-attribute-sets attribute is not used for the root node.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6565260 {
@Test
@@ -58,3 +64,4 @@ public class Bug6565260 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java
index 41f7279506a..628310c0d33 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Bug6940416.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -39,12 +39,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6940416
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Bug6940416
+ * @run testng/othervm transform.Bug6940416
* @summary Test transforming correctly.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6940416 {
@Test
@@ -109,3 +115,4 @@ public class Bug6940416 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java
index 5f5fa0e8fdd..e41107089d5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/BugDB12665704Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -43,12 +43,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6935697
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.BugDB12665704Test
+ * @run testng/othervm transform.BugDB12665704Test
* @summary Test Transformer can compile large xsl file.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class BugDB12665704Test {
@Test
@@ -151,3 +157,4 @@ public class BugDB12665704Test {
return sb.toString();
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CLITest.java
similarity index 63%
rename from jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java
rename to jaxp/test/javax/xml/jaxp/unittest/transform/CLITest.java
index 7401f50351f..e72fc26d4f6 100644
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CLITest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,23 +23,31 @@
/*
* @test
- * @modules java.xml/com.sun.org.apache.xml.internal.utils
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CLITest
+ * @run testng/othervm transform.CLITest
* @summary Test internal transform CLI.
*/
-import org.testng.Assert;
+package transform;
+
+import java.util.PropertyPermission;
+
+import jaxp.library.JAXPTestUtilities;
+
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
+@Listeners({ jaxp.library.FilePolicy.class })
public class CLITest {
@Test
- public void testCLI() {
- try {
- String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(), "-IN",
- getClass().getResource("tigertest-in.xml").toString(), };
+ public void testCLI() throws Exception {
+ JAXPTestUtilities.tryRunWithTmpPermission(() -> {
+ String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(),
+ "-IN", getClass().getResource("tigertest-in.xml").toString(), };
ProcessXSLT.main(args);
- } catch (Exception e) {
- Assert.fail(e.getMessage());
- }
+ }, new PropertyPermission("*", "read,write"));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java
index 7a2c5427633..b7af4a5841f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6401137Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -37,12 +37,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6401137
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6401137Test
+ * @run testng/othervm transform.CR6401137Test
* @summary Test transform certain xsl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6401137Test {
@Test
@@ -88,3 +94,4 @@ public class CR6401137Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600.policy b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600.policy
deleted file mode 100644
index 381c067b376..00000000000
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600.policy
+++ /dev/null
@@ -1,22 +0,0 @@
-grant {
- permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
- permission java.lang.RuntimePermission "accessDeclaredMembers";
-
- permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
- permission java.io.FilePermission ".", "read, write, delete";
- permission java.util.PropertyPermission "*", "read, write";
-
- permission java.lang.RuntimePermission "setSecurityManager";
- permission java.lang.RuntimePermission "createSecurityManager";
- permission java.lang.RuntimePermission "createClassLoader";
- permission java.lang.RuntimePermission "setIO";
- permission java.lang.RuntimePermission "setContextClassLoader";
- permission java.security.SecurityPermission "getPolicy";
-
- permission java.io.FilePermission "${test.src}/-", "read, write, delete";
- permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
- permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
-
- permission java.io.FilePermission "//localhost/C$/xslt_unc_test.xml", "read, write, delete";
-
-};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java
index f364f5d2332..d08dddffca0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6551600Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,7 +23,10 @@
package transform;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import java.io.File;
+import java.io.FilePermission;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -32,57 +35,63 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import jaxp.library.JAXPTestUtilities;
+
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/*
+ * @test
* @bug 6551600
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6551600Test
+ * @run testng/othervm transform.CR6551600Test
* @summary Test using UNC path as StreamResult.
*/
+@Listeners({ jaxp.library.BasePolicy.class })
public class CR6551600Test {
@Test
public final void testUNCPath() {
- String hostName = "";
- try {
- hostName = java.net.InetAddress.getLocalHost().getHostName();
- } catch (java.net.UnknownHostException e) {
- // falls through
- }
+ boolean isWindows = getSystemProperty("os.name").contains("Windows");
+ JAXPTestUtilities.runWithTmpPermission(() -> {
+ String hostName = "";
+ try {
+ hostName = java.net.InetAddress.getLocalHost().getHostName();
+ } catch (java.net.UnknownHostException e) {
+ // falls through
+ }
- String path = "\\\\" + hostName + "\\C$\\xslt_unc_test.xml";
- String os = System.getProperty("os.name");
- if (os.indexOf("Windows") < 0) {
- path = "///tmp/test.xml";
- }
- else {
- policy.PolicyUtil.changePolicy(getClass().getResource("CR6551600.policy").getFile());
- }
+ String path = isWindows ? "\\\\" + hostName + "\\C$\\xslt_unc_test.xml" : "///tmp/test.xml";
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.newDocument();
- Element root = doc.createElement("test");
- doc.appendChild(root);
- // create an identity transform
- Transformer t = TransformerFactory.newInstance().newTransformer();
- File f = new File(path);
- StreamResult result = new StreamResult(f);
- DOMSource source = new DOMSource(doc);
- System.out.println("Writing to " + f);
- t.transform(source, result);
- } catch (Exception e) {
- // unexpected failure
- e.printStackTrace();
- Assert.fail(e.toString());
- }
+ try {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.newDocument();
+ Element root = doc.createElement("test");
+ doc.appendChild(root);
+ // create an identity transform
+ Transformer t = TransformerFactory.newInstance().newTransformer();
+ File f = new File(path);
+ StreamResult result = new StreamResult(f);
+ DOMSource source = new DOMSource(doc);
+ System.out.println("Writing to " + f);
+ t.transform(source, result);
+ } catch (Exception e) {
+ // unexpected failure
+ e.printStackTrace();
+ Assert.fail(e.toString());
+ }
- File file = new File(path);
- if (file.exists()) {
- file.deleteOnExit();
- }
+ File file = new File(path);
+ if (file.exists()) {
+ file.deleteOnExit();
+ }
+ }, isWindows ? new FilePermission("//localhost/C$/xslt_unc_test.xml", "read,write,delete")
+ : new FilePermission("///tmp/test.xml", "read,write,delete"));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java
index 70767a47d3b..3602f80b809 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6577667Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,12 +30,18 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6577667
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6577667Test
+ * @run testng/othervm transform.CR6577667Test
* @summary Test XSLT can parse statement "not(preceding-sibling::* or following-sibling::*)" in stylesheet file.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6577667Test {
@Test
@@ -53,3 +59,4 @@ public class CR6577667Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java
index 9be065fb038..057238513d2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6652519Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,13 +33,19 @@ import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 6652519
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6652519Test
+ * @run testng/othervm transform.CR6652519Test
* @summary Test transfoming from StreamSource to DOMResult.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6652519Test {
@Test
@@ -73,3 +79,4 @@ public class CR6652519Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java
index 91da2f6d4fd..cdfcae7d550 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6689809Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,12 +30,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6689809
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6689809Test
+ * @run testng/othervm transform.CR6689809Test
* @summary Test Transformer can handle XPath predicates in xsl:key elements.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6689809Test {
@Test
@@ -58,3 +64,4 @@ public class CR6689809Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java
index 60de73f31e0..33f9957bc85 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6905829Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,12 +32,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6905829
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6905829Test
+ * @run testng/othervm transform.CR6905829Test
* @summary Test XSLT can parse certain xsl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6905829Test {
@Test
@@ -59,3 +65,4 @@ public class CR6905829Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java
index 6742d3fe47e..3db8bc3af6e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6935697Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -34,12 +34,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6935697
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6935697Test
+ * @run testng/othervm transform.CR6935697Test
* @summary Test XSLT can parse the certain xsl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6935697Test {
@Test
@@ -71,3 +77,4 @@ public class CR6935697Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java
index 07a18b6ad14..8fd89254737 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6941869Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,12 +32,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6941869
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6941869Test
+ * @run testng/othervm transform.CR6941869Test
* @summary Test XSLT evaluate "count(.|key('props', d/e)[1])" correctly.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6941869Test {
@Test
@@ -70,3 +76,4 @@ public class CR6941869Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java
index 3d9a74012b1..4e4e7ddb05c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR6957215Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -39,12 +39,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6957215
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR6957215Test
+ * @run testng/othervm transform.CR6957215Test
* @summary Test XSLT generates the element content using xsl:attribute instructions.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6957215Test {
@Test
@@ -93,3 +99,4 @@ public class CR6957215Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java
index d67a58ad847..c84a512e1ec 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/CR7098746Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -34,12 +34,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 7098746
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.CR7098746Test
+ * @run testng/othervm transform.CR7098746Test
* @summary Test transforming as expected.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR7098746Test {
@Test
@@ -84,3 +90,4 @@ public class CR7098746Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java
index b21fadd8724..bf46190ee35 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/DOMResultTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +23,7 @@
package transform;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
@@ -46,8 +47,13 @@ import org.w3c.dom.Node;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.DOMResultTest
+ * @run testng/othervm transform.DOMResultTest
* @summary Test DOMResult.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class DOMResultTest {
@Test
@@ -209,3 +215,4 @@ public class DOMResultTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java b/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java
index 81227c7d691..f9a93513112 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/DocumentExtFunc.java
@@ -33,3 +33,4 @@ public class DocumentExtFunc {
return "["+node.getNodeName() + ":" + node.getTextContent()+"]";
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java
index c0f17b8d5c0..56eff4001df 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/FactoryFindTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,43 +23,44 @@
package transform;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import java.net.URL;
import java.net.URLClassLoader;
import javax.xml.transform.TransformerFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.FactoryFindTest
+ * @run testng/othervm transform.FactoryFindTest
* @summary Test creating TransformerFactory with ContextClassLoader.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class FactoryFindTest {
boolean myClassLoaderUsed = false;
@Test
- public void testFactoryFind() {
- try {
- // System.setProperty("jaxp.debug", "true");
+ public void testFactoryFind() throws Exception {
+ TransformerFactory factory = TransformerFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
- TransformerFactory factory = TransformerFactory.newInstance();
- Assert.assertTrue(factory.getClass().getClassLoader() == null);
-
- Thread.currentThread().setContextClassLoader(null);
- factory = TransformerFactory.newInstance();
- Assert.assertTrue(factory.getClass().getClassLoader() == null);
-
- Thread.currentThread().setContextClassLoader(new MyClassLoader());
- factory = TransformerFactory.newInstance();
- if (System.getSecurityManager() == null)
- Assert.assertTrue(myClassLoaderUsed);
- else
- Assert.assertFalse(myClassLoaderUsed);
- } catch (Exception ex) {
- Assert.fail(ex.toString());
- }
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(null));
+ factory = TransformerFactory.newInstance();
+ Assert.assertTrue(factory.getClass().getClassLoader() == null);
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(new MyClassLoader()));
+ factory = TransformerFactory.newInstance();
+ if (System.getSecurityManager() == null)
+ Assert.assertTrue(myClassLoaderUsed);
+ else
+ Assert.assertFalse(myClassLoaderUsed);
}
class MyClassLoader extends URLClassLoader {
@@ -74,3 +75,4 @@ public class FactoryFindTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java
index b0912eb8479..52f41c46715 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2204Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,12 +31,18 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6905829
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Issue2204Test
+ * @run testng/othervm transform.Issue2204Test
* @summary Test XSLT can work against the certain xsl.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Issue2204Test {
@Test
@@ -61,3 +67,4 @@ public class Issue2204Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java
index b2be968bea6..10ba8615c44 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/Issue2290Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -41,11 +41,17 @@ import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.Issue2290Test
+ * @run testng/othervm transform.Issue2290Test
* @summary Test XSL extension for RTF works, for https://issues.apache.org/jira/i#browse/XALANJ-2290.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Issue2290Test {
@Test
@@ -90,3 +96,4 @@ public class Issue2290Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java b/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java
index abe964f55c5..4fceeaacbc4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/OpenJDK100017Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,13 +32,19 @@ import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6883209
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.OpenJDK100017Test
+ * @run testng/othervm transform.OpenJDK100017Test
* @summary Test XSLT won't cause StackOverflow when it handle many characters.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class OpenJDK100017Test {
@Test
@@ -60,3 +66,4 @@ public class OpenJDK100017Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java b/jaxp/test/javax/xml/jaxp/unittest/transform/ProcessXSLT.java
similarity index 99%
rename from jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java
rename to jaxp/test/javax/xml/jaxp/unittest/transform/ProcessXSLT.java
index 323d940cfd7..3425585fb22 100644
--- a/jaxp/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/ProcessXSLT.java
@@ -31,18 +31,29 @@
// We however don't have a hard dependency on it. We will use
// our own ErrorHandler if the default one is not accessible.
//
+
+package transform;
+
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.StringReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Properties;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.ErrorListener;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
+import javax.xml.transform.SourceLocator;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
@@ -58,16 +69,9 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.SourceLocator;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-
import org.xml.sax.ContentHandler;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
@@ -267,7 +271,7 @@ public class ProcessXSLT
} else if ("-V".equalsIgnoreCase(argv[i])) {
diagnosticsWriter.println(">>>>>>> Java Version "
- + System.getProperty("java.version") + ", "
+ + getSystemProperty("java.version") + ", "
+ /* xmlProcessorLiaison.getParserDescription()+ */ "<<<<<<<");
} // J2SE does not support Xalan interpretive
/*
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java
index 6e3a9afeb36..1dc5cfbab7e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/SAX2DOMTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,6 +31,7 @@ import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -45,8 +46,13 @@ import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.helpers.XMLFilterImpl;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.SAX2DOMTest
+ * @run testng/othervm transform.SAX2DOMTest
* @summary Test Transforming from SAX to DOM.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SAX2DOMTest {
@Test
@@ -192,3 +198,4 @@ public class SAX2DOMTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java
index 888f278edd7..27a03bf4e44 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/SecureProcessingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,14 +23,10 @@
package transform;
-import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
@@ -39,29 +35,19 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
-import org.testng.annotations.Test;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
+import org.testng.annotations.Listeners;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.SecureProcessingTest
+ * @run testng/othervm transform.SecureProcessingTest
* @summary Test XSLT shall report TransformerException for unsafe xsl when FEATURE_SECURE_PROCESSING is true.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SecureProcessingTest {
- static boolean _isSecureMode = false;
- static {
- if (System.getSecurityManager() != null) {
- _isSecureMode = true;
- System.out.println("Security Manager is present");
- } else {
- System.out.println("Security Manager is NOT present");
- }
- }
-
-
-
- @Test
- public final void testSecureProcessing() {
-
+ public void testSecureProcessing() {
+ boolean _isSecureMode = System.getSecurityManager() != null;
// SECURE_PROCESSING == false
// the style sheet
@@ -149,3 +135,4 @@ public class SecureProcessingTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java
index d0e7ae34d6e..76507bfca1f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/SourceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,11 +35,17 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.SourceTest
+ * @run testng/othervm transform.SourceTest
* @summary Test Sources.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SourceTest {
@Test
@@ -142,3 +148,4 @@ public class SourceTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java
index dc149f49031..cfa20d1b47a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/StAXSourceTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -40,11 +40,17 @@ import javax.xml.transform.stax.StAXResult;
import javax.xml.transform.stax.StAXSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.StAXSourceTest
+ * @run testng/othervm transform.StAXSourceTest
* @summary Test parsing from StAXSource.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class StAXSourceTest {
@Test
@@ -123,3 +129,4 @@ public class StAXSourceTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java
index 19509ed87de..e2a4fc2ca08 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TemplatesTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -29,11 +29,17 @@ import java.io.StringReader;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamSource;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.TemplatesTest
+ * @run testng/othervm transform.TemplatesTest
* @summary This class contains tests for Templates.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class TemplatesTest {
/**
@@ -60,7 +66,7 @@ public class TemplatesTest {
* DataProvider: Templates
*/
@DataProvider(name = "templates")
- Object[][] getTemplates() throws Exception {
+ public Object[][] getTemplates() throws Exception {
return new Object[][]{{TransformerFactory.newInstance().
newTemplates(new StreamSource(new StringReader(XSL)))}};
}
@@ -77,3 +83,4 @@ public class TemplatesTest {
+ " contains($validAffectsRelClasses, @Class)]/@OBID)\"/>"
+ "";
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java
index 62b84977bb7..2d6dfbf8aae 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerFactoryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -42,13 +42,19 @@ import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.TransformerFactoryTest
+ * @run testng/othervm transform.TransformerFactoryTest
* @summary Test TransformerFactory.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class TransformerFactoryTest {
private static URIResolver resolver = new URIResolver() {
@@ -147,3 +153,4 @@ public class TransformerFactoryTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java
index 6511a1b844e..199a4bac62a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java
@@ -23,8 +23,7 @@
package transform;
-import com.sun.org.apache.xml.internal.serialize.OutputFormat;
-import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
@@ -45,6 +44,7 @@ import javax.xml.transform.stream.StreamSource;
import org.testng.Assert;
import org.testng.AssertJUnit;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -60,10 +60,18 @@ import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.AttributesImpl;
+import com.sun.org.apache.xml.internal.serialize.OutputFormat;
+import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.TransformerTest
+ * @run testng/othervm transform.TransformerTest
* @summary Transformer Tests
* @bug 6272879 6305029 6505031 8150704 8162598
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class TransformerTest {
private Transformer createTransformer() throws TransformerException {
return TransformerFactory.newInstance().newTransformer();
@@ -245,7 +253,7 @@ public class TransformerTest {
*/
@Test
public final void testBug6272879() throws IOException, TransformerException {
- final String LINE_SEPARATOR = System.getProperty("line.separator");
+ final String LINE_SEPARATOR = getSystemProperty("line.separator");
final String xsl =
"" + LINE_SEPARATOR +
@@ -380,7 +388,7 @@ public class TransformerTest {
*/
@Test
public final void testBug8162598() throws IOException, TransformerException {
- final String LINE_SEPARATOR = System.getProperty("line.separator");
+ final String LINE_SEPARATOR = getSystemProperty("line.separator");
final String xsl =
"" + LINE_SEPARATOR +
@@ -431,3 +439,4 @@ public class TransformerTest {
Assert.assertNull(document.getElementsByTagName("test6").item(0).getNamespaceURI(), "unexpected namespace for test6");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java
index 793dd7ad6ac..dade0b6b56f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerUtilFactory.java
@@ -56,3 +56,4 @@ public class TransformerUtilFactory {
return null;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java
index ff8fbfe189b..f79ecd6bdde 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionDefaultHandler.java
@@ -62,3 +62,4 @@ public class VersionDefaultHandler extends DefaultHandler {
return encoding;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java
index 51ff18c421d..e7fe77b039f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/VersionEventWriter.java
@@ -82,3 +82,4 @@ public class VersionEventWriter implements XMLEventWriter {
return encoding;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java b/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java
index fbc602cdf38..51df5915037 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/XSLTFunctionsTest.java
@@ -35,14 +35,21 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @compile DocumentExtFunc.java
+ * @run testng/othervm -DrunSecMngr=true transform.XSLTFunctionsTest
+ * @run testng/othervm transform.XSLTFunctionsTest
* @summary This class contains tests for XSLT functions.
*/
+//@Listeners({jaxp.library.BasePolicy.class}) //uncomment this line after 8161454 is resolved
public class XSLTFunctionsTest {
/**
@@ -65,6 +72,7 @@ public class XSLTFunctionsTest {
// Create factory and transformer
TransformerFactory tf = TransformerFactory.newInstance();
+ tf.setFeature("http://www.oracle.com/xml/jaxp/properties/enableExtensionFunctions", true);
Transformer t = tf.newTransformer( xslsrc );
t.setErrorListener(tf.getErrorListener());
@@ -126,3 +134,4 @@ public class XSLTFunctionsTest {
static final String documentTesteExpectedResult = ""
+ "[Test:Doc][Test:External Doc]";
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java b/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java
index a299656033e..662c20b13aa 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/sax/Bug6451633.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,14 +29,20 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.helpers.AttributesImpl;
/*
+ * @test
* @bug 6451633
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true transform.sax.Bug6451633
+ * @run testng/othervm transform.sax.Bug6451633
* @summary Test TransformerHandler ignores empty text node.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6451633 {
@Test
@@ -56,3 +62,4 @@ public class Bug6451633 {
Assert.assertEquals(0, ((Document) result.getNode()).getDocumentElement().getChildNodes().getLength());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java
index 988da74f834..832c10f062e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/DOMUtil.java
@@ -68,3 +68,4 @@ public class DOMUtil extends TransformerUtil {
Assert.assertTrue(version.equals(resultVersion), "Expected XML Version is 1.1, but actual version " + resultVersion);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java
index 9e257ebf9a6..5bee6019cbb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/SAXUtil.java
@@ -70,3 +70,4 @@ public class SAXUtil extends TransformerUtil {
Assert.assertTrue(encoding.equals(resultEncoding), "Expected XML Version is " + encoding + " , but actual encoding " + resultEncoding);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java
index 26374d76ab0..91423dae161 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StAXUtil.java
@@ -92,3 +92,4 @@ public class StAXUtil extends TransformerUtil {
((StreamUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.STREAM)).checkStream(new FileInputStream(TEMP_FILE), version);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java
index 019c2f16b1e..91a37a909cb 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/util/StreamUtil.java
@@ -23,10 +23,14 @@
package transform.util;
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
+import java.util.PropertyPermission;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.SAXParser;
@@ -65,7 +69,7 @@ public class StreamUtil extends TransformerUtil {
public Result prepareResult() throws Exception {
FileOutputStream fos = new FileOutputStream(TEMP_FILE);
- return new StreamResult(fos);
+ return runWithTmpPermission(() -> new StreamResult(fos), new PropertyPermission("user.dir", "read"));
}
public void checkResult(Result result, String inputVersion) throws Exception {
@@ -85,8 +89,9 @@ public class StreamUtil extends TransformerUtil {
// use sax parser, as encoding info cannot be set on DOM document
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
VersionDefaultHandler dh = new VersionDefaultHandler();
- parser.parse(new File(TEMP_FILE), dh);
+ tryRunWithTmpPermission(() -> parser.parse(new File(TEMP_FILE), dh), new PropertyPermission("user.dir", "read"));
Assert.assertTrue(dh.getVersion().equals(version), "Expected version is " + version + " actual version " + dh.getVersion());
Assert.assertTrue(dh.getEncoding().equals(encoding), "Expected version is " + encoding + " actual version " + dh.getEncoding());
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java b/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
index 2088452af58..d142b7ad331 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
@@ -78,3 +78,4 @@ public class BOMInputStream {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java b/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
index 86a54335249..c3211c50e5b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
@@ -557,3 +557,4 @@ public class BaseStAXUT implements XMLStreamConstants {
System.err.println("Skipping " + clsName + "#" + method + ": entity expansion does not seem to be functioning properly" + msg + ".");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/6773084.policy b/jaxp/test/javax/xml/jaxp/unittest/validation/6773084.policy
deleted file mode 100644
index b4547934b44..00000000000
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/6773084.policy
+++ /dev/null
@@ -1,23 +0,0 @@
-grant {
- permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
- permission java.lang.RuntimePermission "accessDeclaredMembers";
-
- permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
- permission java.io.FilePermission ".", "read, write, delete";
- permission java.util.PropertyPermission "*", "read, write";
-
- permission java.lang.RuntimePermission "setSecurityManager";
- permission java.lang.RuntimePermission "createSecurityManager";
- permission java.lang.RuntimePermission "createClassLoader";
- permission java.lang.RuntimePermission "setIO";
- permission java.lang.RuntimePermission "setContextClassLoader";
- permission java.security.SecurityPermission "getPolicy";
-
- permission java.io.FilePermission "${test.src}/-", "read, write, delete";
- permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
- permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
-
-
- permission java.lang.RuntimePermission "modifyThread";
-
-};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java
index a1218b1616e..8c615c5d3a0 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/AnyElementTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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,7 +23,11 @@
package validation;
/*
+ * @test
* @bug 8080907
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.AnyElementTest
+ * @run testng/othervm validation.AnyElementTest
* @summary Test processContents attribute of any element
*/
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
@@ -35,10 +39,12 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
+@Listeners({jaxp.library.FilePolicy.class})
public class AnyElementTest {
@BeforeClass
public void setup() throws URISyntaxException, SAXException {
@@ -79,3 +85,4 @@ public class AnyElementTest {
private Validator validator;
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java
index 1e9d473fb5c..3c0c6db7b46 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966232.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,14 +30,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4966232
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4966232
+ * @run testng/othervm validation.Bug4966232
* @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource & SAXSource.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966232 {
// test for W3C XML Schema 1.0 - newSchema(Source schema)
@@ -69,3 +75,4 @@ public class Bug4966232 {
Assert.assertNotNull(s);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java
index e081f37f072..4eafe25cac9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4966254.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,15 +29,21 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import util.DraconianErrorHandler;
/*
+ * @test
* @bug 4966254
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4966254
+ * @run testng/othervm validation.Bug4966254
* @summary Test validate(StreamSource) & validate(StreamSource,null) works instead of throws IOException.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug4966254 {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -72,3 +78,4 @@ public class Bug4966254 {
return s;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java
index d04395e6615..31770d19436 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug4969042.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -34,6 +34,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.ValidatorHandler;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -41,10 +42,15 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 4969042
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug4969042
+ * @run testng/othervm validation.Bug4969042
* @summary Test ValidationHandler shall invoke ignorableWhitespace() of the
* user-defined ContentHandler once the validator detects any ignorable whitespaces.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4969042 {
public static final String XSD = "\n" + "" + "CheetahTech"
@@ -59,21 +67,17 @@ public class Bug6457662 {
private static final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@Test
- public void test() {
- try {
- final Schema sc = factory.newSchema(writeSchema());
- final Validator validator = sc.newValidator();
- validator.validate(new StreamSource(new StringReader(xml)));
- validator.validate(new StreamSource(new StringReader(xml)));
- validator.validate(new StreamSource(new StringReader(xml)));
- validator.validate(new StreamSource(new StringReader(xml)));
- } catch (Throwable ex) {
- Assert.fail("Exception: " + ex.getMessage());
- }
+ public void test() throws Exception {
+ final Schema sc = factory.newSchema(writeSchema());
+ final Validator validator = sc.newValidator();
+ validator.validate(new StreamSource(new StringReader(xml)));
+ validator.validate(new StreamSource(new StringReader(xml)));
+ validator.validate(new StreamSource(new StringReader(xml)));
+ validator.validate(new StreamSource(new StringReader(xml)));
}
private File writeSchema() throws IOException {
- final File rtn = File.createTempFile("scheam", "xsd");
+ final File rtn = File.createTempFile("scheam", "xsd", Paths.get(USER_DIR).toFile());
final OutputStream out = new FileOutputStream(rtn);
final OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
writer.write(schema);
@@ -82,3 +86,4 @@ public class Bug6457662 {
return rtn;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java
index 4ebce561e3f..b5ebcb6dd31 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6467424Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -43,14 +43,20 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6467424
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6467424Test
+ * @run testng/othervm validation.Bug6467424Test
* @summary Test Validator augments the default delement value if feature element-default is on.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6467424Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -199,3 +205,4 @@ public class Bug6467424Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java
index f5947130ee7..ceebedf2212 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6483188.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,29 +31,25 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6483188
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6483188
+ * @run testng/othervm validation.Bug6483188
* @summary Test Schema Validator can handle element with having large maxOccurs, but doesn't accept sequence with having large maxOccurs in FEATURE_SECURE_PROCESSING mode.
*/
+@Test(singleThreaded = true)
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6483188 {
- static boolean _isSecureMode = false;
- static {
- if (System.getSecurityManager() != null) {
- _isSecureMode = true;
- System.out.println("Security Manager is present");
- } else {
- System.out.println("Security Manager is NOT present");
- }
- }
-
SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- @Test
public void testLargeElementNoSecurity() {
- if (_isSecureMode)
+ if (System.getSecurityManager() != null)
return; // jaxp secure feature can not be turned off when security
// manager is present
try {
@@ -66,7 +62,6 @@ public class Bug6483188 {
}
}
- @Test
public void testLargeElementWithSecurity() {
try {
sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
@@ -78,7 +73,6 @@ public class Bug6483188 {
}
}
- @Test
public void testLargeSequenceWithSecurity() {
try {
sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
@@ -94,3 +88,4 @@ public class Bug6483188 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java
index 2da6c45a1fb..ed790064c7f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6493687.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,13 +23,19 @@
package validation;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 6493687
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6493687
+ * @run testng/othervm validation.Bug6493687
* @summary Test validator.validate(new DOMSource(node)) without any exception.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6493687 {
@Test
@@ -42,3 +48,4 @@ public class Bug6493687 {
System.out.println("Got here3");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java
index 2c9906c9711..8e32d70ab19 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6509668.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -36,6 +36,7 @@ import javax.xml.validation.TypeInfoProvider;
import javax.xml.validation.ValidatorHandler;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.TypeInfo;
import org.xml.sax.Attributes;
@@ -45,9 +46,14 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6509668
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6509668
+ * @run testng/othervm validation.Bug6509668
* @summary Test TypeInfoProvider.getElementTypeInfo() for union type when startElement and endElement.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6509668 {
public static final String XSD = "\n" + "\n"
@@ -64,3 +70,4 @@ public class Bug6531160 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java
index e70dbff8a11..c0f85a31e0e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6695843Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,14 +35,20 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6695843
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6695843Test
+ * @run testng/othervm validation.Bug6695843Test
* @summary Test Validator should report accurate element type if there is a violation on a complexType with simpleContent that extends a base complexType.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6695843Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -76,3 +82,4 @@ public class Bug6695843Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java
index 98737edebaf..4ac7b5b977b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6773084Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,6 +23,8 @@
package validation;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
@@ -43,7 +45,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.ErrorHandler;
@@ -51,9 +53,14 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6773084
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6773084Test
+ * @run testng/othervm validation.Bug6773084Test
* @summary Test Schema object is thread safe.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6773084Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -68,11 +75,6 @@ public class Bug6773084Test {
private static Schema schema;
- @BeforeClass
- public void setup(){
- policy.PolicyUtil.changePolicy(getClass().getResource("6773084.policy").getFile());
- }
-
@Test
public void test() throws Exception {
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
@@ -94,7 +96,7 @@ public class Bug6773084Test {
for (int i = 0; i < files.length; i++) {
EXEC.execute(new XMLValiddator(files[i], i));
}
- EXEC.shutdown();
+ runWithAllPerm(() -> EXEC.shutdown());
}
@@ -164,3 +166,4 @@ public class Bug6773084Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java
index 1bb0d046499..aafc2974ec1 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6859210.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,15 +32,21 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6859210
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6859210
+ * @run testng/othervm validation.Bug6859210
* @summary Test Schema Validator can parse xml when maxOccurs is large.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6859210 {
boolean errorFound;
@@ -94,3 +100,4 @@ public class Bug6859210 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java
index b3fad32adb0..cc36b1e541d 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6925531Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -40,6 +40,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -47,9 +48,14 @@ import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
/*
+ * @test
* @bug 6925531
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6925531Test
+ * @run testng/othervm validation.Bug6925531Test
* @summary Test Validator can validate SAXSource when SecurityManager is set or FEATURE_SECURE_PROCESSING is on.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug6925531Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -204,3 +210,4 @@ public class Bug6925531Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java
index 5f0b19d50dc..e5dda822b03 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6946312Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -35,6 +35,7 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
@@ -44,9 +45,14 @@ import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
/*
+ * @test
* @bug 6946312
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6946312Test
+ * @run testng/othervm validation.Bug6946312Test
* @summary Test XML parser shall callback to ContentHandler when receiving characters data.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6946312Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -122,3 +128,4 @@ public class Bug6946312Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java
index 5118754af73..38eebc162bc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Bug6954738_Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,15 +31,21 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6954738
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Bug6954738_Test
+ * @run testng/othervm validation.Bug6954738_Test
* @summary Test Validator can process a XML document containing an element with 8000 characters.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6954738_Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -77,3 +83,4 @@ public class Bug6954738_Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java
index 7c9b0bd83e1..8221278929b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6708840Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,12 +38,18 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6708840
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.CR6708840Test
+ * @run testng/othervm validation.CR6708840Test
* @summary Test Validator can process StAXSource.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6708840Test {
@Test
@@ -134,3 +140,4 @@ public class CR6708840Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java
index 26a239b2854..31af92f26fc 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/CR6740048.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,6 +30,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import org.w3c.dom.Document;
@@ -38,9 +39,14 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
* @bug 6740048
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.CR6740048
+ * @run testng/othervm validation.CR6740048
* @summary Test DocumentBuilder can be reused when the DocumentBuilderFactory sets schema.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class CR6740048 {
private static final String TAG_INFO = "containerInfo";
private static final String SCHEMA_LANGUAGE_URL = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
@@ -51,9 +57,6 @@ public class CR6740048 {
public final void testReusingDocumentBuilder() {
try {
- //ClassLoader loader = CR6740048.class.getClassLoader();
-
- // Object xsd = loader.getResourceAsStream("CR6740048.xsd");
InputStream xsd = this.getClass().getResourceAsStream("CR6740048.xsd");
// create document builder
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
@@ -128,3 +131,4 @@ public class CR6740048 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java
index 95806ed3f21..775fdd07c6a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ErrorHandlerImpl.java
@@ -45,3 +45,4 @@ public class ErrorHandlerImpl implements ErrorHandler {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java
index e1753f06817..943f23d1b8c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/Issue682Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,6 +32,7 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.testng.Assert;
import org.xml.sax.InputSource;
@@ -39,8 +40,13 @@ import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.Issue682Test
+ * @run testng/othervm validation.Issue682Test
* @summary Test comination of fields in , for https://issues.apache.org/jira/browse/XERCESJ-682.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Issue682Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -72,3 +78,4 @@ public class Issue682Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java b/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java
index 765fa1329c5..68ba8c10152 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/IssueTracker30.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.IssueTracker30
+ * @run testng/othervm validation.IssueTracker30
* @summary Test maxOccurs validation.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class IssueTracker30 {
boolean errorFound;
@@ -126,3 +132,4 @@ public class IssueTracker30 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java
index e590b221330..4b506680016 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue43Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,15 +38,21 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
/*
+ * @test
* @bug 6631318
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.JaxpIssue43Test
+ * @run testng/othervm validation.JaxpIssue43Test
* @summary Test creating schema from a DOM fragment with namespace.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class JaxpIssue43Test {
@Test
@@ -78,3 +84,4 @@ public class JaxpIssue43Test {
return list.toArray(new Source[list.size()]);
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java
index aec363119a1..b53a10ee86e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/JaxpIssue49.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -38,13 +38,19 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Node;
/*
+ * @test
* @bug 6684227
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.JaxpIssue49
+ * @run testng/othervm validation.JaxpIssue49
* @summary Test property current-element-node works.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class JaxpIssue49 {
private Schema schema;
@@ -88,3 +94,4 @@ public class JaxpIssue49 {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java
index d78322723c7..6681ab76918 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/LargeMaxOccursTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,11 +31,17 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.LargeMaxOccursTest
+ * @run testng/othervm validation.LargeMaxOccursTest
* @summary Test Validator shall report error for maxOccurs > 5000 when FEATURE_SECURE_PROCESSING is on, except the schema can be applied for constant-space algorithm.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class LargeMaxOccursTest {
@Test
@@ -103,3 +109,4 @@ public class LargeMaxOccursTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java
index 014e8af7dad..33340dd6a29 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.MultiOccursTest
+ * @run testng/othervm validation.MultiOccursTest
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class MultiOccursTest {
boolean errorFound;
@@ -141,3 +147,4 @@ public class MultiOccursTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java
index b6069c26a3b..8330ac5de52 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/MultiOccursUnboundedTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.MultiOccursUnboundedTest
+ * @run testng/othervm validation.MultiOccursUnboundedTest
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class MultiOccursUnboundedTest {
boolean errorFound;
@@ -109,3 +115,4 @@ public class MultiOccursUnboundedTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java
index 0cb9177760c..bce2b0d2d42 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursTest
+ * @run testng/othervm validation.OccursTest
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class OccursTest {
boolean errorFound;
@@ -141,3 +147,4 @@ public class OccursTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java
index df0e07829dd..a986cc1f669 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursUnboundedTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursUnboundedTest
+ * @run testng/othervm validation.OccursUnboundedTest
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class OccursUnboundedTest {
boolean errorFound;
@@ -109,3 +115,4 @@ public class OccursUnboundedTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java
index 36b97cf9361..649dcd27d73 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursWildcardTest
+ * @run testng/othervm validation.OccursWildcardTest
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class OccursWildcardTest {
boolean errorFound;
@@ -141,3 +147,4 @@ public class OccursWildcardTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java
index b454db97b22..ee82f528855 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/OccursWildcardUnbounded.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.OccursWildcardUnbounded
+ * @run testng/othervm validation.OccursWildcardUnbounded
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class OccursWildcardUnbounded {
boolean errorFound;
@@ -109,3 +115,4 @@ public class OccursWildcardUnbounded {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java
index 74169f4af09..aa9540d911c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesId005Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ParticlesId005Test
+ * @run testng/othervm validation.ParticlesId005Test
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ParticlesId005Test {
boolean errorFound;
@@ -93,3 +99,4 @@ public class ParticlesId005Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java
index 2fe1a305e2a..f08dbad1e54 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesIg004Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,11 +31,17 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ParticlesIg004Test
+ * @run testng/othervm validation.ParticlesIg004Test
* @summary Test particlesIg004.xsd.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ParticlesIg004Test {
@Test
@@ -51,3 +57,4 @@ public class ParticlesIg004Test {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java
index 33e73d5ce80..05d727f536a 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ParticlesQ013Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,14 +32,20 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ParticlesQ013Test
+ * @run testng/othervm validation.ParticlesQ013Test
* @summary Test Schema Validator can parse multiple or unbounded occurs.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ParticlesQ013Test {
boolean errorFound;
@@ -92,3 +98,4 @@ public class ParticlesQ013Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java
index f8a5e62ac55..ef2bf3741c4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/SchemaTest.java
@@ -28,12 +28,18 @@ import java.io.File;
import javax.xml.XMLConstants;
import javax.xml.validation.SchemaFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.SchemaTest
+ * @run testng/othervm validation.SchemaTest
* @summary Test Schema creation
* @bug 8149915
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class SchemaTest {
/*
@@ -48,3 +54,4 @@ public class SchemaTest {
factory.newSchema(new File(getClass().getResource("Bug8149915.xsd").getFile()));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java
index c88c09b85f5..79fecdcf9f5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/TCKGroupA008Test.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -30,12 +30,18 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.TCKGroupA008Test
+ * @run testng/othervm validation.TCKGroupA008Test
* @summary Test groupA008.xsd.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class TCKGroupA008Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -54,3 +60,4 @@ public class TCKGroupA008Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java
index 9dd421a4a26..720164f09cd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/ValidatorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,9 +23,12 @@
package validation;
+import static jaxp.library.JAXPTestUtilities.runWithTmpPermission;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
+import java.util.PropertyPermission;
import javax.xml.XMLConstants;
import javax.xml.stream.XMLEventReader;
@@ -39,12 +42,18 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.ValidatorTest
+ * @run testng/othervm validation.ValidatorTest
* @summary Test Validator.validate(Source, Result).
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ValidatorTest {
@Test
@@ -83,10 +92,11 @@ public class ValidatorTest {
if (resultFile.exists()) {
resultFile.delete();
}
-
// Validate this instance document against the
// Instance document supplied
- Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+ File resultAlias = resultFile;
+ Result xmlResult = runWithTmpPermission(() -> new javax.xml.transform.stream.StreamResult(
+ resultAlias), new PropertyPermission("user.dir", "read"));
Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("toys.xml").toURI()));
validate("toys.xsd", xmlSource, xmlResult);
@@ -114,7 +124,9 @@ public class ValidatorTest {
// Validate this instance document against the
// Instance document supplied
- Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+ File resultAlias = resultFile;
+ Result xmlResult = runWithTmpPermission(() -> new javax.xml.transform.stream.StreamResult(
+ resultAlias), new PropertyPermission("user.dir", "read"));
Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("gMonths.xml").toURI()));
validate("gMonths.xsd", xmlSource, xmlResult);
@@ -196,3 +208,4 @@ public class ValidatorTest {
return xmlr;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java
index de9b0d935e4..bdd8107daba 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLDocBuilder.java
@@ -141,3 +141,4 @@ public class XMLDocBuilder {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java
index beb05e56afb..b09a6b77674 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/XMLSchemaValidator.java
@@ -59,3 +59,4 @@ public class XMLSchemaValidator {
validator.validate(new DOMSource(node));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java
index 67dbb9a4b80..286094eb69f 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6943252Test.java
@@ -31,13 +31,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6943252
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6943252Test
+ * @run testng/othervm validation.tck.Bug6943252Test
* @summary Test Schema doesn't allow to use value more than allowed by base type.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6943252Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -63,3 +69,4 @@ public class Bug6943252Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java
index 1734c536359..969c66d27ce 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963124Test.java
@@ -29,13 +29,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6963124
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6963124Test
+ * @run testng/othervm validation.tck.Bug6963124Test
* @summary Test Schema doesn't allow maxOccurs > 1 for reference to all model group.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6963124Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -55,3 +61,4 @@ public class Bug6963124Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java
index 269d7b36192..ea2f0894e37 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6963468Test.java
@@ -36,6 +36,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -45,9 +46,14 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6963468
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6963468Test
+ * @run testng/othervm validation.tck.Bug6963468Test
* @summary Test Validation allows element a is a union type and element b specifies a as its substitution group and b type is or is derived from one of the member types of the union.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6963468Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -142,3 +148,4 @@ public class Bug6963468Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java
index ca0b6509498..0536cbe3514 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6964720Test.java
@@ -29,13 +29,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6964720
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6964720Test
+ * @run testng/othervm validation.tck.Bug6964720Test
* @summary Test Schema doesn't allow the inexpressible union of two attribute wildcards.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6964720Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -52,3 +58,4 @@ public class Bug6964720Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java
index 66d2e0bb254..06e4ce81c92 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6967214Test.java
@@ -31,13 +31,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6967214
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6967214Test
+ * @run testng/othervm validation.tck.Bug6967214Test
* @summary Test Schema doesn't allow unpaired parenthesises in regex.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6967214Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -64,3 +70,4 @@ public class Bug6967214Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java
index 460989a2877..3e3afac5889 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6970890Test.java
@@ -29,13 +29,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6970890
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6970890Test
+ * @run testng/othervm validation.tck.Bug6970890Test
* @summary Test Schema allows [-] in regex.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6970890Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -66,3 +72,4 @@ public class Bug6970890Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java
index 89e1c3d8ef4..ca733947c0e 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6971190Test.java
@@ -32,13 +32,19 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6971190
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6971190Test
+ * @run testng/othervm validation.tck.Bug6971190Test
* @summary Test Validation accepts UTF lexical presentation.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6971190Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -96,3 +102,4 @@ public class Bug6971190Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java
index f2248a4fc16..f4d3581f00c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6974551Test.java
@@ -34,15 +34,21 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6974551
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6974551Test
+ * @run testng/othervm validation.tck.Bug6974551Test
* @summary Test Validation for SAXParser can expose whitespace facet for xs:anySimpleType.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6974551Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -116,3 +122,4 @@ public class Bug6974551Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java
index 2a5f557a81a..12ed8261b60 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6975265Test.java
@@ -31,13 +31,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 6975265
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6975265Test
+ * @run testng/othervm validation.tck.Bug6975265Test
* @summary Test Schema doesn't allow some Element Information Items contain other element information item.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6975265Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -65,3 +71,4 @@ public class Bug6975265Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java
index f5b6e497838..df77551338b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6977201Test.java
@@ -30,12 +30,18 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6977201
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6977201Test
+ * @run testng/othervm validation.tck.Bug6977201Test
* @summary Test Validator interprets regex "" correctly.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6977201Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -65,3 +71,4 @@ public class Bug6977201Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java
index 94682bb15d1..d1be119584b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug6989956Test.java
@@ -36,6 +36,7 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
@@ -45,9 +46,14 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
/*
+ * @test
* @bug 6989956
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug6989956Test
+ * @run testng/othervm validation.tck.Bug6989956Test
* @summary Test Validation can process correctly that maxOccurs in Choice less than maxOccurs in Elements contained in the Choice.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug6989956Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -142,3 +148,4 @@ public class Bug6989956Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java
index f6316c962fa..025c972c288 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/Bug7014246Test.java
@@ -29,13 +29,19 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 7014246
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.Bug7014246Test
+ * @run testng/othervm validation.tck.Bug7014246Test
* @summary Test Schema doesn't allow maxInclusive of derived time type greater than the base.
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class Bug7014246Test {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -53,3 +59,4 @@ public class Bug7014246Test {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java
index f82e4d28158..19a9eb77d68 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/ParticleTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -28,16 +28,22 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 8142463
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.ParticleTest
+ * @run testng/othervm validation.tck.ParticleTest
* @summary Tests that verify bug fixes for Particles (http://www.w3.org/TR/xmlschema11-1/#cParticles)
* @author Joe Wang (huizhe.wang@oracle.com)
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class ParticleTest {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -57,3 +63,4 @@ public class ParticleTest {
validator.validate(new StreamSource(ParticleTest.class.getResourceAsStream("upa01.xml")));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java
index dd59b93a378..a46c7c720b2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/validation/tck/RegexWord.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -28,15 +28,21 @@ import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
/*
+ * @test
* @bug 8142900
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true validation.tck.RegexWord
+ * @run testng/othervm validation.tck.RegexWord
* @summary Verifies that all characters except the set of "punctuation",
* "separator" and "other" characters are accepted by \w [#x0000-#x10FFFF]-[\p{P}\p{Z}\p{C}]
* @author Joe Wang
*/
+@Listeners({jaxp.library.FilePolicy.class})
public class RegexWord {
static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
@@ -57,3 +63,4 @@ public class RegexWord {
validator.validate(new StreamSource(RegexWord.class.getResourceAsStream("reZ003vExc23082309.xml")));
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java
index aa37ec70959..a8f65a22b48 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991857.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,14 +29,20 @@ import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
/*
+ * @test
* @bug 4991857
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4991857
+ * @run testng/othervm xpath.Bug4991857
* @summary XPath.evaluate(...) throws XPathExpressionException when context is null and expression refers to the context.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4991857 {
Document d = null;
@@ -86,3 +92,4 @@ public class Bug4991857 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java
index 206c6aa1b2a..d201f489461 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4991939.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -29,12 +29,18 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 4991939
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4991939
+ * @run testng/othervm xpath.Bug4991939
* @summary XPath.evaluate(...) throws IllegalArgumentException if returnType is not one of the types defined in XPathConstants.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4991939 {
@Test
@@ -55,3 +61,4 @@ public class Bug4991939 {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java
index 2b4f9c29078..4da3e2de999 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992788.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -31,13 +31,19 @@ import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathFactoryConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4992788
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4992788
+ * @run testng/othervm xpath.Bug4992788
* @summary Test XPath.evaluate(expression,source,returnType) throws NPE if source is null.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4992788 {
private static String expression = "/widgets/widget[@name='a']/@quantity";
@@ -76,3 +82,4 @@ public class Bug4992788 {
return xpath;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java
index 5810cd6f59b..2e4a4128ff9 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992793.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -33,13 +33,19 @@ import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathFactoryConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4992793
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4992793
+ * @run testng/othervm xpath.Bug4992793
* @summary Test XPath.evaluate(expression,source,returnType) throws NPE if expression is null.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4992793 {
@@ -77,3 +83,4 @@ public class Bug4992793 {
return xpath;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java
index b847febc112..97a9abfcca4 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/Bug4992805.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -32,13 +32,19 @@ import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathFactoryConfigurationException;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.xml.sax.InputSource;
/*
+ * @test
* @bug 4992805
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.Bug4992805
+ * @run testng/othervm xpath.Bug4992805
* @summary Test XPath.evaluate(expression,source,returnType) throws NPE if returnType is null.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class Bug4992805 {
private static String expression = "/widgets/widget[@name='a']/@quantity";
@@ -64,3 +70,4 @@ public class Bug4992805 {
return xpath;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java
index 9a3a66a6b2f..d5a52bda8a2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/ClassLoaderTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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,21 +23,29 @@
package xpath;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+
import javax.xml.xpath.XPathFactory;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6354969
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.ClassLoaderTest
+ * @run testng/othervm xpath.ClassLoaderTest
* @summary Test XPathFactory newInstance() with ContextClassLoader.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class ClassLoaderTest {
@Test
public void testClassLoader() {
- MyClassLoader cl = new MyClassLoader();
- Thread.currentThread().setContextClassLoader(cl);
+ MyClassLoader cl = runWithAllPerm(() -> new MyClassLoader());
+ runWithAllPerm(() -> Thread.currentThread().setContextClassLoader(cl));
XPathFactory xPathFactory = XPathFactory.newInstance();
if (!cl.isCalled()) {
@@ -46,3 +54,4 @@ public class ClassLoaderTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java
index d333e7053a6..39a0d72815c 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/MyClassLoader.java
@@ -47,3 +47,4 @@ public class MyClassLoader extends ClassLoader {
return isCalled;
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java
index cbd44e920f0..a78c1e1439b 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/SecureProcessingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -43,26 +43,23 @@ import javax.xml.xpath.XPathFunctionException;
import javax.xml.xpath.XPathFunctionResolver;
import org.testng.Assert;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.SecureProcessingTest
+ * @run testng/othervm xpath.SecureProcessingTest
* @summary Test when FEATURE_SECURE_PROCESSING is true, calling an external function will cause XPathFunctionException.
*/
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
public class SecureProcessingTest {
- static boolean _isSecureMode = false;
- static {
- if (System.getSecurityManager() != null) {
- _isSecureMode = true;
- System.out.println("Security Manager is present");
- } else {
- System.out.println("Security Manager is NOT present");
- }
- }
-
- @Test
public final void testSecureProcessing() {
+ boolean _isSecureMode = System.getSecurityManager() != null;
final String XPATH_EXPRESSION = "ext:helloWorld()";
@@ -150,7 +147,7 @@ public class SecureProcessingTest {
}
}
- public class MyXPathFunctionResolver implements XPathFunctionResolver {
+ private class MyXPathFunctionResolver implements XPathFunctionResolver {
public XPathFunction resolveFunction(QName functionName, int arity) {
@@ -159,7 +156,7 @@ public class SecureProcessingTest {
}
}
- public class MyXPathFunction implements XPathFunction {
+ private class MyXPathFunction implements XPathFunction {
public Object evaluate(List list) throws XPathFunctionException {
@@ -167,7 +164,7 @@ public class SecureProcessingTest {
}
}
- public class MyNamespaceContext implements NamespaceContext {
+ private class MyNamespaceContext implements NamespaceContext {
public String getNamespaceURI(String prefix) {
if (prefix == null) {
@@ -199,3 +196,4 @@ public class SecureProcessingTest {
}
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java
index c42101a334a..6ba9ceb48bd 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathAnyTypeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -32,15 +32,21 @@ import javax.xml.xpath.XPathExpressionException;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
/*
+ * @test
* @bug 8054196
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.XPathAnyTypeTest
+ * @run testng/othervm xpath.XPathAnyTypeTest
* @summary Test for the project XPath: support any type. This test covers the new
* evaluateExpression methods of XPath, as well as XPathNodes and XPathEvaluationResult.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XPathAnyTypeTest extends XPathTestBase {
/*
Test for resolveFunction(QName functionName,int arity); evaluate throws
@@ -194,3 +200,4 @@ public class XPathAnyTypeTest extends XPathTestBase {
verifyResult(result, "Customer");
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java
index ab9750732bd..f661fe9a035 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathExpAnyTypeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -34,15 +34,21 @@ import javax.xml.xpath.XPathEvaluationResult;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
/*
+ * @test
* @bug 8054196
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.XPathExpAnyTypeTest
+ * @run testng/othervm xpath.XPathExpAnyTypeTest
* @summary Test for the project XPath: support any type. This test covers the new
* evaluateExpression methods of XPathExpression.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XPathExpAnyTypeTest extends XPathTestBase {
/*
@@ -181,3 +187,4 @@ public class XPathExpAnyTypeTest extends XPathTestBase {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java
index ee6687949b3..a6c80541968 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -27,12 +27,18 @@ import javax.xml.namespace.NamespaceContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
+import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
/*
+ * @test
* @bug 6376058
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true xpath.XPathTest
+ * @run testng/othervm xpath.XPathTest
* @summary Test XPath.getNamespaceContext() is supported.
*/
+@Listeners({jaxp.library.BasePolicy.class})
public class XPathTest {
@Test
@@ -45,3 +51,4 @@ public class XPathTest {
}
}
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java
index 4d9666afd0a..8ee45dec579 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/xpath/XPathTestBase.java
@@ -115,7 +115,7 @@ class XPathTestBase {
* DataProvider: XPath object
*/
@DataProvider(name = "xpath")
- Object[][] getXPath() {
+ public Object[][] getXPath() {
return new Object[][]{{XPathFactory.newInstance().newXPath()}};
}
@@ -123,7 +123,7 @@ class XPathTestBase {
* DataProvider: Numeric types not supported
*/
@DataProvider(name = "invalidNumericTypes")
- Object[][] getInvalidNumericTypes() {
+ public Object[][] getInvalidNumericTypes() {
XPath xpath = XPathFactory.newInstance().newXPath();
return new Object[][]{{xpath, AtomicInteger.class},
{xpath, AtomicInteger.class},
@@ -140,7 +140,7 @@ class XPathTestBase {
* DataProvider: XPath and Document objects
*/
@DataProvider(name = "document")
- Object[][] getDocument() throws Exception {
+ public Object[][] getDocument() throws Exception {
DocumentBuilderFactory dBF = DocumentBuilderFactory.newInstance();
dBF.setValidating(false);
dBF.setNamespaceAware(true);