changeset 976:411e97c592d9

Merge
author prr
date Thu, 11 Aug 2016 10:38:13 -0700
parents 30b9c989ba71 16ba98d804eb
children cdc625b3be4c
files test/javax/xml/jaxp/functional/TEST.properties test/javax/xml/jaxp/internaltest/TEST.properties test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl test/javax/xml/jaxp/isolatedjdk/TEST.properties test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java test/javax/xml/jaxp/libs/jaxp/library/JAXPFileReadOnlyBaseTest.java test/javax/xml/jaxp/libs/jaxp/library/TestPolicy.java test/javax/xml/jaxp/module/TEST.properties test/javax/xml/jaxp/unittest/policy/PolicyUtil.java test/javax/xml/jaxp/unittest/policy/common.policy test/javax/xml/jaxp/unittest/transform/CR6551600.policy test/javax/xml/jaxp/unittest/validation/6773084.policy
diffstat 472 files changed, 6314 insertions(+), 3376 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Aug 05 12:03:50 2016 -0700
+++ b/.hgtags	Thu Aug 11 10:38:13 2016 -0700
@@ -373,3 +373,4 @@
 8a7681a9d70640ac7fbf05c28f53c1d51d8d00a1 jdk-9+128
 74241304e87b0d463391a8ecab40979b5af86dc2 jdk-9+129
 e66cdc2de6b02443911d386fc9217b0d824d0686 jdk-9+130
+874082a9b565a7092a40bfa934a6e3e3c3455a60 jdk-9+131
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/message.properties	Fri Aug 05 12:03:50 2016 -0700
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xpath/regex/message.properties	Thu Aug 11 10:38:13 2016 -0700
@@ -37,5 +37,3 @@
 parser.quantifier.3=Invalid quantifier. A digit or '}' is expected.
 parser.quantifier.4=Invalid quantifier. A min quantity must be <= a max quantity.
 parser.quantifier.5=Invalid quantifier. A quantity value overflow.
-null
-null
--- a/test/ProblemList.txt	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/ProblemList.txt	Thu Aug 11 10:38:13 2016 -0700
@@ -27,4 +27,4 @@
 
 javax/xml/jaxp/unittest/common/TransformationWarningsTest.java	8150145 generic-all
 
-javax/xml/jaxp/unittest/stream/FactoryFindTest.java             8156508 generic-all
+javax/xml/jaxp/unittest/common/ValidationWarningsTest.java      8150145 generic-all
--- a/test/TEST.ROOT	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/TEST.ROOT	Thu Aug 11 10:38:13 2016 -0700
@@ -14,8 +14,16 @@
 # Tests that must run in othervm mode
 othervm.dirs=javax/xml/jaxp
 
+lib.dirs = /javax/xml/jaxp/libs
+
+# Declare module dependency
+modules=java.xml
+
 # Group definitions
 groups=TEST.groups
 
 # Minimum jtreg version
-requiredVersion=4.2 b02
+requiredVersion=4.2 b03
+
+# Use new module options
+useNewOptions=true
--- a/test/javax/xml/jaxp/functional/TEST.properties	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-# This file identifies root(s) of the test-ng hierarchy.
-
-TestNG.dirs = .
-
-lib.dirs = /javax/xml/jaxp/libs
-
-# Tests that must run in othervm mode
-othervm.dirs= /javax/xml/jaxp/functional
-
-# Declare module dependency
-modules=java.xml
-
--- a/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,17 +28,21 @@
 import javax.xml.catalog.CatalogException;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogReferCircularityTest
+ * @run testng/othervm catalog.CatalogReferCircularityTest
  * @summary Via nextCatalog entry, the catalog reference chain may be
  *          a (partial) closed circuit. For instance, a catalog may use itself
  *          as an additional catalog specified in its own nextCatalog entry.
  *          This case tests if the implementation handles this issue.
- * @compile ../../libs/catalog/CatalogTestUtils.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CatalogReferCircularityTest {
 
     @Test(dataProvider = "catalogName",
@@ -49,7 +53,7 @@
     }
 
     @DataProvider(name = "catalogName")
-    private Object[][] catalogName() {
+    public Object[][] catalogName() {
         return new Object[][] {
                 // This catalog defines itself as next catalog.
                 { "catalogReferCircle-itself.xml" },
@@ -60,3 +64,4 @@
                 { "catalogReferCircle-left.xml" } };
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,13 +29,18 @@
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DefaultFeaturesTest
+ * @run testng/othervm catalog.DefaultFeaturesTest
  * @summary This case tests if the default feature values are expected.
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DefaultFeaturesTest {
 
     private CatalogFeatures defaultFeature;
@@ -56,7 +61,7 @@
     }
 
     @DataProvider(name = "feature-value")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][] {
                 { Feature.FILES, null },
                 { Feature.PREFER, CatalogTestUtils.PREFER_PUBLIC },
@@ -64,3 +69,4 @@
                 { Feature.RESOLVE, CatalogTestUtils.RESOLVE_STRICT } };
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,6 +28,8 @@
 import static catalog.CatalogTestUtils.getCatalogPath;
 import static javax.xml.catalog.CatalogFeatures.Feature.DEFER;
 import static javax.xml.catalog.CatalogManager.catalog;
+import static jaxp.library.JAXPTestUtilities.runWithAllPerm;
+import static jaxp.library.JAXPTestUtilities.tryRunWithAllPerm;
 
 import java.lang.reflect.Method;
 
@@ -36,16 +38,20 @@
 
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DeferFeatureTest
+ * @run testng/othervm catalog.DeferFeatureTest
  * @summary This case tests whether the catalogs specified in delegateSystem,
  *          delegatePublic, delegateURI and nextCatalog entries are used lazily
  *          in resolution via defer feature.
- * @compile ../../libs/catalog/CatalogTestUtils.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DeferFeatureTest {
 
     @Test(dataProvider = "catalog-countOfLoadedCatalogFile")
@@ -55,7 +61,7 @@
     }
 
     @DataProvider(name = "catalog-countOfLoadedCatalogFile")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][]{
             // By default, alternative catalogs are not loaded.
             {createCatalog(CatalogFeatures.defaults()), 0},
@@ -75,9 +81,9 @@
     }
 
     private int loadedCatalogCount(Catalog catalog) throws Exception {
-        Method method = catalog.getClass().getDeclaredMethod(
-                "loadedCatalogCount");
-        method.setAccessible(true);
+        Method method = tryRunWithAllPerm(() -> catalog.getClass().getDeclaredMethod("loadedCatalogCount"));
+        runWithAllPerm(() -> method.setAccessible(true));
         return (int) method.invoke(catalog);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DelegatePublicTest
+ * @run testng/othervm catalog.DelegatePublicTest
  * @summary Get matched URIs from DelegatePublic entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DelegatePublicTest {
 
     @Test(dataProvider = "publicId-matchedUri")
@@ -48,7 +51,7 @@
     }
 
     @DataProvider(name = "publicId-matchedUri")
-    private Object[][] dataOnMatch() {
+    public Object[][] dataOnMatch() {
         return new Object[][] {
                 // The matched URI of the specified public id is defined in
                 // a delegate catalog file of the current catalog file.
@@ -79,7 +82,7 @@
     }
 
     @DataProvider(name = "publicId-expectedExceptionClass")
-    private Object[][] dataOnException() {
+    public Object[][] dataOnException() {
         return new Object[][] {
                 // The matched delegatePublic entry of the specified public id
                 // defines a non-existing delegate catalog file. That should
@@ -97,3 +100,4 @@
         return catalogResolver("delegatePublic.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DelegateSystemTest
+ * @run testng/othervm catalog.DelegateSystemTest
  * @summary Get matched URIs from delegateSystem entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DelegateSystemTest {
 
     @Test(dataProvider = "systemId-matchedUri")
@@ -48,7 +51,7 @@
     }
 
     @DataProvider(name = "systemId-matchedUri")
-    private Object[][] dataOnMatch() {
+    public Object[][] dataOnMatch() {
         return new Object[][] {
                 // The matched URI of the specified system id is defined in
                 // a delegate catalog file of the current catalog file.
@@ -79,7 +82,7 @@
     }
 
     @DataProvider(name = "systemId-expectedExceptionClass")
-    private Object[][] dataOnException() {
+    public Object[][] dataOnException() {
         return new Object[][] {
                 // The matched delegateSystem entry of the specified system id
                 // defines a non-existing delegate catalog file. That should
@@ -97,3 +100,4 @@
         return catalogResolver("delegateSystem.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.DelegateUriTest
+ * @run testng/othervm catalog.DelegateUriTest
  * @summary Get matched URIs from delegateURI entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class DelegateUriTest {
 
     @Test(dataProvider = "uri-matchedUri")
@@ -48,7 +51,7 @@
     }
 
     @DataProvider(name = "uri-matchedUri")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][] {
                 // The matched URI of the specified URI reference is defined in
                 // a delegate catalog file of the current catalog file.
@@ -78,7 +81,7 @@
     }
 
     @DataProvider(name = "uri-expectedExceptionClass")
-    private Object[][] dataOnException() {
+    public Object[][] dataOnException() {
         return new Object[][] {
                 // The matched delegateURI entry of the specified URI reference
                 // defines a non-existing delegate catalog file. That should
@@ -96,3 +99,4 @@
         return catalogUriResolver("delegateUri.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/GroupTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/GroupTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,16 +32,19 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.GroupTest
+ * @run testng/othervm catalog.GroupTest
  * @summary Get matched URIs from system, public and uri entries respectively,
  *          and some of the entries are enclosed by group entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class GroupTest {
 
     private static final String CATALOG_GROUP = "group.xml";
@@ -52,7 +55,7 @@
     }
 
     @DataProvider(name = "systemId-matchedUri")
-    private Object[][] dataOnSysId() {
+    public Object[][] dataOnSysId() {
         return new Object[][] {
                 // The matched URI of the specified system id is enclosed by a
                 // group entry.
@@ -78,7 +81,7 @@
     }
 
     @DataProvider(name = "publicId-matchedUri")
-    private Object[][] dataOnPubId() {
+    public Object[][] dataOnPubId() {
         return new Object[][] {
                 // The matched URI of the specified public id is enclosed by a
                 // group entry.
@@ -104,7 +107,7 @@
     }
 
     @DataProvider(name = "uri-matchedUri")
-    private Object[][] dataOnUri() {
+    public Object[][] dataOnUri() {
         return new Object[][] {
                 // The matched URI of the specified URI reference is enclosed by
                 // a group entry.
@@ -128,3 +131,4 @@
         return catalogResolver(CATALOG_GROUP);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -36,17 +36,20 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.LoadCatalogTest
+ * @run testng/othervm catalog.LoadCatalogTest
  * @summary When catalog resolver loads catalog files, the current catalog file
  *          and the catalog files specified by the nextCatalog entries may not
  *          accessible. This case tests how does the resolver handle this issue.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class LoadCatalogTest {
 
     private static final String CATALOG_LOADCATALOGFILES = "loadCatalogFiles.xml";
@@ -62,7 +65,7 @@
     }
 
     @DataProvider(name = "entityResolver")
-    private Object[][] entityResolver() {
+    public Object[][] entityResolver() {
         return new Object[][] {
                 // This EntityResolver loads multiple catalog files one by one.
                 // All of the files are available.
@@ -82,7 +85,7 @@
     }
 
     @DataProvider(name = "uriResolver")
-    private Object[][] uriResolver() {
+    public Object[][] uriResolver() {
         return new Object[][] {
                 // This URIResolver loads multiple catalog files one by one.
                 // All of the files are available.
@@ -108,7 +111,7 @@
     }
 
     @DataProvider(name = "catalogName")
-    private Object[][] catalogName() {
+    public Object[][] catalogName() {
         return new Object[][] {
                 // This catalog file set includes null catalog files.
                 { (String[]) null },
@@ -118,3 +121,4 @@
                 { new String[] { CATALOG_LOADCATALOGFILES } } };
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -33,16 +33,19 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.NextCatalogTest
+ * @run testng/othervm catalog.NextCatalogTest
  * @summary Get matched URIs from system, public and uri entries respectively,
  *          but some of the entries are defined in none-current catalog files.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class NextCatalogTest {
 
     private static final String CATALOG_NEXTCATALOGLEFT
@@ -56,7 +59,7 @@
     }
 
     @DataProvider(name = "systemId-matchedUri")
-    private Object[][] dataOnSysId() {
+    public Object[][] dataOnSysId() {
         return new Object[][] {
                 // This matched URI of the specified system id is defined in a
                 // next catalog file.
@@ -88,7 +91,7 @@
     }
 
     @DataProvider(name = "publicId-matchedUri")
-    private Object[][] dataOnPubId() {
+    public Object[][] dataOnPubId() {
         return new Object[][] {
                 // This matched URI of the specified public id is defined in a
                 // next catalog file.
@@ -120,7 +123,7 @@
     }
 
     @DataProvider(name = "uri-matchedUri")
-    private Object[][] dataOnUri() {
+    public Object[][] dataOnUri() {
         return new Object[][] {
                 // This matched URI of the specified URI reference is defined in
                 // a next catalog file.
@@ -156,3 +159,4 @@
                 CATALOG_NEXTCATALOGRIGHT);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -33,18 +33,21 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.NormalizationTest
+ * @run testng/othervm catalog.NormalizationTest
  * @summary Before matching identifiers and URI references, it has to normalize
  *          the passed identifiers and URI references. And then the catalog
  *          resolver uses the normalized stuff to search the counterparts in
  *          catalog files.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class NormalizationTest {
 
     private static final String CATALOG_NORMALIZATION = "normalization.xml";
@@ -65,7 +68,7 @@
     }
 
     @DataProvider(name = "systemId_uri-matchedUri")
-    private Object[][] dataOnSysIdAndUri() {
+    public Object[][] dataOnSysIdAndUri() {
         return new Object[][] {
                 // The specified system id/URI reference contains spaces. And
                 // the counterparts in system/uri entries also contain spaces.
@@ -87,7 +90,7 @@
     }
 
     @DataProvider(name = "publicId-matchedUri")
-    private Object[][] dataOnPubId() {
+    public Object[][] dataOnPubId() {
         return new Object[][] {
                 // The specified public id contains spaces. And the counterparts
                 // in public entry also contains spaces.
@@ -112,3 +115,4 @@
         return catalogUriResolver(CATALOG_NORMALIZATION);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -33,16 +33,20 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PreferFeatureTest
+ * @run testng/othervm catalog.PreferFeatureTest
  * @summary This case tests how does the feature affect the catalog resolution,
  *          and tests the priority between this feature and attribute prefer
  *          in catalog file.
- * @compile ../../libs/catalog/CatalogTestUtils.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class PreferFeatureTest {
 
     @Test(dataProvider = "prefer-publicId-systemId",
@@ -53,7 +57,7 @@
     }
 
     @DataProvider(name = "prefer-publicId-systemId")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][] {
                 // The feature prefer is system. There's a match for the
                 // specified public id, and no match for the specified system id.
@@ -77,3 +81,4 @@
                 "preferFeature.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/PreferTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/PreferTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,18 +29,21 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PreferTest
+ * @run testng/othervm catalog.PreferTest
  * @summary Get matched URIs from system and public family entries, which
  *          specify the prefer attribute. It tests how does the prefer attribute
  *          affect the resolution procedure. The test rule is based on OASIS
  *          Standard V1.1 section 4.1.1. "The prefer attribute".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class PreferTest {
 
     @Test(dataProvider = "publicId-systemId-matchedUri")
@@ -50,7 +53,7 @@
     }
 
     @DataProvider(name = "publicId-systemId-matchedUri")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][] {
                 // The prefer attribute is public. Both of the specified public
                 // id and system id have matches in the catalog file. But
@@ -89,3 +92,4 @@
         return catalogResolver("prefer.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -30,18 +30,21 @@
 import javax.xml.catalog.CatalogException;
 import javax.xml.catalog.CatalogResolver;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PublicFamilyTest
+ * @run testng/othervm catalog.PublicFamilyTest
  * @summary Get matched URIs from public and delegatePublic entries.
  *          It tests the resolution priorities among the public family entries.
  *          The test rule is based on OASIS Standard V1.1 section 7.1.2.
  *          "Resolution of External Identifiers".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class PublicFamilyTest {
 
     /*
@@ -67,3 +70,4 @@
         return catalogResolver("publicFamily.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/PublicTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/PublicTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.PublicTest
+ * @run testng/othervm catalog.PublicTest
  * @summary Get matched URIs from public entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class PublicTest {
 
     @Test(dataProvider = "publicId-matchedUri")
@@ -89,3 +92,4 @@
         return catalogResolver(CATALOG_PUBLIC);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -40,16 +40,19 @@
 import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogUriResolver;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.ResolveFeatureTest
+ * @run testng/othervm catalog.ResolveFeatureTest
  * @summary This case tests how does resolve feature affect the catalog
  *          resolution.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ResolveFeatureTest {
 
     /*
@@ -128,3 +131,4 @@
         return builder().with(Feature.RESOLVE, resolve).build();
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.RewriteSystemTest
+ * @run testng/othervm catalog.RewriteSystemTest
  * @summary Get matched URIs from rewriteSystem entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class RewriteSystemTest {
 
     @Test(dataProvider = "systemId-matchedUri")
@@ -92,3 +95,4 @@
         return catalogResolver("rewriteSystem.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.RewriteUriTest
+ * @run testng/othervm catalog.RewriteUriTest
  * @summary Get matched URIs from rewriteURI entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class RewriteUriTest {
 
     @Test(dataProvider = "uri-matchedUri")
@@ -92,3 +95,4 @@
         return catalogUriResolver("rewriteUri.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,6 +23,8 @@
 
 package catalog;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import static catalog.CatalogTestUtils.FEATURE_FILES;
 import static catalog.CatalogTestUtils.catalogResolver;
 import static catalog.CatalogTestUtils.catalogUriResolver;
@@ -36,15 +38,18 @@
 import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogUriResolver;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SpecifyCatalogTest
+ * @run testng/othervm catalog.SpecifyCatalogTest
  * @summary This case tests how to specify the catalog files.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SpecifyCatalogTest {
 
     private static final String ID_URI = "http://remote/dtd/uri/doc.dtd";
@@ -76,7 +81,7 @@
      */
     @Test
     public void specifyCatalogViaSysProps() {
-        System.setProperty(FEATURE_FILES,
+        setSystemProperty(FEATURE_FILES,
                 getCatalogPath("specifyCatalog-sysProps.xml"));
 
         checkResolutionOnEntityResolver(catalogResolver((String[]) null),
@@ -106,3 +111,4 @@
         return builder().with(FILES, getCatalogPath(catalogName)).build();
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -31,18 +31,21 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SystemFamilyTest
+ * @run testng/othervm catalog.SystemFamilyTest
  * @summary Get matched URIs from system, rewriteSystem, systemSuffix and
  *          delegateSystem entries. It tests the resolution priorities among
  *          the system family entries. The test rule is based on OASIS
  *          Standard V1.1 section 7.1.2. "Resolution of External Identifiers".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SystemFamilyTest {
 
     @Test(dataProvider = "systemId-matchedUri")
@@ -81,3 +84,4 @@
         return catalogResolver("systemFamily.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SystemSuffixTest
+ * @run testng/othervm catalog.SystemSuffixTest
  * @summary Get matched URIs from systemSuffix entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SystemSuffixTest {
 
     @Test(dataProvider = "systemId-matchedUri")
@@ -92,3 +95,4 @@
         return catalogResolver("systemSuffix.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/SystemTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/SystemTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,18 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.SystemTest
+ * @run testng/othervm catalog.SystemTest
  * @summary Get matched URIs from system entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class SystemTest {
 
     @Test(dataProvider = "systemId-matchedUri")
@@ -89,3 +92,4 @@
         return catalogResolver(CATALOG_SYSTEM);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -31,18 +31,21 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UriFamilyTest
+ * @run testng/othervm catalog.UriFamilyTest
  * @summary Get matched URIs from uri, rewriteURI, uriSuffix and delegateURI
  *          entries. It tests the resolution priorities among the uri family
  *          entries. The test rule is based on OASIS Standard V1.1 section
  *          7.2.2. "Resolution of External Identifiers".
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class UriFamilyTest {
 
     @Test(dataProvider = "uri-matchedUri")
@@ -81,3 +84,4 @@
         return catalogUriResolver("uriFamily.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -31,15 +31,18 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UriSuffixTest
+ * @run testng/othervm catalog.UriSuffixTest
  * @summary Get matched URIs from rewriteURI entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class UriSuffixTest {
 
     @Test(dataProvider = "uri-matchedUri")
@@ -92,3 +95,4 @@
         return catalogUriResolver("uriSuffix.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/UriTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/UriTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,18 @@
 import javax.xml.catalog.CatalogUriResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UriTest
+ * @run testng/othervm catalog.UriTest
  * @summary Get matched URIs from uri entries.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class UriTest {
 
     @Test(dataProvider = "uri-matchedUri")
@@ -101,3 +104,4 @@
         return catalogUriResolver(CATALOG_URI);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,17 +29,20 @@
 import javax.xml.catalog.CatalogResolver;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.UrnUnwrappingTest
+ * @run testng/othervm catalog.UrnUnwrappingTest
  * @summary If the passed public identifier is started with "urn:publicid:",
  *          it has to be regarded as URN and normalized. And then the catalog
  *          resolver uses the normalized stuff to do matching.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class UrnUnwrappingTest {
 
     @Test(dataProvider = "urn-matchedUri")
@@ -48,7 +51,7 @@
     }
 
     @DataProvider(name = "urn-matchedUri")
-    private Object[][] data() {
+    public Object[][] data() {
         return new Object[][] {
                 // The specified public id is URN format.
                 { "urn:publicid:-:REMOTE:DTD+ALICE+DOCALICE+XML:EN",
@@ -64,3 +67,4 @@
         return catalogResolver("urnUnwrapping.xml");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,17 +32,20 @@
 
 import javax.xml.catalog.CatalogException;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
  * @test
  * @bug 8077931
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true catalog.ValidateCatalogTest
+ * @run testng/othervm catalog.ValidateCatalogTest
  * @summary A legal catalog file must be well-formed XML, the root element
  *          must be catalog, and the naming space of the root element must be
  *          urn:oasis:names:tc:entity:xmlns:xml:catalog.
- * @compile ../../libs/catalog/CatalogTestUtils.java
- * @compile ../../libs/catalog/ResolutionChecker.java
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ValidateCatalogTest {
 
     private static final String CATALOG_WRONGROOT = "validateCatalog-wrongRoot.xml";
@@ -99,3 +102,4 @@
                 "http://local/dtd/docAliceURI.dtd");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/DurationTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,17 +44,21 @@
 import javax.xml.datatype.Duration;
 import javax.xml.namespace.QName;
 
-import jaxp.library.JAXPBaseTest;
-
 import org.testng.Assert;
 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 javax.xml.datatype.ptests.DurationTest
+ * @run testng/othervm javax.xml.datatype.ptests.DurationTest
  * @summary Class containing the test cases for Duration.
  */
-public class DurationTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class DurationTest {
 
     private DatatypeFactory datatypeFactory;
 
@@ -583,3 +587,4 @@
     private final BigInteger one = BigInteger.ONE;
 
 }
+
--- a/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/FactoryNewInstanceTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,15 +30,20 @@
 import javax.xml.datatype.Duration;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
 
 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 javax.xml.datatype.ptests.FactoryNewInstanceTest
+ * @run testng/othervm javax.xml.datatype.ptests.FactoryNewInstanceTest
  * @summary Tests for DatatypeFactory.newInstance(factoryClassName , classLoader)
  */
-public class FactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class FactoryNewInstanceTest {
 
     private static final String DATATYPE_FACTORY_CLASSNAME = "com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl";
 
@@ -72,3 +77,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/datatype/ptests/XMLGregorianCalendarTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,18 +39,22 @@
 import javax.xml.datatype.Duration;
 import javax.xml.datatype.XMLGregorianCalendar;
 
-import jaxp.library.JAXPBaseTest;
-
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /*
+ * @test
  * @bug 5049592 5041845 5048932 5064587 5040542 5049531 5049528
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.datatype.ptests.XMLGregorianCalendarTest
+ * @run testng/othervm javax.xml.datatype.ptests.XMLGregorianCalendarTest
  * @summary Class containing the test cases for XMLGregorianCalendar
  */
-public class XMLGregorianCalendarTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLGregorianCalendarTest {
 
     private DatatypeFactory datatypeFactory;
 
@@ -354,3 +358,4 @@
     private final int undef = DatatypeConstants.FIELD_UNDEFINED;
 
 }
+
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,18 +23,21 @@
 
 package javax.xml.parsers.ptests;
 
+import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
+
 import java.io.File;
+
 import javax.xml.parsers.DocumentBuilderFactory;
-import static javax.xml.parsers.ptests.ParserTestConst.GOLDEN_DIR;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.sax.SAXResult;
-import jaxp.library.JAXPFileBaseTest;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
@@ -42,7 +45,14 @@
  * This tests DocumentBuilderFactory for namespace processing and no-namespace
  * processing.
  */
-public class DBFNamespaceTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DBFNamespaceTest
+ * @run testng/othervm javax.xml.parsers.ptests.DBFNamespaceTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DBFNamespaceTest {
 
     /**
      * Provide input for the cases that supporting namespace or not.
@@ -95,3 +105,5 @@
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactoryTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,6 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.FilePermission;
 import java.io.FileReader;
 
 import javax.xml.parsers.DocumentBuilder;
@@ -55,9 +54,9 @@
 import javax.xml.transform.sax.SAXResult;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPFileBaseTest;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -70,7 +69,14 @@
  * @bug 8080907
  * This checks the methods of DocumentBuilderFactoryImpl.
  */
-public class DocumentBuilderFactoryTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DocumentBuilderFactoryTest
+ * @run testng/othervm javax.xml.parsers.ptests.DocumentBuilderFactoryTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentBuilderFactoryTest {
     /**
      * DocumentBuilderFactory implementation class name.
      */
@@ -419,8 +425,6 @@
     @Test
     public void testCheckDocumentBuilderFactory13() throws Exception {
         // Accesing default working directory.
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir + "/*", "read"));
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         DocumentBuilder docBuilder = dbf.newDocumentBuilder();
         Document doc = docBuilder.parse(new File(XML_DIR + "dbf10import.xsl")
@@ -436,8 +440,6 @@
     @Test(expectedExceptions = SAXException.class)
     public void testCheckDocumentBuilderFactory14() throws Exception {
         // Accesing default working directory.
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir, "read"));
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         DocumentBuilder docBuilder = dbf.newDocumentBuilder();
         docBuilder.parse("");
@@ -529,3 +531,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,18 +23,21 @@
 
 package javax.xml.parsers.ptests;
 
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
 import static jaxp.library.JAXPTestUtilities.FILE_SEP;
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FilePermission;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertNotNull;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
@@ -42,8 +45,14 @@
 /**
  * This checks for the methods of DocumentBuilder
  */
-public class DocumentBuilderImpl01 extends JAXPFileReadOnlyBaseTest
-            implements EntityResolver {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.DocumentBuilderImpl01
+ * @run testng/othervm javax.xml.parsers.ptests.DocumentBuilderImpl01
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentBuilderImpl01 implements EntityResolver {
     /**
      * Provide DocumentBuilder.
      *
@@ -82,7 +91,7 @@
      * @param docBuilder document builder instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder)
             throws Exception {
         try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
@@ -97,7 +106,7 @@
      * @param docBuilder document builder instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder)
             throws Exception {
         assertNotNull(docBuilder.parse(new File(XML_DIR,
@@ -109,11 +118,9 @@
      * @param docBuilder document builder instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "builder-provider")
+    @Test(dataProvider = "builder-provider")
     public void testCheckDocumentBuilderImpl06(DocumentBuilder docBuilder)
             throws Exception {
-        setPermissions(new FilePermission(XML_DIR + "../-",
-                "read"));
         try (FileInputStream fis = new FileInputStream(new File(XML_DIR,
                 "DocumentBuilderImpl02.xml"))) {
             assertNotNull(docBuilder.parse(fis, new File(XML_DIR).toURI()
@@ -150,3 +157,5 @@
             return null;
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,20 +23,30 @@
 
 package javax.xml.parsers.ptests;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
 
 import org.testng.annotations.AfterTest;
 import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for SAXParserFactory/DocumentBuilderFactory
  * newInstance methods.
  */
-public class FactoryConfErrorTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.FactoryConfErrorTest
+ * @run testng/othervm javax.xml.parsers.ptests.FactoryConfErrorTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class FactoryConfErrorTest {
 
     /**
      * Set properties DocumentBuilderFactory and SAXParserFactory to invalid
@@ -54,8 +64,8 @@
      */
     @AfterTest
     public void cleanup() {
-        setSystemProperty("javax.xml.parsers.DocumentBuilderFactory", null);
-        setSystemProperty("javax.xml.parsers.SAXParserFactory", null);
+        clearSystemProperty("javax.xml.parsers.DocumentBuilderFactory");
+        clearSystemProperty("javax.xml.parsers.SAXParserFactory");
     }
 
     /**
@@ -76,3 +86,5 @@
         DocumentBuilderFactory.newInstance();
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXFactoryNewInstanceTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,16 +31,21 @@
 import javax.xml.parsers.SAXParserFactory;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXFactoryNewInstanceTest
+ * @run testng/othervm javax.xml.parsers.ptests.SAXFactoryNewInstanceTest
  * @summary Tests for SAXParserFactory.newInstance(factoryClassName , classLoader)
  */
-public class SAXFactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAXFactoryNewInstanceTest {
 
     private static final String SAXPARSER_FACTORY_CLASSNAME = "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
 
@@ -73,3 +78,5 @@
     }
 
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,14 +24,23 @@
 package javax.xml.parsers.ptests;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
+
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for SAXParserFactory API.
  */
-public class SAXParserFactTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserFactTest
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserFactTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAXParserFactTest {
 
     private static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
     private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
@@ -220,3 +229,5 @@
         assertFalse(spf.getFeature(EXTERNAL_P_ENTITIES));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,15 +23,23 @@
 
 package javax.xml.parsers.ptests;
 
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FilePermission;
 import java.io.IOException;
+import java.util.PropertyPermission;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
+
+import jaxp.library.JAXPTestUtilities;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.HandlerBase;
 import org.xml.sax.InputSource;
@@ -41,7 +49,14 @@
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXParserTest {
     /**
      * Provide SAXParser.
      *
@@ -92,13 +107,7 @@
     @Test(expectedExceptions = { SAXException.class },
             dataProvider = "parser-provider")
     public void testParse03(SAXParser saxparser) throws Exception {
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir, "read"));
-        try {
-            saxparser.parse("", new HandlerBase());
-        } finally {
-            setPermissions();
-        }
+        saxparser.parse("", new HandlerBase());
     }
 
     /**
@@ -124,13 +133,7 @@
      */
     @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
     public void testParse05(SAXParser saxparser) throws Exception {
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir, "read"));
-        try {
-            saxparser.parse(new File(""), new HandlerBase());
-        } finally {
-            setPermissions();
-        }
+        tryRunWithTmpPermission(() -> saxparser.parse(new File(""), new HandlerBase()), new PropertyPermission("user.dir", "read"));
     }
 
     /**
@@ -176,23 +179,18 @@
     }
 
     /**
-     * Test with non-existence URI, parsing should fail and throw
-     * SAXException or IOException.
+     * Test with non-existence URI, parsing should fail and throw SAXException
+     * or IOException.
      *
-     * @param saxparser a SAXParser instance.
-     * @throws Exception If any errors occur.
+     * @param saxparser
+     *            a SAXParser instance.
+     * @throws Exception
+     *             If any errors occur.
      */
-    @Test(expectedExceptions = { SAXException.class, IOException.class },
-            dataProvider = "parser-provider")
+    @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
     public void testParse09(SAXParser saxparser) throws Exception {
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir + "/../-", "read"));
-        String uri = " ";
-        try {
-            saxparser.parse(uri, new DefaultHandler());
-        } finally {
-            setPermissions();
-        }
+        JAXPTestUtilities.tryRunWithTmpPermission(() -> saxparser.parse(" ", new DefaultHandler()),
+                new FilePermission(USER_DIR + " ", "read"));
     }
 
     /**
@@ -204,14 +202,8 @@
      */
     @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
     public void testParse10(SAXParser saxparser) throws Exception {
-        String workingDir = getSystemProperty("user.dir");
-        setPermissions(new FilePermission(workingDir, "read"));
         File file = new File("");
-        try {
-            saxparser.parse(file, new DefaultHandler());
-        } finally {
-            setPermissions();
-        }
+        tryRunWithTmpPermission(() -> saxparser.parse(file, new DefaultHandler()), new PropertyPermission("user.dir", "read"));
     }
 
     /**
@@ -248,7 +240,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse13(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(new File(
@@ -263,7 +255,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse14(SAXParser saxparser) throws Exception {
         saxparser.parse(new File(XML_DIR, "parsertest.xml"),
                 new HandlerBase());
@@ -276,7 +268,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse15(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
                 "correct.xml"))) {
@@ -291,7 +283,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse16(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(
                 new File(XML_DIR, "parsertest.xml"))) {
@@ -306,7 +298,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse17(SAXParser saxparser) throws Exception {
         File file = new File(XML_DIR, "correct.xml");
         saxparser.parse(file.toURI().toASCIIString(), new HandlerBase());
@@ -319,7 +311,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse18(SAXParser saxparser) throws Exception {
         saxparser.parse(new File(XML_DIR, "valid.xml"), new HandlerBase());
@@ -332,7 +324,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse19(SAXParser saxparser) throws Exception {
         saxparser.parse(new File(XML_DIR, "correct.xml"), new HandlerBase());
     }
@@ -344,7 +336,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse20(SAXParser saxparser) throws Exception {
         try(FileInputStream instream = new FileInputStream(new File(XML_DIR,
@@ -360,7 +352,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse21(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
                 "correct.xml"))) {
@@ -375,7 +367,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse22(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(
@@ -391,7 +383,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse23(SAXParser saxparser) throws Exception {
         DefaultHandler handler = new DefaultHandler();
         saxparser.parse(new File(XML_DIR, "parsertest.xml"), handler);
@@ -404,7 +396,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse24(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(new File(XML_DIR,
                 "correct.xml"))) {
@@ -420,7 +412,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse25(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(
                 new File(XML_DIR, "parsertest.xml"))) {
@@ -435,7 +427,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse26(SAXParser saxparser) throws Exception {
         File file = new File(XML_DIR, "correct.xml");
         saxparser.parse(file.toURI().toASCIIString(), new DefaultHandler());
@@ -448,7 +440,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse27(SAXParser saxparser) throws Exception {
         saxparser.parse(new File(XML_DIR, "valid.xml"), new DefaultHandler());
@@ -461,7 +453,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse28(SAXParser saxparser) throws Exception {
         saxparser.parse(new File(XML_DIR, "correct.xml"), new DefaultHandler());
     }
@@ -472,7 +464,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class,
+    @Test(expectedExceptions = SAXException.class,
             dataProvider = "parser-provider")
     public void testParse29(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(
@@ -487,7 +479,7 @@
      * @param saxparser a SAXParser instance.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "parser-provider")
+    @Test(dataProvider = "parser-provider")
     public void testParse30(SAXParser saxparser) throws Exception {
         try (FileInputStream instream = new FileInputStream(
                 new File(XML_DIR, "correct.xml"))) {
@@ -500,7 +492,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testParse31() throws Exception {
         try (FileInputStream instream = new FileInputStream(
                 new File(XML_DIR, "ns4.xml"))) {
@@ -510,3 +502,5 @@
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,13 +24,15 @@
 package javax.xml.parsers.ptests;
 
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertNotNull;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXNotSupportedException;
@@ -40,7 +42,14 @@
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest02 extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest02
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest02
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class SAXParserTest02 {
     private static final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
     private static final String XML_STRING = "http://xml.org/sax/properties/xml-string";
     private static final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler";
@@ -260,3 +269,5 @@
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,25 +23,32 @@
 
 package javax.xml.parsers.ptests;
 
+import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
 import java.io.File;
-import java.io.FilePermission;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import static javax.xml.parsers.ptests.ParserTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.fail;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeGroups;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 
 /**
  * Class contains the test cases for SAXParser API
  */
-public class SAXParserTest03 extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.parsers.ptests.SAXParserTest03
+ * @run testng/othervm javax.xml.parsers.ptests.SAXParserTest03
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXParserTest03 {
 
     /**
      * Provide SAXParserFactory.
@@ -63,7 +70,7 @@
      * @param handler an error handler for capturing events.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    @Test(dataProvider = "input-provider")
     public void testParseValidate01(SAXParserFactory spf, MyErrorHandler handler)
             throws Exception {
             spf.newSAXParser().parse(new File(XML_DIR, "parsertest.xml"), handler);
@@ -78,7 +85,7 @@
      * @param handler an error handler for capturing events.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    @Test(dataProvider = "input-provider")
     public void testParseValidate02(SAXParserFactory spf, MyErrorHandler handler)
             throws Exception {
             spf.setNamespaceAware(true);
@@ -95,7 +102,7 @@
      * @param handler an error handler for capturing events.
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, dataProvider = "input-provider")
+    @Test(dataProvider = "input-provider")
     public void testParseValidate03(SAXParserFactory spf, MyErrorHandler handler)
             throws Exception {
         try {
@@ -109,3 +116,5 @@
     }
 
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLEventFactoryNewInstanceTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,20 +23,28 @@
 
 package javax.xml.stream.ptests;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
 import static org.testng.Assert.assertNotNull;
 
 import javax.xml.stream.XMLEventFactory;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
 
 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 javax.xml.stream.ptests.XMLEventFactoryNewInstanceTest
+ * @run testng/othervm javax.xml.stream.ptests.XMLEventFactoryNewInstanceTest
  * @summary Tests for XMLEventFactory.newFactory(factoryId , classLoader)
  */
-public class XMLEventFactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLEventFactoryNewInstanceTest {
 
     private static final String XMLEVENT_FACTORY_CLASSNAME = "com.sun.xml.internal.stream.events.XMLEventFactoryImpl";
     private static final String XMLEVENT_FACRORY_ID = "javax.xml.stream.XMLEventFactory";
@@ -59,7 +67,7 @@
             XMLEventFactory xef = XMLEventFactory.newFactory(factoryId, classLoader);
             assertNotNull(xef);
         } finally {
-            setSystemProperty(XMLEVENT_FACRORY_ID, null);
+            clearSystemProperty(XMLEVENT_FACRORY_ID);
         }
     }
 
@@ -74,3 +82,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/stream/ptests/XMLInputFactoryNewInstanceTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,20 +23,28 @@
 
 package javax.xml.stream.ptests;
 
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+
 import static org.testng.Assert.assertNotNull;
 
 import javax.xml.stream.XMLInputFactory;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
 
 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 javax.xml.stream.ptests.XMLInputFactoryNewInstanceTest
+ * @run testng/othervm javax.xml.stream.ptests.XMLInputFactoryNewInstanceTest
  * @summary Tests for XMLInputFactory.newFactory(factoryId , classLoader)
  */
-public class XMLInputFactoryNewInstanceTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLInputFactoryNewInstanceTest {
 
     private static final String XMLINPUT_FACTORY_CLASSNAME = "com.sun.xml.internal.stream.XMLInputFactoryImpl";
     private static final String XMLINPUT_FACRORY_ID = "javax.xml.stream.XMLInputFactory";
@@ -59,7 +67,7 @@
             XMLInputFactory xif = XMLInputFactory.newFactory(factoryId, classLoader);
             assertNotNull(xif);
         } finally {
-            setSystemProperty(XMLINPUT_FACRORY_ID, null);
+            clearSystemProperty(XMLINPUT_FACRORY_ID);
         }
     }
 
@@ -74,3 +82,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/Bug6384418Test.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,8 @@
 
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 
@@ -34,17 +36,20 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
-import jaxp.library.JAXPFileBaseTest;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 
 /*
+ * @test
  * @bug 6384418
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.Bug6384418Test
+ * @run testng/othervm javax.xml.transform.ptests.Bug6384418Test
  * @summary verify the transforming won't throw any exception
  */
-public class Bug6384418Test extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class Bug6384418Test {
 
     @Test
     public void test() throws Exception {
@@ -62,3 +67,5 @@
     }
 
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/DOMResultTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,20 +23,23 @@
 
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+
 import java.io.BufferedWriter;
 import java.io.FileWriter;
 import java.io.IOException;
+
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMResult;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.sax.SAXTransformerFactory;
 import javax.xml.transform.sax.TransformerHandler;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-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.NamedNodeMap;
@@ -50,7 +53,14 @@
  * DOM parse on test file to be compared with golden output file. No Exception
  * is expected.
  */
-public class DOMResultTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.DOMResultTest
+ * @run testng/othervm javax.xml.transform.ptests.DOMResultTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DOMResultTest {
     /**
      * Unit test for simple DOM parsing.
      * @throws Exception If any errors occur.
@@ -108,3 +118,5 @@
                 writeNodes(kids.item(i), bWriter);
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/ErrorListenerTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,23 +23,32 @@
 
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
 import java.io.File;
-import java.io.FilePermission;
+
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for ErrorListener interface
  */
-public class ErrorListenerTest extends JAXPBaseTest implements ErrorListener {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.ErrorListenerTest
+ * @run testng/othervm javax.xml.transform.ptests.ErrorListenerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class ErrorListenerTest implements ErrorListener {
     /**
      * Define ErrorListener's status.
      */
@@ -60,7 +69,6 @@
         try {
             TransformerFactory tfactory = TransformerFactory.newInstance();
             tfactory.setErrorListener (listener);
-            setPermissions(new FilePermission(XML_DIR + "invalid.xsl", "read"));
             tfactory.newTransformer(new StreamSource(
                                         new File(XML_DIR + "invalid.xsl")));
             fail("Expect TransformerConfigurationException here");
@@ -96,3 +104,5 @@
         this.status = ListenerStatus.FATAL;
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXSourceTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,18 +23,21 @@
 
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 
@@ -42,7 +45,14 @@
 /**
  * Unit test for SAXSource sourceToInputSource API.
  */
-public class SAXSourceTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.SAXSourceTest
+ * @run testng/othervm javax.xml.transform.ptests.SAXSourceTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXSourceTest {
     /**
      * Test style-sheet file name
      */
@@ -53,7 +63,7 @@
      *
      * @throws IOException reading file error.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void source2inputsource01() throws IOException {
         try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
             StreamSource streamSource = new StreamSource(fis);
@@ -68,7 +78,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void source2inputsource02() throws Exception {
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         dbf.setNamespaceAware(true);
@@ -83,7 +93,7 @@
      *
      * @throws IOException reading file error.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void source2inputsource03() throws IOException {
         String SYSTEM_ID = "file:///" + XML_DIR;
         try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
@@ -95,3 +105,5 @@
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/SAXTFactoryTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,27 +23,30 @@
 
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Result;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.sax.SAXTransformerFactory;
 import javax.xml.transform.sax.TemplatesHandler;
 import javax.xml.transform.sax.TransformerHandler;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-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;
@@ -56,7 +59,14 @@
  * Test newTransformerhandler() method which takes StreamSource as argument can
  * be set to XMLReader.
  */
-public class SAXTFactoryTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.SAXTFactoryTest
+ * @run testng/othervm javax.xml.transform.ptests.SAXTFactoryTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXTFactoryTest {
     /**
      * Test style-sheet file.
      */
@@ -421,3 +431,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/StreamResultTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,11 +22,16 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Properties;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -34,12 +39,10 @@
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.failUnexpected;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
@@ -48,7 +51,14 @@
  * Test a StreamResult using a file name that contains URL characters that need
  * to be encoded.
  */
-public class StreamResultTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.StreamResultTest
+ * @run testng/othervm javax.xml.transform.ptests.StreamResultTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class StreamResultTest {
     /**
      * Unit test for StreamResult.
      */
@@ -96,3 +106,5 @@
         });
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,20 +22,23 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNull;
+
 import java.io.File;
 import java.io.FileInputStream;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
@@ -44,7 +47,14 @@
 /**
  * Class containing the test cases for SAXParserFactory API
  */
-public class TfClearParamTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TfClearParamTest
+ * @run testng/othervm javax.xml.transform.ptests.TfClearParamTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TfClearParamTest {
     /**
      * Test style-sheet file name.
      */
@@ -128,7 +138,7 @@
      * @throws TransformerConfigurationException If for some reason the
      *         TransformerHandler can not be created.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear05() throws TransformerConfigurationException {
         Transformer transformer = TransformerFactory.newInstance().
                 newTransformer(new StreamSource(new File(XSL_FILE)));
@@ -143,7 +153,7 @@
      * @throws TransformerConfigurationException If for some reason the
      *         TransformerHandler can not be created.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear06() throws TransformerConfigurationException {
         Transformer transformer = TransformerFactory.newInstance().
                 newTransformer(new StreamSource(new File(XSL_FILE)));
@@ -157,7 +167,7 @@
      * the a name that set before. Value should be same as set one.
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear07() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
             SAXSource saxSource = new SAXSource();
@@ -174,7 +184,7 @@
      * the a name that wasn't set before. Null is expected.
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear08() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_FILE)) {
             SAXSource saxSource = new SAXSource();
@@ -192,7 +202,7 @@
      * the a name that set before. Value should be same as set one.
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear09() throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
 
@@ -213,7 +223,7 @@
      * the a name that wasn't set before. Null is expected.
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void clear10() throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
 
@@ -229,3 +239,5 @@
         assertNull(transformer.getParameter(LONG_PARAM_NAME));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,6 @@
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLEventWriter;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLOutputFactory;
@@ -58,10 +57,9 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
-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.xml.sax.Attributes;
@@ -71,10 +69,15 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformTest
  * @summary Tests for variable combination of Transformer.transform(Source, Result)
  */
 @Test(singleThreaded = true)
-public class TransformTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformTest {
 
     /*
      * Initialize the share objects.
@@ -381,3 +384,5 @@
     private Document xmlDoc;
 
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerExcpTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,32 +22,40 @@
  */
 package javax.xml.transform.ptests;
 
-import java.io.File;
-import java.io.FilePermission;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.fail;
+
+import java.io.File;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  *  Basic test for TransformerException specification.
  */
-public class TransformerExcpTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerExcpTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformerExcpTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerExcpTest {
     /**
      * Transform an unformatted style-sheet file. TransformerException is thrown.
      */
     @Test
     public void tfexception() {
         try {
-            setPermissions(new FilePermission(XML_DIR  + "-", "read"));
             // invalid.xsl has well-formedness error. Therefore transform throws
             // TransformerException
             StreamSource streamSource
@@ -63,8 +71,6 @@
             assertNotNull(e.getException());
             assertNull(e.getLocationAsString());
             assertEquals(e.getMessageAndLocation(),e.getMessage());
-        } finally {
-            setPermissions();
         }
     }
 
@@ -99,3 +105,5 @@
         assertNotNull(te.initCause(null));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,33 +22,45 @@
  */
 package javax.xml.transform.ptests;
 
-import java.io.*;
-
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-
 import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
 import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
-
-import javax.xml.transform.stream.*;
-
-import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import jaxp.library.JAXPDataProvider;
+
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
-import org.w3c.dom.*;
+import org.w3c.dom.Document;
 
 /**
  * Class containing the test cases for TransformerFactory API's
  * getAssociatedStyleSheet method and TransformerFactory.newInstance(factoryClassName , classLoader).
  */
-public class TransformerFactoryTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerFactoryTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformerFactoryTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerFactoryTest {
     /**
      * TransformerFactory implementation class name.
      */
@@ -129,3 +141,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,9 +22,15 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.util.Properties;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.ErrorListener;
@@ -33,13 +39,10 @@
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
@@ -47,7 +50,14 @@
 /**
  * Basic test cases for Transformer API
  */
-public class TransformerTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest
+ * @run testng/othervm javax.xml.transform.ptests.TransformerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerTest {
     /**
      * XSLT file serves every test method.
      */
@@ -58,7 +68,7 @@
      * @throws TransformerConfigurationException If for some reason the
      *         TransformerHandler can not be created.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer01() throws TransformerConfigurationException {
         TransformerFactory tfactory = TransformerFactory.newInstance();
         StreamSource streamSource = new StreamSource(
@@ -71,7 +81,7 @@
      * This tests if newTransformer(SAXSource) method returns Transformer.
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer02() throws Exception {
         try (FileInputStream fis = new FileInputStream(TEST_XSL)) {
             TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -86,7 +96,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer03() throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
 
@@ -105,7 +115,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer04() throws Exception {
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         dbf.setNamespaceAware(true);
@@ -125,7 +135,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer05() throws Exception {
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         dbf.setNamespaceAware(true);
@@ -150,7 +160,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void transformer06() throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
 
@@ -197,3 +207,5 @@
         System.out.println(" In fatal");
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest02.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,21 +22,24 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 
@@ -44,7 +47,14 @@
  * Here a transformer is created using DOMSource. Some specific output property
  * is set on transformer. Then transform(StreamSource, StreamResult) is tested.
  */
-public class TransformerTest02 extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest02
+ * @run testng/othervm javax.xml.transform.ptests.TransformerTest02
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerTest02 {
     /**
      * Unit test for transform(StreamSource, StreamResult).
      *
@@ -75,3 +85,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerTest03.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,22 +22,25 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.util.Properties;
+
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.GOLDEN_DIR;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
@@ -46,7 +49,14 @@
  * for transformer. Then transform(StreamSource, StreamResult) is used for
  * transformation. This tests the setOutputProperties() method.
  */
-public class TransformerTest03 extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.TransformerTest03
+ * @run testng/othervm javax.xml.transform.ptests.TransformerTest03
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class TransformerTest03 {
     /**
      * Test for Transformer.setOutputProperties method.
      *
@@ -84,3 +94,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/URIResolverTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,13 @@
  */
 package javax.xml.transform.ptests;
 
+import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
 import java.io.File;
 import java.io.FileInputStream;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Source;
@@ -31,13 +36,11 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.URIResolver;
 import javax.xml.transform.dom.DOMSource;
-import static javax.xml.transform.ptests.TransformerTestConst.XML_DIR;
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
-import jaxp.library.JAXPFileBaseTest;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
@@ -45,7 +48,14 @@
 /**
  * URIResolver should be invoked when transform happens.
  */
-public class URIResolverTest extends JAXPFileBaseTest implements URIResolver {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.URIResolverTest
+ * @run testng/othervm javax.xml.transform.ptests.URIResolverTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class URIResolverTest implements URIResolver {
     /**
      * System ID constant.
      */
@@ -115,7 +125,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver01() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)) {
             TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -134,7 +144,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver02() throws Exception {
         TransformerFactory tfactory = TransformerFactory.newInstance();
         URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -155,7 +165,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver03() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_INCLUDE_FILE)){
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -174,7 +184,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver04() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)) {
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -192,7 +202,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver05() throws Exception {
         URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
         TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -211,7 +221,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void resolver06() throws Exception {
         try (FileInputStream fis = new FileInputStream(XSL_IMPORT_FILE)){
             URIResolverTest resolver = new URIResolverTest(XSL_TEMP_FILE, SYSTEM_ID);
@@ -230,7 +240,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public static void docResolver01() throws Exception {
         try (FileInputStream fis = new FileInputStream(XML_DIR + "doctest.xsl")) {
             URIResolverTest resolver = new URIResolverTest("temp/colors.xml", SYSTEM_ID);
@@ -252,3 +262,5 @@
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/othervm/TFCErrorTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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,15 +22,27 @@
  */
 package javax.xml.transform.ptests.othervm;
 
-import javax.xml.transform.*;
-import jaxp.library.JAXPBaseTest;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import static org.testng.Assert.fail;
+
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Negative test for set invalid TransformerFactory property.
  */
-public class TFCErrorTest  extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.transform.ptests.othervm.TFCErrorTest
+ * @run testng/othervm javax.xml.transform.ptests.othervm.TFCErrorTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class TFCErrorTest {
     @Test(expectedExceptions = ClassNotFoundException.class)
     public void tfce01() throws Exception {
         try{
@@ -42,3 +54,5 @@
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/SchemaFactoryTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,7 @@
 
 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.xml.sax.ErrorHandler;
@@ -64,10 +65,15 @@
 import org.xml.sax.SAXParseException;
 
 /*
+ * @test
  * @bug 8080907
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.SchemaFactoryTest
+ * @run testng/othervm javax.xml.validation.ptests.SchemaFactoryTest
  * @summary Class containing the test cases for SchemaFactory
  */
 @Test(singleThreaded = true)
+@Listeners({jaxp.library.FilePolicy.class})
 public class SchemaFactoryTest {
 
     @BeforeClass
@@ -398,3 +404,4 @@
     private Document xsdDoc2;
     private byte[] xml;
 }
+
--- a/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/TypeInfoProviderTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,8 +39,7 @@
 import javax.xml.validation.TypeInfoProvider;
 import javax.xml.validation.ValidatorHandler;
 
-import jaxp.library.JAXPFileBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
@@ -49,9 +48,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.TypeInfoProviderTest
+ * @run testng/othervm javax.xml.validation.ptests.TypeInfoProviderTest
  * @summary test ValidatorHandler.getTypeInfoProvider()
  */
-public class TypeInfoProviderTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class TypeInfoProviderTest {
 
     private ValidatorHandler validatorHandler;
 
@@ -91,3 +95,4 @@
 
     }
 }
+
--- a/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorHandlerTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,7 @@
 import javax.xml.validation.ValidatorHandler;
 
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.ErrorHandler;
@@ -46,8 +47,13 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.ValidatorHandlerTest
+ * @run testng/othervm javax.xml.validation.ptests.ValidatorHandlerTest
  * @summary Class containing the test cases for ValidatorHandler API
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class ValidatorHandlerTest {
     @BeforeClass
     public void setup() throws SAXException {
@@ -142,3 +148,4 @@
     private Schema schema;
 
 }
+
--- a/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/validation/ptests/ValidatorTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,10 +45,9 @@
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
 
-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.xml.sax.ErrorHandler;
@@ -59,9 +58,14 @@
 import org.xml.sax.helpers.DefaultHandler;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.validation.ptests.ValidatorTest
+ * @run testng/othervm javax.xml.validation.ptests.ValidatorTest
  * @summary Class containing the test cases for Validator API
  */
-public class ValidatorTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class ValidatorTest {
 
     @BeforeClass
     public void setup() throws SAXException, IOException, ParserConfigurationException {
@@ -205,3 +209,4 @@
     private Document xmlDoc;
 
 }
+
--- a/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathExpressionTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,26 +23,28 @@
 
 package javax.xml.xpath.ptests;
 
-import java.io.FilePermission;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
 import static javax.xml.xpath.XPathConstants.BOOLEAN;
 import static javax.xml.xpath.XPathConstants.NODE;
 import static javax.xml.xpath.XPathConstants.NODESET;
 import static javax.xml.xpath.XPathConstants.NUMBER;
 import static javax.xml.xpath.XPathConstants.STRING;
+import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
+import static org.testng.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
-import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.Assert.assertEquals;
+
 import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -52,7 +54,14 @@
 /**
  * Class containing the test cases for XPathExpression API.
  */
-public class XPathExpressionTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathExpressionTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathExpressionTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XPathExpressionTest {
     /**
      * Document object for testing XML file.
      */
@@ -89,7 +98,6 @@
      */
     @BeforeTest
     public void setup() throws Exception {
-        setPermissions(new FilePermission(XML_PATH.toFile().toString(), "read"));
         document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
         xpath = XPathFactory.newInstance().newXPath();
     }
@@ -264,7 +272,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression15() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -287,7 +295,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPathExpression17() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(null).evaluate(new InputSource(is));
@@ -300,7 +308,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPathExpression18() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile("-*&").evaluate(new InputSource(is));
@@ -313,7 +321,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPathExpression19() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(" ").evaluate(new InputSource(is));
@@ -326,7 +334,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression20() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -351,7 +359,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPathExpression22() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(null).evaluate(new InputSource(is), STRING);
@@ -364,7 +372,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPathExpression23() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), null);
@@ -377,7 +385,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPathExpression24() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile("-*&").evaluate(new InputSource(is), STRING);
@@ -390,7 +398,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPathExpression25() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(" ").evaluate(new InputSource(is), STRING);
@@ -404,7 +412,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testCheckXPathExpression26() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.compile(EXPRESSION_NAME_A).evaluate(new InputSource(is), TEST_QNAME);
@@ -417,7 +425,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression27() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -431,7 +439,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression28() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_B).
@@ -445,7 +453,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression29() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.compile(EXPRESSION_NAME_A).
@@ -459,7 +467,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression30() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             Attr attr = (Attr) xpath.compile(EXPRESSION_NAME_A).
@@ -474,7 +482,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPathExpression31() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList) xpath.compile(EXPRESSION_NAME_A).
@@ -483,3 +491,5 @@
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFactoryTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,22 +24,29 @@
 package javax.xml.xpath.ptests;
 
 import static javax.xml.xpath.XPathConstants.DOM_OBJECT_MODEL;
+import static org.testng.Assert.assertNotNull;
 
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathFactoryConfigurationException;
 
 import jaxp.library.JAXPDataProvider;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertNotNull;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for XPathFactory API.
  */
-public class XPathFactoryTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathFactoryTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathFactoryTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class XPathFactoryTest {
     /**
      * Valid URL for creating a XPath factory.
      */
@@ -211,3 +218,5 @@
         assertNotNull(XPathFactory.newInstance(DOM_OBJECT_MODEL));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathFunctionResolverTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,18 +23,27 @@
 
 package javax.xml.xpath.ptests;
 
+import static org.testng.Assert.assertEquals;
+
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertEquals;
+
 import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 
 /**
  * Class containing the test cases for XPathFunctionResolver.
  */
-public class XPathFunctionResolverTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathFunctionResolverTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathFunctionResolverTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class XPathFunctionResolverTest {
     /**
      * A XPath for evaluation environment and expressions.
      */
@@ -73,3 +82,5 @@
         assertEquals(xpath.evaluate(null, "5"), "2");
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/javax/xml/xpath/ptests/XPathTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,30 +23,32 @@
 
 package javax.xml.xpath.ptests;
 
-import java.io.FilePermission;
+import static javax.xml.xpath.XPathConstants.BOOLEAN;
+import static javax.xml.xpath.XPathConstants.NODE;
+import static javax.xml.xpath.XPathConstants.NODESET;
+import static javax.xml.xpath.XPathConstants.NUMBER;
+import static javax.xml.xpath.XPathConstants.STRING;
+import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertNull;
+
 import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Iterator;
+
 import javax.xml.XMLConstants;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.xpath.XPath;
-import static javax.xml.xpath.XPathConstants.BOOLEAN;
-import static javax.xml.xpath.XPathConstants.NODE;
-import static javax.xml.xpath.XPathConstants.NODESET;
-import static javax.xml.xpath.XPathConstants.NUMBER;
-import static javax.xml.xpath.XPathConstants.STRING;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
-import static javax.xml.xpath.ptests.XPathTestConst.XML_DIR;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
+
 import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -56,7 +58,14 @@
 /**
  * Class containing the test cases for XPath API.
  */
-public class XPathTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true javax.xml.xpath.ptests.XPathTest
+ * @run testng/othervm javax.xml.xpath.ptests.XPathTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XPathTest {
     /**
      * Document object for testing XML file.
      */
@@ -93,7 +102,6 @@
      */
     @BeforeTest
     public void setup() throws Exception {
-        setPermissions(new FilePermission(XML_DIR + "-", "read"));
         document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(XML_PATH.toFile());
         xpath = XPathFactory.newInstance().newXPath();
     }
@@ -347,7 +355,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test (groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath22() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is)), "6");
@@ -371,7 +379,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPath24() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(null, new InputSource(is));
@@ -385,7 +393,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath25() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate("-*&", new InputSource(is));
@@ -398,7 +406,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath26() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(" ", new InputSource(is));
@@ -411,7 +419,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath27() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), STRING), "6");
@@ -435,7 +443,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPath29() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(null, new InputSource(is), STRING);
@@ -448,7 +456,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void testCheckXPath30() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), null);
@@ -461,7 +469,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath31() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate("-*&", new InputSource(is), STRING);
@@ -474,7 +482,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = XPathExpressionException.class)
+    @Test(expectedExceptions = XPathExpressionException.class)
     public void testCheckXPath32() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(" ", new InputSource(is), STRING);
@@ -488,7 +496,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = IllegalArgumentException.class)
+    @Test(expectedExceptions = IllegalArgumentException.class)
     public void testCheckXPath33() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is), TEST_QNAME);
@@ -501,7 +509,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath34() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
@@ -515,7 +523,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath35() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
@@ -529,7 +537,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath36() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
@@ -543,7 +551,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath37() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
@@ -557,7 +565,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath38() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
@@ -573,7 +581,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath52() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_B, new InputSource(is),
@@ -587,7 +595,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath53() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(xpath.evaluate(EXPRESSION_NAME_A, new InputSource(is),
@@ -601,7 +609,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath54() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             assertEquals(((Attr)xpath.evaluate(EXPRESSION_NAME_A,
@@ -615,7 +623,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void testCheckXPath55() throws Exception {
         try (InputStream is = Files.newInputStream(XML_PATH)) {
             NodeList nodeList = (NodeList)xpath.evaluate(EXPRESSION_NAME_A,
@@ -749,3 +757,5 @@
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AbstractCharacterDataTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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
@@ -31,8 +31,6 @@
 
 import javax.xml.parsers.ParserConfigurationException;
 
-import jaxp.library.JAXPFileBaseTest;
-
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 import org.w3c.dom.CharacterData;
@@ -42,7 +40,7 @@
 /*
  * @summary common test for the CharacterData Interface
  */
-public abstract class AbstractCharacterDataTest extends JAXPFileBaseTest {
+public abstract class AbstractCharacterDataTest {
     @DataProvider(name = "data-for-length")
     public Object[][] getDataForTestLength() {
         return new Object[][] {
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/AttrTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,8 @@
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
-import jaxp.library.JAXPFileBaseTest;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -38,9 +38,14 @@
 
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.AttrTest
+ * @run testng/othervm org.w3c.dom.ptests.AttrTest
  * @summary Test for the Attr Interface
  */
-public class AttrTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class AttrTest {
     /*
      * Verify getName method against both existing Attr and new Attr.
      */
@@ -146,3 +151,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/CommentTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,13 +28,19 @@
 
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.testng.annotations.Listeners;
 import org.w3c.dom.CharacterData;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/functional
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.CommentTest
+ * @run testng/othervm org.w3c.dom.ptests.CommentTest
  * @summary Test for Comment implementation returned by Document.createComment(String)
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class CommentTest extends AbstractCharacterDataTest {
     @Override
     protected CharacterData createCharacterData(String text) throws IOException, SAXException, ParserConfigurationException {
@@ -42,3 +48,4 @@
         return document.createComment(text);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,9 +31,9 @@
 import static org.w3c.dom.ptests.DOMTestUtil.DOMEXCEPTION_EXPECTED;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
 import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
-import jaxp.library.JAXPFileBaseTest;
 
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DOMException;
@@ -42,9 +42,14 @@
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DocumentTest
+ * @run testng/othervm org.w3c.dom.ptests.DocumentTest
  * @summary Test createAttributeNS, getElementsByTagNameNS and createElementNS method of Document
  */
-public class DocumentTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentTest {
 
     @DataProvider(name = "invalid-nsuri")
     public Object[][] getInvalidNamespaceURI() {
@@ -170,3 +175,4 @@
         doc.createElement("!nc$%^*(!");
     }
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DocumentTypeTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,17 +25,22 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
-import jaxp.library.JAXPFileBaseTest;
 
 import org.testng.Assert;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DocumentType;
 import org.w3c.dom.NamedNodeMap;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DocumentTypeTest
+ * @run testng/othervm org.w3c.dom.ptests.DocumentTypeTest
  * @summary Test DocumentType
  */
-public class DocumentTypeTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class DocumentTypeTest {
 
     /*
      * Test testGetEntities method, and verify the entity items.
@@ -87,3 +92,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/DomImplementationTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,18 +27,22 @@
 
 import javax.xml.parsers.ParserConfigurationException;
 
-import jaxp.library.JAXPBaseTest;
-
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentType;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.DomImplementationTest
+ * @run testng/othervm org.w3c.dom.ptests.DomImplementationTest
  * @summary Test DomImplementation API
  */
-public class DomImplementationTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class DomImplementationTest {
     /*
      * Test createDocument method with a namespace uri, qualified name and null
      * for the doctype
@@ -125,3 +129,4 @@
         assertEquals(documentType.getName(), name);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/ElementTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,9 +37,8 @@
 
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import jaxp.library.JAXPFileBaseTest;
-
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DOMException;
@@ -50,9 +49,14 @@
 import org.xml.sax.InputSource;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.ElementTest
+ * @run testng/othervm org.w3c.dom.ptests.ElementTest
  * @summary Test for the methods of Element Interface
  */
-public class ElementTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class ElementTest {
     @Test
     public void testGetAttributeNS() throws Exception {
         Document document = createDOMWithNS("ElementSample01.xml");
@@ -251,3 +255,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/EntityChildTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,17 +30,21 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import jaxp.library.JAXPFileBaseTest;
-
+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
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.EntityChildTest
+ * @run testng/othervm org.w3c.dom.ptests.EntityChildTest
  * @summary Test DOM Parser: parsing an xml file that contains external entities.
  */
-public class EntityChildTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class EntityChildTest {
 
     @Test
     public void test() throws Exception {
@@ -57,3 +61,4 @@
         assertEquals(nl.getLength(), 3);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NamedNodeMapTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
-import jaxp.library.JAXPFileBaseTest;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
@@ -35,9 +35,14 @@
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NamedNodeMapTest
+ * @run testng/othervm org.w3c.dom.ptests.NamedNodeMapTest
  * @summary Test for the methods of NamedNodeMap Interface
  */
-public class NamedNodeMapTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NamedNodeMapTest {
     /*
      * Test setNamedItemNS method with a node having the same namespaceURI and
      * qualified name as an existing one, and then test with a non-existing node.
@@ -116,3 +121,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeListTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,20 +24,25 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOM;
-import jaxp.library.JAXPFileBaseTest;
 
 import org.testng.annotations.DataProvider;
+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
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NodeListTest
+ * @run testng/othervm org.w3c.dom.ptests.NodeListTest
  * @summary Verifies a bug found in jaxp1.0.1 and 1.1FCS. After going out of
  * bound, the last element of a NodeList returns null. The bug has been fixed
  * in jaxp 1.1.1 build.
  */
-public class NodeListTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NodeListTest {
 
     @DataProvider(name = "xml")
     public Object[][] getTestData() {
@@ -59,3 +64,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NodeTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 package org.w3c.dom.ptests;
 
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.tryRunWithTmpPermission;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotEquals;
@@ -33,6 +34,7 @@
 import static org.w3c.dom.ptests.DOMTestUtil.createNewDocument;
 
 import java.io.File;
+import java.util.PropertyPermission;
 
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
@@ -41,9 +43,8 @@
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
-import jaxp.library.JAXPFileBaseTest;
-
 import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
@@ -53,9 +54,14 @@
 import org.w3c.dom.NodeList;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NodeTest
+ * @run testng/othervm org.w3c.dom.ptests.NodeTest
  * @summary Test Node interface
  */
-public class NodeTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NodeTest {
     @DataProvider(name = "feature-supported")
     public Object[][] getFeatureSupportedList() throws Exception {
         Document document = createDOMWithNS("Node01.xml");
@@ -153,7 +159,7 @@
 
         String outputfile = "InsertBefore.out";
         String goldfile = GOLDEN_DIR + "InsertBeforeGF.out";
-        outputXml(document, outputfile);
+        tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
         assertTrue(compareWithGold(goldfile, outputfile));
     }
 
@@ -171,7 +177,7 @@
 
         String outputfile = "ReplaceChild3.out";
         String goldfile = GOLDEN_DIR + "ReplaceChild3GF.out";
-        outputXml(document, outputfile);
+        tryRunWithTmpPermission(() -> outputXml(document, outputfile), new PropertyPermission("user.dir", "read"));
         assertTrue(compareWithGold(goldfile, outputfile));
     }
 
@@ -205,3 +211,4 @@
         transformer.transform(domSource, streamResult);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,8 +29,7 @@
 
 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.NamedNodeMap;
@@ -38,9 +37,14 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.NotationTest
+ * @run testng/othervm org.w3c.dom.ptests.NotationTest
  * @summary Test for Notation interface
  */
-public class NotationTest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class NotationTest {
     /*
      * Test getSystemId method.
      */
@@ -70,3 +74,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/PITest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,16 +24,21 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.w3c.dom.ptests.DOMTestUtil.createDOMWithNS;
-import jaxp.library.JAXPFileBaseTest;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.ProcessingInstruction;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.PITest
+ * @run testng/othervm org.w3c.dom.ptests.PITest
  * @summary Test for the methods of Processing Instruction
  */
-public class PITest extends JAXPFileBaseTest {
+@Listeners({jaxp.library.FilePolicy.class})
+public class PITest {
     /*
      * Test getData, setData and getTarget methods
      */
@@ -49,3 +54,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TextTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.CharacterData;
 import org.w3c.dom.Document;
@@ -39,8 +40,13 @@
 import org.xml.sax.SAXException;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/functional
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.TextTest
+ * @run testng/othervm org.w3c.dom.ptests.TextTest
  * @summary Test for Text implementation returned by Document.createTextNode(String)
  */
+@Listeners({jaxp.library.FilePolicy.class})
 public class TextTest extends AbstractCharacterDataTest {
     /*
      * Verify splitText method works as the spec.
@@ -68,3 +74,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/w3c/dom/ptests/TypeInfoTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,8 +30,7 @@
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import jaxp.library.JAXPBaseTest;
-
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -39,9 +38,14 @@
 import org.xml.sax.InputSource;
 
 /*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.w3c.dom.ptests.TypeInfoTest
+ * @run testng/othervm org.w3c.dom.ptests.TypeInfoTest
  * @summary Test getTypeName and getTypeNamespace methods of TypeInfo interface
  */
-public class TypeInfoTest extends JAXPBaseTest {
+@Listeners({jaxp.library.BasePolicy.class})
+public class TypeInfoTest {
     /*
      * Get the TypeInfo of the root element, and verify it.
      */
@@ -136,3 +140,4 @@
 
 
 }
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttrImplTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,16 +22,24 @@
  */
 package org.xml.sax.ptests;
 
-import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.helpers.AttributesImpl;
 
 /**
  * Class containing the test cases for AttributesImpl API.
  */
-public class AttrImplTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttrImplTest
+ * @run testng/othervm org.xml.sax.ptests.AttrImplTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class AttrImplTest {
     private static final String CAR_URI = "http://www.cars.com/xml";
 
     private static final String CAR_LOCALNAME = "part";
@@ -194,3 +202,5 @@
         attr.removeAttribute(1);
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesNSTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,17 +22,20 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.File;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
+import java.io.File;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
 /**
  * This tests the Attributes interface. Here the startElement() callback of
  * ContentHandler has Attributes as one of its arguments. Attributes
@@ -40,7 +43,14 @@
  * of Attributes interfaces are tested. This program uses Namespace processing
  * with namespaces in XML file. This program does not use Validation
  */
-public class AttributesNSTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttributesNSTest
+ * @run testng/othervm org.xml.sax.ptests.AttributesNSTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AttributesNSTest {
     /**
      * Test for Attribute Interface's setter/getter.
      *
@@ -64,3 +74,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/AttributesTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,17 +22,20 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.File;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
+import java.io.File;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
 /**
  * This tests the Attributes interface. Here the startElement() callback of
  * ContentHandler has Attributes as one of its arguments. Attributes
@@ -41,7 +44,14 @@
  * This program uses Namespace processing without any namepsaces in xml file.
  * This program uses Validation
  */
-public class AttributesTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.AttributesTest
+ * @run testng/othervm org.xml.sax.ptests.AttributesTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class AttributesTest {
     /**
      * Unit test for Attributes interface. Prints all attributes into output
      * file. Check it with golden file.
@@ -66,3 +76,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ContentHandlerTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,15 +22,20 @@
  */
 package org.xml.sax.ptests;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
 import java.io.BufferedWriter;
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
+
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
@@ -38,15 +43,20 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Class registers a content event handler to XMLReader. Content event handler
  * transverses XML and print all visited node  when XMLreader parses XML. Test
  * verifies output is same as the golden file.
  */
-public class ContentHandlerTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ContentHandlerTest
+ * @run testng/othervm org.xml.sax.ptests.ContentHandlerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class ContentHandlerTest {
     /**
      * Content event handler visit all nodes to print to output file.
      *
@@ -254,3 +264,5 @@
             bWriter.close();
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/DefaultHandlerTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,30 +22,40 @@
  */
 package org.xml.sax.ptests;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.helpers.DefaultHandler;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * XMLReader parse XML with default handler that transverses XML and
  * print all visited node. Test verifies output is same as the golden file.
  */
-public class DefaultHandlerTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.DefaultHandlerTest
+ * @run testng/othervm org.xml.sax.ptests.DefaultHandlerTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class DefaultHandlerTest {
     /**
      * Test default handler that transverses XML and  print all visited node.
      *
@@ -262,3 +272,5 @@
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/EHFatalTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,31 +22,41 @@
  */
 package org.xml.sax.ptests;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
 import java.io.BufferedWriter;
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * ErrorHandler unit test. Set a ErrorHandle to XMLReader. Capture fatal error
  * events in ErrorHandler.
  */
-public class EHFatalTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.EHFatalTest
+ * @run testng/othervm org.xml.sax.ptests.EHFatalTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class EHFatalTest {
     /**
      * Error Handler to capture all error events to output file. Verifies the
      * output file is same as golden file.
@@ -125,3 +135,5 @@
         bWriter.close();
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSSupportTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,17 +22,26 @@
  */
 package org.xml.sax.ptests;
 
-import java.util.Enumeration;
-import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNull;
+
+import java.util.Enumeration;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.helpers.NamespaceSupport;
 
 /**
  * Unit test cases for NamespaceSupport API
  */
-public class NSSupportTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.NSSupportTest
+ * @run testng/othervm org.xml.sax.ptests.NSSupportTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class NSSupportTest {
     /**
      * Empty prefix name.
      */
@@ -122,3 +131,5 @@
         assertNull(support.getURI(DC_PREFIX));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/NSTableTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,11 +22,13 @@
  */
 package org.xml.sax.ptests;
 
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.XMLReader;
 
@@ -34,7 +36,14 @@
  * Class containing the test cases for Namespace Table defined at
  * http://www.megginson.com/SAX/Java/namespaces.html
  */
-public class NSTableTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.NSTableTest
+ * @run testng/othervm org.xml.sax.ptests.NSTableTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class NSTableTest {
     private static final String NAMESPACES =
                         "http://xml.org/sax/features/namespaces";
     private static final String NAMESPACE_PREFIXES =
@@ -159,3 +168,5 @@
         assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ParserAdapterTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,12 +22,16 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
@@ -37,14 +41,20 @@
 import org.xml.sax.helpers.ParserAdapter;
 import org.xml.sax.helpers.XMLFilterImpl;
 import org.xml.sax.helpers.XMLReaderAdapter;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 
 /**
  * Unit test cases for ParserAdapter API. By default the only features recognized
  * are namespaces and namespace-prefixes.
  */
-public class ParserAdapterTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ParserAdapterTest
+ * @run testng/othervm org.xml.sax.ptests.ParserAdapterTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class ParserAdapterTest {
     /**
      * namespaces feature name.
      */
@@ -234,7 +244,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class)
+    @Test(expectedExceptions = SAXException.class)
     public void parse02() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
             InputSource is = new InputSource(fis);
@@ -247,7 +257,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void parse03() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "correct.xml")) {
             InputSource is = new InputSource(fis);
@@ -255,3 +265,5 @@
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/ResolverTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,28 +22,45 @@
  */
 package org.xml.sax.ptests;
 
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
 import java.io.BufferedWriter;
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
 import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Entity resolver should be invoked in XML parse. This test verifies parsing
  * process by checking the output with golden file.
  */
-public class ResolverTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.ResolverTest
+ * @run testng/othervm org.xml.sax.ptests.ResolverTest
+ */
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
+public class ResolverTest {
     /**
      * Unit test for entityResolver setter.
      *
@@ -54,6 +71,11 @@
         String goldFile = GOLDEN_DIR + "EntityResolverGF.out";
         String xmlFile = XML_DIR + "publish.xml";
 
+        Files.copy(Paths.get(XML_DIR + "publishers.dtd"),
+                Paths.get(USER_DIR + "publishers.dtd"), REPLACE_EXISTING);
+        Files.copy(Paths.get(XML_DIR + "familytree.dtd"),
+                Paths.get(USER_DIR + "familytree.dtd"), REPLACE_EXISTING);
+
         try(FileInputStream instream = new FileInputStream(xmlFile);
                 MyEntityResolver eResolver = new MyEntityResolver(outputFile)) {
             SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
@@ -97,7 +119,7 @@
     @Override
     public InputSource resolveEntity(String publicid, String systemid)
             throws SAXException, IOException {
-        String str = "In resolveEntity.." + " " + publicid + " " + systemid;
+        String str = "In resolveEntity.." + " " + publicid + " " + getFileName(systemid);
         bWriter.write( str, 0,str.length());
         bWriter.newLine();
         return super.resolveEntity(publicid, systemid);
@@ -112,4 +134,14 @@
         bWriter.flush();
         bWriter.close();
     }
+
+    private String getFileName(String systemid) {
+        try {
+            return Paths.get(new URI(systemid)).getFileName().toString();
+        } catch (URISyntaxException e) {
+            throw new RuntimeException(e);
+        }
+    }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/SAXParserNSTableTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,21 +22,31 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.File;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
-import org.testng.annotations.Test;
 import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
 import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
+import java.io.File;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
 /**
  * This class contains the testcases to test SAXParser with regard to
  * Namespace Table defined at http://www.megginson.com/SAX/Java/namespaces.html
  */
-public class SAXParserNSTableTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.SAXParserNSTableTest
+ * @run testng/othervm org.xml.sax.ptests.SAXParserNSTableTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class SAXParserNSTableTest {
     /**
      * namespace processing is enabled. namespace-prefix is also is enabled.
      * So it is a True-True combination.
@@ -97,3 +107,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterCBTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,15 +22,21 @@
  */
 package org.xml.sax.ptests;
 
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
 import java.io.BufferedWriter;
 import java.io.FileInputStream;
 import java.io.FileWriter;
 import java.io.IOException;
+
 import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
-import static jaxp.library.JAXPTestUtilities.USER_DIR;
-import static jaxp.library.JAXPTestUtilities.compareWithGold;
-import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
 import org.xml.sax.Locator;
@@ -38,14 +44,20 @@
 import org.xml.sax.SAXParseException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Set parent of XMLFilter to XMLReader. Parsing on XML file will invoke XMLFilter
  * to write to output file. Test verifies output is same as the golden file.
  */
-public class XMLFilterCBTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLFilterCBTest
+ * @run testng/othervm org.xml.sax.ptests.XMLFilterCBTest
+ */
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLFilterCBTest {
     /**
      * Test XMLFilter working with XML reader.
      *
@@ -273,3 +285,5 @@
             bWriter.close();
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLFilterTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,23 +22,33 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Unit test for XMLFilter.
  */
-public class XMLFilterTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLFilterTest
+ * @run testng/othervm org.xml.sax.ptests.XMLFilterTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLFilterTest {
     /**
      * name spaces constant.
      */
@@ -217,7 +227,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void parse02() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
             new XMLFilterImpl().parse(new InputSource(fis));
@@ -229,10 +239,12 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = NullPointerException.class)
+    @Test(expectedExceptions = NullPointerException.class)
     public void parse03() throws Exception {
         try(FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) {
             new XMLFilterImpl().parse(new InputSource(fis));
         }
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderAdapterTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,24 +22,33 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.FileInputStream;
-import java.io.FilePermission;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPBaseTest;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.HandlerBase;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLReaderAdapter;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Class containing the test cases for XMLReaderAdapter API
  */
-public class XMLReaderAdapterTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderAdapterTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderAdapterTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLReaderAdapterTest {
     /**
      * http://xml.org/sax/features/namespace-prefixes property name.
      */
@@ -92,7 +101,6 @@
      */
     @Test
     public void parse01() throws Exception {
-        setPermissions(new FilePermission(XML_DIR + "/-", "read"));
         try (FileInputStream fis = new FileInputStream(XML_DIR + "namespace1.xml")) {
             XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
             if (!xmlReader.getFeature(NM_PREFIXES_PROPERTY)) {
@@ -102,6 +110,7 @@
             xmlRA.setDocumentHandler(new HandlerBase());
             xmlRA.parse(new InputSource(fis));
         }
-        setPermissions();
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderFactoryTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,11 @@
  */
 package org.xml.sax.ptests;
 
-import jaxp.library.JAXPBaseTest;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
+
 import static org.testng.Assert.assertNotNull;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.XMLReaderFactory;
@@ -31,7 +34,14 @@
 /**
  * Unit test for XMLReaderFactory.createXMLReader API.
  */
-public class XMLReaderFactoryTest extends JAXPBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderFactoryTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderFactoryTest
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class XMLReaderFactoryTest {
     /**
      * No exception expected when create XMLReader by default.
      * @throws org.xml.sax.SAXException when xml reader creation failed.
@@ -66,3 +76,5 @@
         XMLReaderFactory.createXMLReader("org.apache.crimson.parser.ABCD");
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderNSTableTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,23 +22,35 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileBaseTest;
 import static jaxp.library.JAXPTestUtilities.USER_DIR;
 import static jaxp.library.JAXPTestUtilities.compareWithGold;
 import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
-import static org.xml.sax.ptests.SAXTestConst.GOLDEN_DIR;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /** This class contains the testcases to test XMLReader with regard to
   * Namespace Table defined at
   * http://www.megginson.com/SAX/Java/namespaces.html
   */
-public class XMLReaderNSTableTest extends JAXPFileBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderNSTableTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderNSTableTest
+ */
+@Test
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLReaderNSTableTest {
     /**
      * XML file that used to be parsed.
      */
@@ -109,7 +121,7 @@
         String goldFile = GOLDEN_DIR + "NSTableFTGF.out";
 
         SAXParserFactory spf = SAXParserFactory.newInstance();
-        spf.setNamespaceAware(true);
+        //NamespaceAware is false by default, so don't need to set here
         XMLReader xmlReader = spf.newSAXParser().getXMLReader();
         try (FileInputStream fis = new FileInputStream(xmlFile);
             MyNSContentHandler handler = new MyNSContentHandler(outputFile)) {
@@ -119,3 +131,5 @@
         assertTrue(compareWithGold(goldFile, outputFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/ptests/XMLReaderTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,14 +22,18 @@
  */
 package org.xml.sax.ptests;
 
-import java.io.FileInputStream;
-import javax.xml.parsers.SAXParserFactory;
-import jaxp.library.JAXPFileReadOnlyBaseTest;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
+import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Listeners;
 import org.testng.annotations.Test;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -39,12 +43,18 @@
 import org.xml.sax.ext.DeclHandler;
 import org.xml.sax.ext.LexicalHandler;
 import org.xml.sax.helpers.XMLFilterImpl;
-import static org.xml.sax.ptests.SAXTestConst.XML_DIR;
 
 /**
  * Class containing the test cases for SAXParser API
  */
-public class XMLReaderTest extends JAXPFileReadOnlyBaseTest {
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs
+ * @run testng/othervm -DrunSecMngr=true org.xml.sax.ptests.XMLReaderTest
+ * @run testng/othervm org.xml.sax.ptests.XMLReaderTest
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class XMLReaderTest {
 
     /**
      * XML namespaces.
@@ -434,7 +444,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"}, expectedExceptions = SAXException.class)
+    @Test(expectedExceptions = SAXException.class)
     public void parse02() throws Exception {
         try (FileInputStream fis = new FileInputStream(XML_DIR + "invalid.xml")) {
             SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -448,7 +458,7 @@
      *
      * @throws Exception If any errors occur.
      */
-    @Test(groups = {"readLocalFiles"})
+    @Test
     public void parse03() throws Exception {
         try (FileInputStream fis = new FileInputStream(XML_DIR + "correct2.xml")) {
             SAXParserFactory spf = SAXParserFactory.newInstance();
@@ -661,3 +671,5 @@
     public void internalEntityDecl(String name, String value) {
     }
 }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/familytree.dtd	Thu Aug 11 10:38:13 2016 -0700
@@ -0,0 +1,1 @@
+<familytree>purplelustrous</familytree>
--- a/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/EntityResolverGF.out	Thu Aug 11 10:38:13 2016 -0700
@@ -1,2 +1,2 @@
-In resolveEntity.. -//mkrishna mohan//DTD//music pub//EN/ http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/publishers.dtd
-In resolveEntity.. null http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/familytree.dtd
+In resolveEntity.. -//mkrishna mohan//DTD//music pub//EN/ publishers.dtd
+In resolveEntity.. null familytree.dtd
--- a/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/out/NSTableFTGF.out	Thu Aug 11 10:38:13 2016 -0700
@@ -1,109 +1,59 @@
 setDocumentLocator...
 startDocument...
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <html> Number of Attributes: <2> Line# <3>
 characters...length is:3
 <
   >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <head> Number of Attributes: <0> Line# <4>
 characters...length is:5
 <
     >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <title> Number of Attributes: <0> Line# <5>
 characters...length is:10
 <Typography>
 endElement...
 namespaceURI: <> localName: <> qName: <title>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 characters...length is:3
 <
   >
 endElement...
 namespaceURI: <> localName: <> qName: <head>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 characters...length is:4
 <
 
   >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <body> Number of Attributes: <0> Line# <8>
 characters...length is:5
 <
     >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <p> 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: <p>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 characters...length is:5
 <
     >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <b:title> Number of Attributes: <1> Line# <10>
 characters...length is:18
 <Digital Typography>
 endElement...
 namespaceURI: <> localName: <> qName: <b:title>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
-characters...length is:1
-< >
 characters...length is:5
 <
     >
-startPrefixMapping...
-prefix: <xml> uri: <http://www.w3.org/XML/1998/namespace>
-startPrefixMapping...
-prefix: <xmlns> uri: <http://www.w3.org/2000/xmlns/>
 startElement...
 namespaceURI: <> localName: <> qName: <b:author> Number of Attributes: <0> Line# <11>
 characters...length is:12
 <Donald Knuth>
 endElement...
 namespaceURI: <> localName: <> qName: <b:author>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 characters...length is:5
 <
     >
@@ -113,18 +63,10 @@
   >
 endElement...
 namespaceURI: <> localName: <> qName: <body>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 characters...length is:2
 <
 
 >
 endElement...
 namespaceURI: <> localName: <> qName: <html>
-endPrefixMapping...
-prefix: <xml>
-endPrefixMapping...
-prefix: <xmlns>
 endDocument...
--- a/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publish.xml	Thu Aug 11 10:38:13 2016 -0700
@@ -1,6 +1,5 @@
 <?xml version="1.0" standalone="no"?>
-<!DOCTYPE document PUBLIC "-//mkrishna mohan//DTD//music pub//EN/"
-		"http://sc11152338.us.oracle.com:8080/xmlsqe/jaxp/web/testfiles/JAXPREP/publishers.dtd">
+<!DOCTYPE document PUBLIC "-//mkrishna mohan//DTD//music pub//EN/" "publishers.dtd">
 <document>
 	Publishers of the Music of New York Women Composers
 	<title>The Publishers </title>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/functional/org/xml/sax/xmlfiles/publishers.dtd	Thu Aug 11 10:38:13 2016 -0700
@@ -0,0 +1,16 @@
+<!ELEMENT document ANY>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT publisher_list (publisher*)>
+<!ELEMENT publisher (name, email?, homepage?, address?, voice?, fax?, dtdname?)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT email (#PCDATA)>
+<!ELEMENT homepage (#PCDATA)>
+<!ELEMENT address (street+, city, state, zip, country?)>
+<!ELEMENT street (#PCDATA)>
+<!ELEMENT city (#PCDATA)>
+<!ELEMENT state (#PCDATA)>
+<!ELEMENT zip (#PCDATA)>
+<!ELEMENT country (#PCDATA)>
+<!ELEMENT voice (#PCDATA)>
+<!ELEMENT fax (#PCDATA)>
+<!ENTITY  familytree SYSTEM "familytree.dtd">
--- a/test/javax/xml/jaxp/functional/test/astro/AstroTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/astro/AstroTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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 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 @@
  * 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 @@
         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 @@
         }
     }
 }
+
--- a/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/astro/DocumentLSTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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.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.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 @@
         return dbf.newDocumentBuilder();
     }
 }
+
--- a/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/astro/NamespaceContextTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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 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 @@
         assertEquals(QName.valueOf(qname.toString()), qname);
     }
 }
+
--- a/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/astro/SAX201Test.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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 @@
 
 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 @@
         reader.setDTDHandler(null); // SAX 2.0.1 allows
     }
 }
+
--- a/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/astro/SchemaValidationTest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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.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 @@
         return spf.newSAXParser();
     }
 }
+
--- a/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/astro/XPathAPITest.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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.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 @@
         return new InputSource(filenameToURL(ASTROCAT));
     }
 }
+
--- a/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/auctionportal/AuctionController.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -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.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.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 @@
      *
      * @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 @@
      *
      * @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 @@
      *
      * @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 @@
      * @throws Exception If any errors occur.
      * @see <a href="content/movies.xml">movies.xml</a>
      */
-    @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 @@
      * @throws Exception If any errors occur.
      * @see <a href="content/userDetails.xsd">userDetails.xsd</a>
      */
-    @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 @@
      * @see <a href="content/coins.xsd">coins.xsd</a>
      * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a>
      */
-    @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 @@
      * @see <a href="content/coinsImportMe.xsd">coinsImportMe.xsd</a>
      */
 
-    @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 @@
      *
      * @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 @@
      *
      * @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 @@
         assertTrue(roletypeInfo.getTypeNamespace().equals(PORTAL_ACCOUNT_NS));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/auctionportal/AuctionItemRepository.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,18 +22,26 @@
  */
 package test.auctionportal;
 
+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 test.auctionportal.HiBidConstants.SP_ENTITY_EXPANSION_LIMIT;
 import static test.auctionportal.HiBidConstants.SP_MAX_OCCUR_LIMIT;
-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.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.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 @@
         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 @@
 
         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 @@
         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 @@
         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 @@
         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 @@
         assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/auctionportal/UserController.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,20 +22,26 @@
  */
 package test.auctionportal;
 
+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 org.testng.Assert.assertFalse;
+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.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 @@
      *
      * @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 @@
         assertTrue(compareDocumentWithGold(goldFile, resultFile));
     }
 }
+
+
--- a/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/gaptest/Bug4511326.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,16 +29,19 @@
 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 = "<xsl:stylesheet version='2.0' "
                                + "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"
@@ -61,3 +64,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/gaptest/Bug4512806.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,15 +34,19 @@
 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 @@
 
 
 }
+
--- a/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/gaptest/Bug4515047.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,16 +31,19 @@
 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 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/gaptest/Bug4515660.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,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.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 @@
 
     @AfterClass
     public void clearSaxDrier() {
-        setSystemProperty("org.xml.sax.driver", null);
+        clearSystemProperty("org.xml.sax.driver");
     }
 
     @Test
@@ -121,3 +128,4 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/gaptest/Bug4693341.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,24 +42,28 @@
 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 @@
         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 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/gaptest/Bug4848653.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,7 @@
 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.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 @@
     }
 
 }
+
--- a/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/functional/test/gaptest/Bug4858685.java	Thu Aug 11 10:38:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,19 +37,22 @@
 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 @@
 
     }
 }
+
--- a/test/javax/xml/jaxp/internaltest/TEST.properties	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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
-
--- a/test/javax/xml/jaxp/internaltest/javax/xml/parsers/bug8003147/Bug8003147Test.java	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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<Integer> list) {
-    }
-}
--- a/test/javax/xml/jaxp/internaltest/javax/xml/transform/bug6551616/Bug6551616.java	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +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.xalan.internal.xsltc.trax
- * @bug 6551616
- * @summary Test SAX2StAXEventWriter.
- */
-
-import java.io.InputStream;
-import java.io.StringBufferInputStream;
-
-import javax.xml.stream.XMLEventWriter;
-import javax.xml.stream.XMLOutputFactory;
-
-import org.testng.annotations.Test;
-
-import com.sun.org.apache.xalan.internal.xsltc.trax.SAX2StAXEventWriter;
-
-public class Bug6551616 {
-    String _cache = "";
-
-
-    @Test
-    public void test() throws Exception {
-        final String XML = "" + "<?xml version='1.0'?>" + "<doc xmlns:foo='http://example.com/foo/' xml:lang='us-en'><p>Test</p></doc>";
-
-        javax.xml.parsers.SAXParserFactory saxFactory = javax.xml.parsers.SAXParserFactory.newInstance();
-
-        javax.xml.parsers.SAXParser parser = saxFactory.newSAXParser();
-
-        XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
-        XMLEventWriter writer = outFactory.createXMLEventWriter(System.out);
-
-        SAX2StAXEventWriter handler = new SAX2StAXEventWriter(writer);
-
-        InputStream is = new StringBufferInputStream(XML);
-
-        parser.parse(is, handler);
-
-        // if it doesn't blow up, it succeeded.
-    }
-}
--- a/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/CLITest.java	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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.xml.internal.utils
- * @summary Test internal transform CLI.
- */
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-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(), };
-            ProcessXSLT.main(args);
-        } catch (Exception e) {
-            Assert.fail(e.getMessage());
-        }
-    }
-}
--- a/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/ProcessXSLT.java	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,913 +0,0 @@
-/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id: Process.java,v 1.2.4.2 2005/09/15 18:21:57 jeffsuttor Exp $
- */
-
-// This file is a copied and modified version of
-// com/sun/org/apache/xalan/internal/xslt/Process.java
-// which has been modified to only use public exported APIs.
-// The only adherence is with
-// com.sun.org.apache.xml.internal.utils.DefaultErrorHandler
-// which we try to instantiate using reflection, as that class
-// can do a better job at reporting error location.
-// We however don't have a hard dependency on it. We will use
-// our own ErrorHandler if the default one is not accessible.
-//
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.io.StringReader;
-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.OutputKeys;
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.sax.SAXSource;
-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;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * The main() method handles the Xalan command-line interface.
- */
-public class ProcessXSLT
-{
-
-    /**
-     * Prints argument options.
-     *
-     */
-    protected static void printArgOptions() {
-        System.out.println("xslproc options: ");
-        System.out.println("\n\t\t\t" + "-Common Options-" + "\n");
-        System.out.println("   [-XSLTC (use XSLTC for transformation)]");  //"    [-XSLTC (use XSLTC for transformation)]
-        System.out.println("   [-IN inputXMLURL]");  //"    [-IN inputXMLURL]");
-        System.out.println("   [-XSL XSLTransformationURL]");  //"   [-XSL XSLTransformationURL]");
-        System.out.println("   [-OUT outputFileName]");  //"   [-OUT outputFileName]");
-
-        System.out.println("   [-E (Do not expand entity refs)]");  //"   [-V (Version info)]");
-
-        System.out.println("   [-EDUMP {optional filename} (Do stackdump on error.)]");  //"   [-EDUMP {optional filename} (Do stackdump on error.)]");
-        System.out.println("   [-XML (Use XML formatter and add XML header.)]");  //"   [-XML (Use XML formatter and add XML header.)]");
-        System.out.println("   [-TEXT (Use simple Text formatter.)]");  //"   [-TEXT (Use simple Text formatter.)]");
-        System.out.println("   [-HTML (Use HTML formatter.)]");  //"   [-HTML (Use HTML formatter.)]");
-        System.out.println( "   [-PARAM name expression (Set a stylesheet parameter)]");  //"   [-PARAM name expression (Set a stylesheet parameter)]");
-
-        System.out.println("   [-MEDIA mediaType (use media attribute to find stylesheet associated with a document.)]");
-        System.out.println("   [-FLAVOR flavorName (Explicitly use s2s=SAX or d2d=DOM to do transform.)] ");
-        System.out.println("   [-DIAG (Print overall milliseconds transform took.)]");
-        System.out.println("   [-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]");  //"   [-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]");
-        System.out.println("   [-ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities)]");  //"   [-ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities)]");
-        waitForReturnKey();
-        System.out.println("   [-CONTENTHANDLER full class name (ContentHandler to be used to serialize output)]");  //"   [-CONTENTHANDLER full class name (ContentHandler to be used to serialize output)]");
-        System.out.println("   [-SECURE (set the secure processing feature to true.)]"); //"   [-SECURE (set the secure processing feature to true)]");
-
-
-        System.out.println("\n\t\t\t"+  "-Options for XSLTC-" + "\n");
-        System.out.println("   [-XO [transletName] (assign the name to the generated translet)]");
-        waitForReturnKey();
-        System.out.println("   [-XD destinationDirectory (specify a destination directory for translet)]");
-        System.out.println("   [-XJ jarfile (packages translet classes into a jar file of name <jarfile>)]");
-        System.out.println("   [-XP package (specifies a package name prefix for all generated translet classes)]");
-        System.out.println("   [-XN (enables template inlining)]");
-        System.out.println("   [-XX (turns on additional debugging message output)]");
-        System.out.println("   [-XT (use translet to transform if possible)]");
-    }
-
-  /**
-   * Command line interface to transform an XML document according to
-   * the instructions found in an XSL stylesheet.
-   * <p>The Process class provides basic functionality for
-   * performing transformations from the command line.  To see a
-   * list of arguments supported, call with zero arguments.</p>
-   * <p>To set stylesheet parameters from the command line, use
-   * <code>-PARAM name expression</code>. If you want to set the
-   * parameter to a string value, simply pass the string value
-   * as-is, and it will be interpreted as a string.  (Note: if
-   * the value has spaces in it, you may need to quote it depending
-   * on your shell environment).</p>
-   *
-   * @param argv Input parameters from command line
-   */
-    public static void main(String argv[]) {
-
-        // Runtime.getRuntime().traceMethodCalls(false); // turns Java tracing off
-        boolean doStackDumpOnError = false;
-        boolean doDiag = false;
-        boolean setQuietMode = false;
-        String msg = null;
-        boolean isSecureProcessing = false;
-
-        // Runtime.getRuntime().traceMethodCalls(false);
-        // Runtime.getRuntime().traceInstructions(false);
-        /**
-         * The default diagnostic writer...
-         */
-        java.io.PrintWriter diagnosticsWriter = new PrintWriter(System.err, true);
-        java.io.PrintWriter dumpWriter = diagnosticsWriter;
-        String flavor = "s2s";
-
-        if (argv.length < 1) {
-            printArgOptions();
-        } else {
-             // J2SE does not support Xalan interpretive
-            // false -> true
-            boolean useXSLTC = true;
-            for (int i = 0; i < argv.length; i++) {
-                if ("-XSLTC".equalsIgnoreCase(argv[i])) {
-                    useXSLTC = true;
-                }
-            }
-
-            TransformerFactory tfactory;
-            if (useXSLTC) {
-                String key = "javax.xml.transform.TransformerFactory";
-                String value = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";
-                Properties props = System.getProperties();
-                props.put(key, value);
-                System.setProperties(props);
-            }
-
-            try {
-                tfactory = TransformerFactory.newInstance();
-                tfactory.setErrorListener(createDefaultErrorListener());
-            } catch (TransformerFactoryConfigurationError pfe) {
-                pfe.printStackTrace(dumpWriter);
-                //      "XSL Process was not successful.");
-                msg = "XSL Process was not successful.";
-                diagnosticsWriter.println(msg);
-
-                tfactory = null;  // shut up compiler
-
-                doExit(msg);
-            }
-
-            boolean formatOutput = false;
-            boolean useSourceLocation = false;
-            String inFileName = null;
-            String outFileName = null;
-            String dumpFileName = null;
-            String xslFileName = null;
-            String treedumpFileName = null;
-            String outputType = null;
-            String media = null;
-            List<String> params = new ArrayList<>();
-            boolean quietConflictWarnings = false;
-            URIResolver uriResolver = null;
-            EntityResolver entityResolver = null;
-            ContentHandler contentHandler = null;
-            int recursionLimit = -1;
-
-            for (int i = 0; i < argv.length; i++) {
-                if ("-XSLTC".equalsIgnoreCase(argv[i])) {
-                    // The -XSLTC option has been processed.
-                } // J2SE does not support Xalan interpretive
-                else if ("-INDENT".equalsIgnoreCase(argv[i])) {
-                    int indentAmount;
-
-                    if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-')) {
-                        indentAmount = Integer.parseInt(argv[++i]);
-                    } else {
-                        indentAmount = 0;
-                    }
-
-                } else if ("-IN".equalsIgnoreCase(argv[i])) {
-                    if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                        inFileName = argv[++i];
-                    } else {
-                        System.err.println("Missing argument for -IN");
-                    }
-                } else if ("-MEDIA".equalsIgnoreCase(argv[i])) {
-                    if (i + 1 < argv.length) {
-                        media = argv[++i];
-                    } else {
-                        System.err.println("Missing argument for -MEDIA");  //"Missing argument for);
-                    }
-                } else if ("-OUT".equalsIgnoreCase(argv[i])) {
-                    if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                        outFileName = argv[++i];
-                    } else {
-                        System.err.println("Missing argument for -OUT");  //"Missing argument for);
-                    }
-                } else if ("-XSL".equalsIgnoreCase(argv[i])) {
-                    if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                        xslFileName = argv[++i];
-                    } else {
-                        System.err.println("Missing argument for -XSL");  //"Missing argument for);
-                    }
-                } else if ("-FLAVOR".equalsIgnoreCase(argv[i])) {
-                    if (i + 1 < argv.length) {
-                        flavor = argv[++i];
-                    } else {
-                        System.err.println("Missing argument for -FLAVOR");  //"Missing argument for);
-                    }
-                } else if ("-PARAM".equalsIgnoreCase(argv[i])) {
-                    if (i + 2 < argv.length) {
-                        String name = argv[++i];
-
-                        params.add(name);
-
-                        String expression = argv[++i];
-
-                        params.add(expression);
-                    } else {
-                        System.err.println("Missing argument for -PARAM");  //"Missing argument for);
-                    }
-                } else if ("-E".equalsIgnoreCase(argv[i])) {
-
-                } else if ("-V".equalsIgnoreCase(argv[i])) {
-                    diagnosticsWriter.println(">>>>>>> Java Version "
-                            + System.getProperty("java.version") + ", "
-                            + /* xmlProcessorLiaison.getParserDescription()+ */ "<<<<<<<");
-                } // J2SE does not support Xalan interpretive
-                /*
-                 else if ("-QC".equalsIgnoreCase(argv[i]))
-                 {
-                 if (!useXSLTC)
-                 quietConflictWarnings = true;
-                 else
-                 printInvalidXSLTCOption("-QC");
-                 }
-                 */ else if ("-Q".equalsIgnoreCase(argv[i])) {
-                    setQuietMode = true;
-                } else if ("-DIAG".equalsIgnoreCase(argv[i])) {
-                    doDiag = true;
-                } else if ("-XML".equalsIgnoreCase(argv[i])) {
-                    outputType = "xml";
-                } else if ("-TEXT".equalsIgnoreCase(argv[i])) {
-                    outputType = "text";
-                } else if ("-HTML".equalsIgnoreCase(argv[i])) {
-                    outputType = "html";
-                } else if ("-EDUMP".equalsIgnoreCase(argv[i])) {
-                    doStackDumpOnError = true;
-
-                    if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-')) {
-                        dumpFileName = argv[++i];
-                    }
-                } else if ("-URIRESOLVER".equalsIgnoreCase(argv[i])) {
-                    if (i + 1 < argv.length) {
-                        try {
-                            Class<?> uriResolverClass = Class.forName(argv[++i]);
-                            Constructor<?> ctor = uriResolverClass.getConstructor();
-                            ctor.setAccessible(true);
-                            uriResolver = (URIResolver) ctor.newInstance();
-
-                            tfactory.setURIResolver(uriResolver);
-                        } catch (Throwable cnfe) {
-                            msg = "Class not found for option -URIResolver";
-                            System.err.println(msg);
-                            doExit(msg);
-                        }
-                    } else {
-                        msg = "Missing argument for -URIResolver";
-                        System.err.println(msg);  //"Missing argument for);
-                        doExit(msg);
-                    }
-                } else if ("-ENTITYRESOLVER".equalsIgnoreCase(argv[i])) {
-                    if (i + 1 < argv.length) {
-                        try {
-                            Class<?> entityResolverClass = Class.forName(argv[++i]);
-                            Constructor<?> ctor = entityResolverClass.getConstructor();
-                            ctor.setAccessible(true);
-                            entityResolver = (EntityResolver) ctor.newInstance();
-                        } catch (Throwable cnfe) {
-                            msg = "Class not found for option -EntityResolver";
-                            System.err.println(msg);
-                            doExit(msg);
-                        }
-                    } else {
-                        //            "Missing argument for);
-                        msg = "Missing argument for -EntityResolver";
-                        System.err.println(msg);
-                        doExit(msg);
-                    }
-                } else if ("-CONTENTHANDLER".equalsIgnoreCase(argv[i])) {
-                    if (i + 1 < argv.length) {
-                        try {
-                            Class<?> contentHandlerClass = Class.forName(argv[++i]);
-                            Constructor<?> ctor = contentHandlerClass.getConstructor();
-                            ctor.setAccessible(true);
-                            contentHandler = (ContentHandler) ctor.newInstance();
-                        } catch (Throwable cnfe) {
-                            msg = "Class not found for option -ContentHandler";
-                            System.err.println(msg);
-                            doExit(msg);
-                        }
-                    } else {
-                        //            "Missing argument for);
-                        msg = "Missing argument for -ContentHandler";
-                        System.err.println(msg);
-                        doExit(msg);
-                    }
-                } else if ("-XO".equalsIgnoreCase(argv[i])) {
-                    if (useXSLTC) {
-                        if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                            tfactory.setAttribute("generate-translet", "true");
-                            tfactory.setAttribute("translet-name", argv[++i]);
-                        } else {
-                            tfactory.setAttribute("generate-translet", "true");
-                        }
-                    } else {
-                        if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                            i++;
-                        }
-                        printInvalidXalanOption("-XO");
-                    }
-                } // Specify the destination directory for the translet classes.
-                else if ("-XD".equalsIgnoreCase(argv[i])) {
-                    if (useXSLTC) {
-                        if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                            tfactory.setAttribute("destination-directory", argv[++i]);
-                        } else {
-                            System.err.println("Missing argument for -XD");  //"Missing argument for);
-                        }
-                    } else {
-                        if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                            i++;
-                        }
-
-                        printInvalidXalanOption("-XD");
-                    }
-                } // Specify the jar file name which the translet classes are packaged into.
-                else if ("-XJ".equalsIgnoreCase(argv[i])) {
-                    if (useXSLTC) {
-                        if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                            tfactory.setAttribute("generate-translet", "true");
-                            tfactory.setAttribute("jar-name", argv[++i]);
-                        } else {
-                            System.err.println("Missing argument for -XJ");  //"Missing argument for);
-                        }
-                    } else {
-                        if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                            i++;
-                        }
-
-                        printInvalidXalanOption("-XJ");
-                    }
-
-                } // Specify the package name prefix for the generated translet classes.
-                else if ("-XP".equalsIgnoreCase(argv[i])) {
-                    if (useXSLTC) {
-                        if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                            tfactory.setAttribute("package-name", argv[++i]);
-                        } else {
-                            System.err.println("Missing argument for -XP");  //"Missing argument for);
-                        }
-                    } else {
-                        if (i + 1 < argv.length && argv[i + 1].charAt(0) != '-') {
-                            i++;
-                        }
-
-                        printInvalidXalanOption("-XP");
-                    }
-
-                } // Enable template inlining.
-                else if ("-XN".equalsIgnoreCase(argv[i])) {
-                    if (useXSLTC) {
-                        tfactory.setAttribute("enable-inlining", "true");
-                    } else {
-                        printInvalidXalanOption("-XN");
-                    }
-                } // Turns on additional debugging message output
-                else if ("-XX".equalsIgnoreCase(argv[i])) {
-                    if (useXSLTC) {
-                        tfactory.setAttribute("debug", "true");
-                    } else {
-                        printInvalidXalanOption("-XX");
-                    }
-                } // Create the Transformer from the translet if the translet class is newer
-                // than the stylesheet.
-                else if ("-XT".equalsIgnoreCase(argv[i])) {
-                    if (useXSLTC) {
-                        tfactory.setAttribute("auto-translet", "true");
-                    } else {
-                        printInvalidXalanOption("-XT");
-                    }
-                } else if ("-SECURE".equalsIgnoreCase(argv[i])) {
-                    isSecureProcessing = true;
-                    try {
-                        tfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-                    } catch (TransformerConfigurationException e) {
-                    }
-                } else {
-                    System.err.println("Invalid argument: " + argv[i]);  //"Invalid argument:);
-                }
-            }
-
-            // Print usage instructions if no xml and xsl file is specified in the command line
-            if (inFileName == null && xslFileName == null) {
-                msg = "Error: No stylesheet or input xml is specified. Run this command without any option for usage instructions.";
-                System.err.println(msg);
-                doExit(msg);
-            }
-
-      // Note that there are usage cases for calling us without a -IN arg
-            // The main XSL transformation occurs here!
-            try {
-                long start = System.currentTimeMillis();
-
-                if (null != dumpFileName) {
-                    dumpWriter = new PrintWriter(new FileWriter(dumpFileName));
-                }
-
-                Templates stylesheet = null;
-
-                if (null != xslFileName) {
-                    if (flavor.equals("d2d")) {
-
-                        // Parse in the xml data into a DOM
-                        DocumentBuilderFactory dfactory
-                                = DocumentBuilderFactory.newInstance();
-
-                        dfactory.setNamespaceAware(true);
-
-                        if (isSecureProcessing) {
-                            try {
-                                dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-                            } catch (ParserConfigurationException pce) {
-                            }
-                        }
-
-                        DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
-                        Node xslDOM = docBuilder.parse(new InputSource(xslFileName));
-
-                        stylesheet = tfactory.newTemplates(new DOMSource(xslDOM,
-                                xslFileName));
-                    } else {
-                        // System.out.println("Calling newTemplates: "+xslFileName);
-                        stylesheet = tfactory.newTemplates(new StreamSource(xslFileName));
-                        // System.out.println("Done calling newTemplates: "+xslFileName);
-                    }
-                }
-
-                PrintWriter resultWriter;
-                StreamResult strResult;
-
-                if (null != outFileName) {
-                    strResult = new StreamResult(new FileOutputStream(outFileName));
-                    // One possible improvement might be to ensure this is
-                    //  a valid URI before setting the systemId, but that
-                    //  might have subtle changes that pre-existing users
-                    //  might notice; we can think about that later -sc r1.46
-                    strResult.setSystemId(outFileName);
-                } else {
-                    strResult = new StreamResult(System.out);
-                    // We used to default to incremental mode in this case.
-                    // We've since decided that since the -INCREMENTAL switch is
-                    // available, that default is probably not necessary nor
-                    // necessarily a good idea.
-                }
-
-                SAXTransformerFactory stf = (SAXTransformerFactory) tfactory;
-
-                // Did they pass in a stylesheet, or should we get it from the
-                // document?
-                if (null == stylesheet) {
-                    Source source
-                            = stf.getAssociatedStylesheet(new StreamSource(inFileName), media,
-                                    null, null);
-
-                    if (null != source) {
-                        stylesheet = tfactory.newTemplates(source);
-                    } else {
-                        if (null != media) {
-                            throw new TransformerException("No stylesheet found in:  "
-                                    + inFileName + ", media=" + media); //"No stylesheet found in: "
-                        } // + inFileName + ", media="
-                        // + media);
-                        else {
-                            throw new TransformerException("No xml-stylesheet PI found in: " + inFileName); //"No xml-stylesheet PI found in: "
-                        }                                             //+ inFileName);
-                    }
-                }
-
-                if (null != stylesheet) {
-                    Transformer transformer = flavor.equals("th") ? null : stylesheet.newTransformer();
-                    transformer.setErrorListener(createDefaultErrorListener());
-
-                    // Override the output format?
-                    if (null != outputType) {
-                        transformer.setOutputProperty(OutputKeys.METHOD, outputType);
-                    }
-
-                    int nParams = params.size();
-
-                    for (int i = 0; i < nParams; i += 2) {
-                        transformer.setParameter((String) params.get(i),
-                                (String) params.get(i + 1));
-                    }
-
-                    if (uriResolver != null) {
-                        transformer.setURIResolver(uriResolver);
-                    }
-
-                    if (null != inFileName) {
-                        if (flavor.equals("d2d")) {
-
-                            // Parse in the xml data into a DOM
-                            DocumentBuilderFactory dfactory
-                                    = DocumentBuilderFactory.newInstance();
-
-                            dfactory.setCoalescing(true);
-                            dfactory.setNamespaceAware(true);
-
-                            if (isSecureProcessing) {
-                                try {
-                                    dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-                                } catch (ParserConfigurationException pce) {
-                                }
-                            }
-
-                            DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
-
-                            if (entityResolver != null) {
-                                docBuilder.setEntityResolver(entityResolver);
-                            }
-
-                            Node xmlDoc = docBuilder.parse(new InputSource(inFileName));
-                            Document doc = docBuilder.newDocument();
-                            org.w3c.dom.DocumentFragment outNode
-                                    = doc.createDocumentFragment();
-
-                            transformer.transform(new DOMSource(xmlDoc, inFileName),
-                                    new DOMResult(outNode));
-
-                            // Now serialize output to disk with identity transformer
-                            Transformer serializer = stf.newTransformer();
-                            serializer.setErrorListener(createDefaultErrorListener());
-
-                            Properties serializationProps
-                                    = stylesheet.getOutputProperties();
-
-                            serializer.setOutputProperties(serializationProps);
-
-                            if (contentHandler != null) {
-                                SAXResult result = new SAXResult(contentHandler);
-
-                                serializer.transform(new DOMSource(outNode), result);
-                            } else {
-                                serializer.transform(new DOMSource(outNode), strResult);
-                            }
-                        } else if (flavor.equals("th")) {
-                            for (int i = 0; i < 1; i++) // Loop for diagnosing bugs with inconsistent behavior
-                            {
-                                // System.out.println("Testing the TransformerHandler...");
-
-                                XMLReader reader = null;
-
-                                // Use JAXP1.1 ( if possible )
-                                try {
-                                    javax.xml.parsers.SAXParserFactory factory
-                                            = javax.xml.parsers.SAXParserFactory.newInstance();
-
-                                    factory.setNamespaceAware(true);
-
-                                    if (isSecureProcessing) {
-                                        try {
-                                            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-                                        } catch (org.xml.sax.SAXException se) {
-                                        }
-                                    }
-
-                                    javax.xml.parsers.SAXParser jaxpParser
-                                            = factory.newSAXParser();
-
-                                    reader = jaxpParser.getXMLReader();
-                                } catch (javax.xml.parsers.ParserConfigurationException ex) {
-                                    throw new org.xml.sax.SAXException(ex);
-                                } catch (javax.xml.parsers.FactoryConfigurationError ex1) {
-                                    throw new org.xml.sax.SAXException(ex1.toString());
-                                } catch (NoSuchMethodError ex2) {
-                                } catch (AbstractMethodError ame) {
-                                }
-
-                                if (null == reader) {
-                                    reader = XMLReaderFactory.createXMLReader();
-                                }
-
-                                TransformerHandler th = stf.newTransformerHandler(stylesheet);
-
-                                reader.setContentHandler(th);
-                                reader.setDTDHandler(th);
-
-                                if (th instanceof org.xml.sax.ErrorHandler) {
-                                    reader.setErrorHandler((org.xml.sax.ErrorHandler) th);
-                                }
-
-                                try {
-                                    reader.setProperty(
-                                            "http://xml.org/sax/properties/lexical-handler", th);
-                                } catch (org.xml.sax.SAXNotRecognizedException e) {
-                                } catch (org.xml.sax.SAXNotSupportedException e) {
-                                }
-                                try {
-                                    reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
-                                            true);
-                                } catch (org.xml.sax.SAXException se) {
-                                }
-
-                                th.setResult(strResult);
-
-                                reader.parse(new InputSource(inFileName));
-                            }
-                        } else {
-                            if (entityResolver != null) {
-                                XMLReader reader = null;
-
-                                // Use JAXP1.1 ( if possible )
-                                try {
-                                    javax.xml.parsers.SAXParserFactory factory
-                                            = javax.xml.parsers.SAXParserFactory.newInstance();
-
-                                    factory.setNamespaceAware(true);
-
-                                    if (isSecureProcessing) {
-                                        try {
-                                            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
-                                        } catch (org.xml.sax.SAXException se) {
-                                        }
-                                    }
-
-                                    javax.xml.parsers.SAXParser jaxpParser
-                                            = factory.newSAXParser();
-
-                                    reader = jaxpParser.getXMLReader();
-                                } catch (javax.xml.parsers.ParserConfigurationException ex) {
-                                    throw new org.xml.sax.SAXException(ex);
-                                } catch (javax.xml.parsers.FactoryConfigurationError ex1) {
-                                    throw new org.xml.sax.SAXException(ex1.toString());
-                                } catch (NoSuchMethodError ex2) {
-                                } catch (AbstractMethodError ame) {
-                                }
-
-                                if (null == reader) {
-                                    reader = XMLReaderFactory.createXMLReader();
-                                }
-
-                                reader.setEntityResolver(entityResolver);
-
-                                if (contentHandler != null) {
-                                    SAXResult result = new SAXResult(contentHandler);
-
-                                    transformer.transform(
-                                            new SAXSource(reader, new InputSource(inFileName)),
-                                            result);
-                                } else {
-                                    transformer.transform(
-                                            new SAXSource(reader, new InputSource(inFileName)),
-                                            strResult);
-                                }
-                            } else if (contentHandler != null) {
-                                SAXResult result = new SAXResult(contentHandler);
-
-                                transformer.transform(new StreamSource(inFileName), result);
-                            } else {
-                                // System.out.println("Starting transform");
-                                transformer.transform(new StreamSource(inFileName),
-                                        strResult);
-                                // System.out.println("Done with transform");
-                            }
-                        }
-                    } else {
-                        StringReader reader
-                                = new StringReader("<?xml version=\"1.0\"?> <doc/>");
-
-                        transformer.transform(new StreamSource(reader), strResult);
-                    }
-                } else {
-                    //          "XSL Process was not successful.");
-                    msg = "XSL Process was not successful.";
-                    diagnosticsWriter.println(msg);
-                    doExit(msg);
-                }
-
-                // close output streams
-                if (null != outFileName && strResult != null) {
-                    java.io.OutputStream out = strResult.getOutputStream();
-                    java.io.Writer writer = strResult.getWriter();
-                    try {
-                        if (out != null) {
-                            out.close();
-                        }
-                        if (writer != null) {
-                            writer.close();
-                        }
-                    } catch (java.io.IOException ie) {
-                    }
-                }
-
-                long stop = System.currentTimeMillis();
-                long millisecondsDuration = stop - start;
-
-                if (doDiag) {
-                    msg = " --------- Transform of " + inFileName + " via "
-                            + xslFileName + " took " + millisecondsDuration + " ms";
-                    diagnosticsWriter.println('\n');
-                    diagnosticsWriter.println(msg);
-                }
-
-            } catch (Throwable throwable) {
-                doStackDumpOnError = true;
-
-                diagnosticsWriter.println();
-
-                if (doStackDumpOnError) {
-                    throwable.printStackTrace(dumpWriter);
-                } else {
-                    printLocation(diagnosticsWriter, throwable);
-                    diagnosticsWriter.println("Unexpected exception: " + throwable);
-                }
-
-                // diagnosticsWriter.println(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUCCESSFUL, null)); //"XSL Process was not successful.");
-                if (null != dumpFileName) {
-                    dumpWriter.close();
-                }
-
-                doExit(throwable.getMessage());
-            }
-
-            if (null != dumpFileName) {
-                dumpWriter.close();
-            }
-
-            if (null != diagnosticsWriter) {
-
-                // diagnosticsWriter.close();
-            }
-
-            // if(!setQuietMode)
-            //  diagnosticsWriter.println(resbundle.getString("xsldone")); //"Xalan: done");
-            // else
-            // diagnosticsWriter.println("");  //"Xalan: done");
-        }
-    }
-
-    /**
-     * It is _much_ easier to debug under VJ++ if I can set a single breakpoint
-     * before this blows itself out of the water... (I keep checking this in, it
-     * keeps vanishing. Grr!)
-     *
-     */
-    static void doExit(String msg) {
-        throw new RuntimeException(msg);
-    }
-
-    /**
-     * Wait for a return key to continue
-     *
-     * @param resbundle The resource bundle
-     */
-    private static void waitForReturnKey() {
-        System.out.println("(press <return> to continue)");
-        try {
-            while (System.in.read() != '\n');
-        } catch (java.io.IOException e) {
-        }
-    }
-
-    /**
-     * Print a message if an option cannot be used with -XSLTC.
-     *
-     * @param option The option String
-     */
-    private static void printInvalidXSLTCOption(String option) {
-        System.err.println("The option " + option + " is not supported in XSLTC mode.");
-    }
-
-    /**
-     * Print a message if an option can only be used with -XSLTC.
-     *
-     * @param option The option String
-     */
-    private static void printInvalidXalanOption(String option) {
-        System.err.println("The option " + option + " can only be used with -XSLTC.");
-    }
-
-    static class DummyErrorListenerHandler implements ErrorHandler, ErrorListener {
-        @Override
-        public void warning(SAXParseException exception) throws SAXException {
-            System.err.println("WARNING: " + exception);
-        }
-        @Override
-        public void error(SAXParseException exception) throws SAXException {
-            throw exception;
-        }
-        @Override
-        public void fatalError(SAXParseException exception) throws SAXException {
-            throw exception;
-        }
-        @Override
-        public void warning(TransformerException exception) throws TransformerException {
-            System.err.println("WARNING: " + exception);
-        }
-        @Override
-        public void error(TransformerException exception) throws TransformerException {
-            throw exception;
-        }
-        @Override
-        public void fatalError(TransformerException exception) throws TransformerException {
-            throw exception;
-        }
-    }
-
-    static ErrorListener createDefaultErrorListener() {
-        try {
-            Class<?> errorHandler =
-                    Class.forName("com.sun.org.apache.xml.internal.utils.DefaultErrorHandler");
-            Constructor<?> ctor = errorHandler.getConstructor();
-            return (ErrorListener) ctor.newInstance();
-        } catch (Throwable r) {
-            return new DummyErrorListenerHandler();
-        }
-    }
-
-    private static void printLocation(PrintWriter diagnosticsWriter, Throwable throwable) {
-        try {
-            Class<?> errorHandler =
-                    Class.forName("com.sun.org.apache.xml.internal.utils.DefaultErrorHandler");
-            Method m = errorHandler.getMethod("printLocation", PrintWriter.class, Throwable.class);
-            m.invoke(null, diagnosticsWriter, throwable);
-        } catch (Throwable t) {
-            SourceLocator locator = null;
-            Throwable cause = throwable;
-
-            // Try to find the locator closest to the cause.
-            do {
-                if (cause instanceof TransformerException) {
-                    SourceLocator causeLocator = ((TransformerException) cause).getLocator();
-                    if (null != causeLocator) {
-                        locator = causeLocator;
-                    }
-                    cause = ((TransformerException) cause).getCause();
-                } else if (cause instanceof SAXException) {
-                    cause = ((SAXException) cause).getException();
-                } else {
-                    cause = cause.getCause();
-                }
-            } while (null != cause);
-
-            if (null != locator) {
-                // m_pw.println("Parser fatal error: "+exception.getMessage());
-                String id = (null != locator.getPublicId())
-                        ? locator.getPublicId()
-                        : (null != locator.getSystemId())
-                                ? locator.getSystemId() : "SystemId Unknown"; //"SystemId Unknown";
-
-                diagnosticsWriter.print(id + "; " + "line: " + locator.getLineNumber()
-                        + "; column: " + locator.getColumnNumber() + "; ");
-            }
-            diagnosticsWriter.print("(" + throwable + ": unknown location)");
-        }
-    }
-
-}
--- a/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest-in.xml	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<office:document xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style"  office:class="text" office:version="1.0">
-	<office:styles>
-		<style:default-style style:family="graphics"/>
-		<style:default-style style:family="paragraph"/>
-	</office:styles>
-</office:document>
--- a/test/javax/xml/jaxp/internaltest/javax/xml/transform/cli/tigertest.xsl	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<xsl:stylesheet version="1.0"
-		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-		xmlns:office="http://openoffice.org/2000/office"
-		xmlns:style="http://openoffice.org/2000/style">
-
-	<xsl:output method="xml" encoding="UTF-8"/>
-
-	<xsl:template match="/">
-		<xsl:variable name="copyData">
-			<xsl:call-template name="copy-by-template" />
-		</xsl:variable>
-		<test>
-  		   <xsl:copy-of select="$copyData"/>
-		</test>
-	</xsl:template>
-
-	<xsl:template name="copy-by-template">
-		<xsl:copy-of select="/"/>
-	</xsl:template>
-</xsl:stylesheet>
--- a/test/javax/xml/jaxp/isolatedjdk/TEST.properties	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-lib.dirs=/javax/xml/jaxp/libs
-
-# Declare module dependency
-modules=java.xml
\ No newline at end of file
--- a/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java	Fri Aug 05 12:03:50 2016 -0700
+++ b/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java	Thu Aug 11 10:38:13 2016 -0700
@@ -37,6 +37,8 @@
 import javax.xml.catalog.CatalogResolver;
 import javax.xml.catalog.CatalogUriResolver;
 
+import jaxp.library.JAXPTestUtilities;
+
 /*
  * Utilities for testing XML Catalog API.
  */
@@ -126,24 +128,10 @@
     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 ********** */
 
     /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/libs/jaxp/library/BasePolicy.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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 teardown 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");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/libs/jaxp/library/FilePolicy.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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"));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/libs/jaxp/library/InternalAPIPolicy.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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"));
+        }
+    }
+}
--- a/test/javax/xml/jaxp/libs/jaxp/library/JAXPBaseTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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();
-        }
-    }
-}
--- a/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileBaseTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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"));
-    }
-}
--- a/test/javax/xml/jaxp/libs/jaxp/library/JAXPFileReadOnlyBaseTest.java	Fri Aug 05 12:03:50 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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 static jaxp.library.JAXPBaseTest.setPermissions;
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeGroups;
-
-/**
- * This is a base class that every test class that need to reading local XML
- * files must extend if it needs to be run with security mode.
- */
-public class JAXPFileReadOnlyBaseTest extends JAXPBaseTest {
-    /**
-     * Source files/XML files directory.
-     */
-    private final String SRC_DIR = getSystemProperty("test.src");
-
-    /**
-     * Allowing access local file system for this group.
-     */
-    @BeforeGroups (groups = {"readLocalFiles"})
-    public void setFilePermissions() {
-        setPermissions(new FilePermission(SRC_DIR + "/-", "read"));
-    }
-
-    /**
-     * Restore the system property.
-     */
-    @AfterGroups (groups = {"readLocalFiles"})
-    public void restoreFilePermissions() {
-        setPermissions();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/xml/jaxp/libs/jaxp/library/JAXPPolicyManager.java	Thu Aug 11 10:38:13 2016 -0700
@@ -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<Map<Integer, Permission>> transientPermissions = new ThreadLocal<>();
+    private ThreadLocal<Boolean> allowAll = new ThreadLocal<>();
+
+    private static Policy defaultPolicy = Policy.getPolicy();
+
+    /*
+     * Add permission to this policy.
+     *
+     * @param permission to be added.
+     */
+    void addPermission(Permission p) {
+        permissions.add(p);
+    }
+
+    /*
+     * Set all permissions. Caution: this should not called carefully unless
+     * it's really needed.
+     *
+     * private void setAllPermissions() { permissions.add(new AllPermission());
+     * }
+     */
+
+    /*
+     * Overloaded methods from the Policy class.
+     */
+    @Override
+    public String toString() {
+        StringJoiner sj = new StringJoiner("\n", "policy: ", "");
+        Enumeration<Permission> perms = permissions.elements();
+        while (perms.hasMoreElements()) {
+            sj.add(perms.nextElement().toString());
+        }
+        return sj.toString();
+
+    }
+
+    @Override
+    public PermissionCollection getPermissions(ProtectionDomain domain) {
+        return permissions;
+    }
+
+    @Override
+    public PermissionCollection getPermissions(CodeSource codesource) {
+        return permissions;
+    }
+
+    @Override
+    public boolean implies(ProtectionDomain domain, Permission perm) {
+        if (allowAll())
+            return true;
+
+        if (defaultPolicy.implies(domain, perm))
+            return true;
+
+        if (permissions.implies(perm))
+            return true;
+        else
+            return tmpImplies(perm);
+    }
+
+    /*
+     * 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) {
+        Map<Integer, Permission> tmpPermissions = transientPermissions.get();
+        if (tmpPermissions == null)
+            tmpPermissions = new HashMap<>();
+
+        int id = tmpPermissions.size();
+        tmpPermissions.put(id, p);
+        transientPermissions.set(tmpPermissions);
+        return id;
+    }
+
+    /*
+     * Remove a temporary permission from current thread context.