8077931: Develop tests for XML Catalog API
authorjoehw
Thu, 29 Oct 2015 22:12:53 -0700
changeset 33543 cd228512f933
parent 33542 9f0eef87e8c1
child 33544 bbe6f7195a37
8077931: Develop tests for XML Catalog API Reviewed-by: joehw, lancea Contributed-by: sha.jiang@oracle.com
jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/catalogReferCircle-itself.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/catalogReferCircle-left.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/catalogReferCircle-right.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/deferFeature.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegatePublic-alice.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegatePublic-bob.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegatePublic-carl.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegatePublic.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateSystem-alice.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateSystem-bob.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateSystem-carl.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateSystem.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateUri-alice.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateUri-bob.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateUri-carl.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateUri.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/group.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/loadCatalogFiles.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-left.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-leftAlice.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-leftBob.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-leftCarl.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-right.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-rightAlice.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-rightBob.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/normalization.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/prefer.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/preferFeature.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/public.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/publicFamily.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/rewriteSystem.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/rewriteUri.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/specifyCatalog-api.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/specifyCatalog-feature.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/specifyCatalog-sysProps.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/system.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/systemFamily.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/systemSuffix.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/uri.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/uriFamily.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/uriSuffix.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/urnUnwrapping.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/validateCatalog-malformed.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/validateCatalog-noNamingSpace.xml
jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/validateCatalog-wrongRoot.xml
jaxp/test/javax/xml/jaxp/isolatedjdk/IsolatedJDK.sh
jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties
jaxp/test/javax/xml/jaxp/isolatedjdk/catalog/PropertiesTest.java
jaxp/test/javax/xml/jaxp/isolatedjdk/catalog/PropertiesTest.sh
jaxp/test/javax/xml/jaxp/isolatedjdk/catalog/catalogFiles/properties.xml
jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java
jaxp/test/javax/xml/jaxp/libs/catalog/ResolutionChecker.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/CatalogReferCircularityTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,62 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+
+import javax.xml.catalog.CatalogException;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class CatalogReferCircularityTest {
+
+    @Test(dataProvider = "catalogName",
+            expectedExceptions = CatalogException.class)
+    public void testReferCircularity(String catalogFile) {
+        catalogResolver(catalogFile).resolveEntity(null,
+                "http://remote/dtd/ghost/docGhost.dtd");
+    }
+
+    @DataProvider(name = "catalogName")
+    private Object[][] catalogName() {
+        return new Object[][] {
+                // This catalog defines itself as next catalog.
+                { "catalogReferCircle-itself.xml" },
+
+                // This catalog defines catalogReferCircle-right.xml as its next
+                // catalog. And catalogReferCircle-right.xml also defines
+                // catalogReferCircle-left.xml as its next catalog, too.
+                { "catalogReferCircle-left.xml" } };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DefaultFeaturesTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,66 @@
+/*
+ * 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 catalog;
+
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogFeatures.Feature;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary This case tests if the default feature values are expected.
+ */
+public class DefaultFeaturesTest {
+
+    private CatalogFeatures defaultFeature;
+
+    @BeforeClass
+    public void init() {
+        defaultFeature = CatalogFeatures.defaults();
+    }
+
+    @Test(dataProvider="feature-value")
+    public void testDefaultFeatures(Feature feature, String expected) {
+        String featureValue = defaultFeature.get(feature);
+        if (expected != null) {
+            Assert.assertEquals(featureValue, expected);
+        } else {
+            Assert.assertNull(featureValue);
+        }
+    }
+
+    @DataProvider(name = "feature-value")
+    private Object[][] data() {
+        return new Object[][] {
+                { Feature.FILES, null },
+                { Feature.PREFER, CatalogTestUtils.PREFER_PUBLIC },
+                { Feature.DEFER, CatalogTestUtils.DEFER_TRUE },
+                { Feature.RESOLVE, CatalogTestUtils.RESOLVE_STRICT } };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DeferFeatureTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,92 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.DEFER_FALSE;
+import static catalog.CatalogTestUtils.DEFER_TRUE;
+import static catalog.CatalogTestUtils.getCatalogPath;
+import static javax.xml.catalog.CatalogFeatures.Feature.DEFER;
+import static javax.xml.catalog.CatalogManager.catalog;
+
+import java.lang.reflect.Method;
+
+import javax.xml.catalog.Catalog;
+import javax.xml.catalog.CatalogFeatures;
+
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class DeferFeatureTest {
+
+    @Test(dataProvider = "catalog-countOfLoadedCatalogFile")
+    public void testDeferFeature(Catalog catalog, int catalogCount)
+            throws Exception {
+        Assert.assertEquals(loadedCatalogCount(catalog), catalogCount);
+    }
+
+    @DataProvider(name = "catalog-countOfLoadedCatalogFile")
+    private Object[][] data() {
+        return new Object[][] {
+                // This catalog specifies null catalog explicitly,
+                // and the count of loaded catalogs should be 0.
+                { createCatalog(null), 0 },
+
+                // This catalog specifies null catalog implicitly,
+                // and the count of loaded catalogs should be 0.
+                { createCatalog(CatalogFeatures.defaults()), 0 },
+
+                // This catalog loads null catalog with true DEFER,
+                // and the count of loaded catalogs should be 0.
+                { createCatalog(createDeferFeature(DEFER_TRUE)), 0 },
+
+                // This catalog loads null catalog with false DEFER.
+                // It should load all of none-current catalogs and the
+                // count of loaded catalogs should be 3.
+                { createCatalog(createDeferFeature(DEFER_FALSE)), 3 } };
+    }
+
+    private CatalogFeatures createDeferFeature(String defer) {
+        return CatalogFeatures.builder().with(DEFER, defer).build();
+    }
+
+    private Catalog createCatalog(CatalogFeatures feature) {
+        return catalog(feature, getCatalogPath("deferFeature.xml"));
+    }
+
+    private int loadedCatalogCount(Catalog catalog) throws Exception {
+        Method method = catalog.getClass().getDeclaredMethod(
+                "loadedCatalogCount");
+        method.setAccessible(true);
+        return (int) method.invoke(catalog);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegatePublicTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,99 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.ResolutionChecker.checkPubIdResolution;
+import static catalog.ResolutionChecker.expectExceptionOnPubId;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary Get matched URIs from DelegatePublic entries.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class DelegatePublicTest {
+
+    @Test(dataProvider = "publicId-matchedUri")
+    public void testMatch(String publicId, String matchedUri) {
+        checkPubIdResolution(createResolver(), publicId, matchedUri);
+    }
+
+    @DataProvider(name = "publicId-matchedUri")
+    private 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.
+                { "-//REMOTE//DTD ALICE DOCALICE XML//EN",
+                        "http://local/dtd/docAlicePub.dtd" },
+
+                // The current catalog file defines two delegatePublic entries
+                // with the same publicIdStartString, and both of them match the
+                // specified public id. But the matched URI should be in the
+                // delegate catalog file, which is defined in the upper
+                // delegatePublic entry.
+                { "-//REMOTE//DTD BOB DOCBOB XML//EN",
+                        "http://local/base/dtd/bob/docBobPub.dtd" },
+
+                // The current catalog file defines two delegatePublic entries,
+                // and both of them match the specified public id. But the
+                // matched URI should be in the delegate catalog file, which is
+                // defined in the longest matched delegatePublic entry.
+                { "-//REMOTE//DTD CARL DOCCARL XML//EN",
+                        "http://local/base/dtd/carl/docCarlPub.dtd" } };
+    }
+
+    @Test(dataProvider = "publicId-expectedExceptionClass")
+    public void testException(String publicId,
+            Class<? extends Throwable> expectedExceptionClass) {
+        expectExceptionOnPubId(createResolver(), publicId,
+                expectedExceptionClass);
+    }
+
+    @DataProvider(name = "publicId-expectedExceptionClass")
+    private Object[][] dataOnException() {
+        return new Object[][] {
+                // The matched delegatePublic entry of the specified public id
+                // defines a non-existing delegate catalog file. That should
+                // raise a RuntimeException.
+                { "-//REMOTE//DTD DAVID DOCDAVID XML//EN",
+                        RuntimeException.class },
+
+                // There's no match of the specified public id in the catalog
+                // structure. That should raise a CatalogException.
+                { "-//REMOTE//DTD GHOST DOCGHOST XML//EN",
+                        CatalogException.class } };
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver("delegatePublic.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateSystemTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,99 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+import static catalog.ResolutionChecker.expectExceptionOnSysId;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary Get matched URIs from delegateSystem entries.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class DelegateSystemTest {
+
+    @Test(dataProvider = "systemId-matchedUri")
+    public void testMatch(String systemId, String matchedUri) {
+        checkSysIdResolution(createResolver(), systemId, matchedUri);
+    }
+
+    @DataProvider(name = "systemId-matchedUri")
+    private 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.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/base/dtd/alice/docAliceDS.dtd" },
+
+                // The current catalog file defines two delegateSystem entries
+                // with the same systemIdStartString, and both of them match the
+                // specified system id. But the matched URI should be in the
+                // delegate catalog file, which is defined in the upper
+                // delegateSystem entry.
+                { "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/bob/docBobDS.dtd" },
+
+                // The current catalog file defines two delegateSystem entries,
+                // and both of them match the specified system id. But the
+                // matched URI should be in the delegate catalog file, which is
+                // defined in the longest matched delegateSystem entry.
+                { "http://remote/dtd/carl/docCarl.dtd",
+                        "http://local/base/dtd/carl/docCarlDS.dtd"} };
+    }
+
+    @Test(dataProvider = "systemId-expectedExceptionClass")
+    public void testException(String systemId,
+            Class<? extends Throwable> expectedExceptionClass) {
+        expectExceptionOnSysId(createResolver(), systemId,
+                expectedExceptionClass);
+    }
+
+    @DataProvider(name = "systemId-expectedExceptionClass")
+    private Object[][] dataOnException() {
+        return new Object[][] {
+                // The matched delegateSystem entry of the specified system id
+                // defines a non-existing delegate catalog file. That should
+                // raise a RuntimeException.
+                { "http://remote/dtd/david/docDavidDS.dtd",
+                        RuntimeException.class },
+
+                // There's no match of the specified system id in the catalog
+                // structure. That should raise a CatalogException.
+                { "http://ghost/xml/dtd/ghost/docGhostDS.dtd",
+                        CatalogException.class } };
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver("delegateSystem.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/DelegateUriTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,98 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkUriResolution;
+import static catalog.ResolutionChecker.expectExceptionOnUri;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary Get matched URIs from delegateURI entries.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class DelegateUriTest {
+
+    @Test(dataProvider = "uri-matchedUri")
+    public void testMatch(String uri, String matchedUri) {
+        checkUriResolution(createResolver(), uri, matchedUri);
+    }
+
+    @DataProvider(name = "uri-matchedUri")
+    private 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.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/base/dtd/alice/docAliceDU.dtd" },
+
+                // The current catalog file defines two delegateURI entries
+                // with the same uriStartString, and both of them match the
+                // specified URI reference. But the matched URI should be in
+                // the delegate catalog file, which is defined in the upper
+                // delegateURI entry.
+                { "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/bob/docBobDU.dtd" },
+
+                // The current catalog file defines two delegateURI entries,
+                // and both of them match the specified URI reference. But the
+                // matched URI should be in the delegate catalog file, which is
+                // defined in the longest matched delegateURI entry.
+                { "http://remote/dtd/carl/docCarl.dtd",
+                        "http://local/base/dtd/carl/docCarlDU.dtd"} };
+    }
+
+    @Test(dataProvider = "uri-expectedExceptionClass")
+    public void testException(String uri,
+            Class<? extends Throwable> expectedExceptionClass) {
+        expectExceptionOnUri(createResolver(), uri, expectedExceptionClass);
+    }
+
+    @DataProvider(name = "uri-expectedExceptionClass")
+    private Object[][] dataOnException() {
+        return new Object[][] {
+                // The matched delegateURI entry of the specified URI reference
+                // defines a non-existing delegate catalog file. That should
+                // raise a RuntimeException.
+                { "http://remote/dtd/david/docDavidDU.dtd",
+                        RuntimeException.class },
+
+                // There's no match of the specified URI reference in the
+                // catalog structure. That should raise a CatalogException.
+                { "http://ghost/xml/dtd/ghost/docGhostDS.dtd",
+                        CatalogException.class } };
+    }
+
+    private CatalogUriResolver createResolver() {
+        return catalogUriResolver("delegateUri.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/GroupTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,130 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkPubIdResolution;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+import static catalog.ResolutionChecker.checkUriResolution;
+
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class GroupTest {
+
+    private static final String CATALOG_GROUP = "group.xml";
+
+    @Test(dataProvider = "systemId-matchedUri")
+    public void testMatchOnSysId(String uri, String matchedUri) {
+        checkSysIdResolution(createResolver(), uri, matchedUri);
+    }
+
+    @DataProvider(name = "systemId-matchedUri")
+    private Object[][] dataOnSysId() {
+        return new Object[][] {
+                // The matched URI of the specified system id is enclosed by a
+                // group entry.
+                { "http://remote/dtd/sys/alice/docAlice.dtd",
+                        "http://local/base/dtd/docAliceSys.dtd" },
+
+                // The matched URI of the specified system id is enclosed by a
+                // group entry, which defines another base.
+                { "http://remote/dtd/sys/bob/docBob.dtd",
+                        "http://local/bobBase/dtd/docBobSys.dtd" },
+
+                // The catalog file defines a set of system entries. Some of
+                // them are enclosed by a group entry, and others are out of the
+                // group entry. All of them can match the specified system id.
+                // But the returned matched URI should be in the first one.
+                { "http://remote/dtd/sys/carl/docCarl.dtd",
+                        "http://local/base/dtd/docCarlSys1.dtd" } };
+    }
+
+    @Test(dataProvider = "publicId-matchedUri")
+    public void testMatchOnPubId(String uri, String matchedUri) {
+        checkPubIdResolution(createResolver(), uri, matchedUri);
+    }
+
+    @DataProvider(name = "publicId-matchedUri")
+    private Object[][] dataOnPubId() {
+        return new Object[][] {
+                // The matched URI of the specified public id is enclosed by a
+                // group entry.
+                { "-//REMOTE//DTD ALICE DOCALICE XML//EN",
+                        "http://local/base/dtd/docAlicePub.dtd" },
+
+                // The matched URI of the specified public id is enclosed by a
+                // group entry, which defines another base.
+                { "-//REMOTE//DTD BOB DOCBOB XML//EN",
+                        "http://local/bobBase/dtd/docBobPub.dtd" },
+
+                // The catalog file defines a set of public entries. Some of
+                // them are enclosed by a group entry, and others are out of the
+                // group entry. All of them can match the specified public id.
+                // But the returned matched URI should be in the first one.
+                { "-//REMOTE//DTD CARL DOCCARL XML//EN",
+                        "http://local/base/dtd/docCarlPub1.dtd" } };
+    }
+
+    @Test(dataProvider = "uri-matchedUri")
+    public void testMatchOnUri(String uri, String matchedUri) {
+        checkUriResolution(catalogUriResolver(CATALOG_GROUP), uri, matchedUri);
+    }
+
+    @DataProvider(name = "uri-matchedUri")
+    private Object[][] dataOnUri() {
+        return new Object[][] {
+                // The matched URI of the specified URI reference is enclosed by
+                // a group entry.
+                { "http://remote/dtd/uri/alice/docAlice.dtd",
+                        "http://local/base/dtd/docAliceURI.dtd" },
+
+                // The matched URI of the specified URI reference is enclosed by
+                // a group entry, which defines another base.
+                { "http://remote/dtd/uri/bob/docBob.dtd",
+                        "http://local/bobBase/dtd/docBobURI.dtd" },
+
+                // The catalog file defines a set of uri entries. Some of
+                // them are enclosed by a group entry, and others are out of the
+                // group entry. All of them can match the specified URI reference.
+                // But the returned matched URI should be in the first one.
+                { "http://remote/dtd/uri/alice/docAlice.dtd",
+                        "http://local/base/dtd/docAliceURI.dtd" } };
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver(CATALOG_GROUP);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/LoadCatalogTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,120 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.CATALOG_PUBLIC;
+import static catalog.CatalogTestUtils.CATALOG_SYSTEM;
+import static catalog.CatalogTestUtils.CATALOG_URI;
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+import static catalog.ResolutionChecker.checkUriResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class LoadCatalogTest {
+
+    private static final String CATALOG_LOADCATALOGFILES = "loadCatalogFiles.xml";
+    private static final String CATALOG_DUMMY = "dummy.xml";
+
+    private static final String ID_ALICE = "http://remote/dtd/alice/docAlice.dtd";
+    private static final String ID_DUMMY = "http://remote/dtd/doc.dtd";
+
+    @Test(dataProvider = "entityResolver")
+    public void testMatchOnEntityResolver(CatalogResolver resolver) {
+        checkSysIdResolution(resolver, ID_ALICE,
+                "http://local/dtd/docAliceSys.dtd");
+    }
+
+    @DataProvider(name = "entityResolver")
+    private Object[][] entityResolver() {
+        return new Object[][] {
+                // This EntityResolver loads multiple catalog files one by one.
+                // All of the files are available.
+                { catalogResolver(CATALOG_PUBLIC, CATALOG_URI,
+                        CATALOG_SYSTEM) },
+
+                // This EntityResolver loads multiple catalog files one by one,
+                // but the middle one isn't existing.
+                { catalogResolver(CATALOG_PUBLIC, CATALOG_DUMMY,
+                        CATALOG_SYSTEM) } };
+    }
+
+    @Test(dataProvider = "uriResolver")
+    public void testMatchOnUriResolver(CatalogUriResolver resolver) {
+        checkUriResolution(resolver, ID_ALICE,
+                "http://local/dtd/docAliceURI.dtd");
+    }
+
+    @DataProvider(name = "uriResolver")
+    private Object[][] uriResolver() {
+        return new Object[][] {
+                // This URIResolver loads multiple catalog files one by one.
+                // All of the files are available.
+                { catalogUriResolver(CATALOG_PUBLIC, CATALOG_SYSTEM,
+                        CATALOG_URI) },
+
+                // This URIResolver loads multiple catalog files one by one,
+                // but the middle one isn't existing.
+                { catalogUriResolver(CATALOG_PUBLIC, CATALOG_DUMMY,
+                        CATALOG_URI) } };
+    }
+
+    @Test(dataProvider = "catalogName",
+            expectedExceptions = CatalogException.class)
+    public void testExceptionOnEntityResolver(String[] catalogName) {
+        catalogResolver(catalogName).resolveEntity(null, ID_DUMMY);
+    }
+
+    @Test(dataProvider = "catalogName",
+            expectedExceptions = CatalogException.class)
+    public void testExceptionOnUriResolver(String[] catalogName) {
+        catalogUriResolver(catalogName).resolve(ID_DUMMY, null);
+    }
+
+    @DataProvider(name = "catalogName")
+    private Object[][] catalogName() {
+        return new Object[][] {
+                // This catalog file set includes null catalog files.
+                { (String[]) null },
+
+                // This catalog file set includes one catalog file, but this
+                // catalog defines a non-existing next catalog.
+                { new String[] { CATALOG_LOADCATALOGFILES } } };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/NextCatalogTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,158 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkPubIdResolution;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+import static catalog.ResolutionChecker.checkUriResolution;
+
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class NextCatalogTest {
+
+    private static final String CATALOG_NEXTCATALOGLEFT
+            = "nextCatalog-left.xml";
+    private static final String CATALOG_NEXTCATALOGRIGHT
+            = "nextCatalog-right.xml";
+
+    @Test(dataProvider = "systemId-matchedUri")
+    public void testNextCatalogOnSysId(String sytemId, String matchedUri) {
+        checkSysIdResolution(createEntityResolver(), sytemId, matchedUri);
+    }
+
+    @DataProvider(name = "systemId-matchedUri")
+    private Object[][] dataOnSysId() {
+        return new Object[][] {
+                // This matched URI of the specified system id is defined in a
+                // next catalog file.
+                { "http://remote/dtd/sys/docAlice.dtd",
+                        "http://local/base/dtd/docAliceNextLeftSys.dtd" },
+
+                // There are two matches of the specified system id. One is in
+                // the current catalog file, and the other is in a next catalog
+                // file. But finally, the returned matched URI is the one in the
+                // current catalog file.
+                { "http://remote/dtd/sys/docBob.dtd",
+                        "http://local/base/dtd/docBobLeftSys.dtd" },
+
+                // The matched URI of the specified system id is defined in a
+                // two-level next catalog file.
+                { "http://remote/dtd/sys/docCarl.dtd",
+                        "http://local/base/dtd/docCarlSys.dtd" },
+
+                // Multiple catalog files, which are defined as next catalog,
+                // have the matched system entries of the specified system id.
+                // But finally, the returned matched URI is the first found.
+                { "http://remote/dtd/sys/docDuplicate.dtd",
+                        "http://local/base/dtd/docDuplicateLeftSys.dtd" } };
+    }
+
+    @Test(dataProvider = "publicId-matchedUri")
+    public void testNextCatalogOnPubId(String publicId, String matchedUri) {
+        checkPubIdResolution(createEntityResolver(), publicId, matchedUri);
+    }
+
+    @DataProvider(name = "publicId-matchedUri")
+    private Object[][] dataOnPubId() {
+        return new Object[][] {
+                // This matched URI of the specified public id is defined in a
+                // next catalog file.
+                { "-//REMOTE//DTD ALICE DOCALICE XML//EN",
+                        "http://local/base/dtd/docAliceNextLeftPub.dtd" },
+
+                // There are two matches of the specified public id. One is in
+                // the current catalog file, and the other is in a next catalog
+                // file. But finally, the returned matched URI is the one in the
+                // current catalog file.
+                { "-//REMOTE//DTD BOB DOCBOB XML//EN",
+                        "http://local/base/dtd/docBobLeftPub.dtd" },
+
+                // The matched URI of the specified public id is defined in a
+                // two-level next catalog file.
+                { "-//REMOTE//DTD CARL DOCCARL XML//EN",
+                        "http://local/base/dtd/docCarlPub.dtd" },
+
+                // Multiple catalog files, which are defined as next catalog,
+                // have the matched public entries of the specified public id.
+                // But finally, the returned matched URI is the first found.
+                { "-//REMOTE//DTD DUPLICATE DOCDUPLICATE XML//EN",
+                        "http://local/base/dtd/docDuplicateLeftPub.dtd" } };
+    }
+
+    @Test(dataProvider = "uri-matchedUri")
+    public void testNextCatalogOnUri(String uri, String matchedUri) {
+        checkUriResolution(createUriResolver(), uri, matchedUri);
+    }
+
+    @DataProvider(name = "uri-matchedUri")
+    private Object[][] dataOnUri() {
+        return new Object[][] {
+                // This matched URI of the specified URI reference is defined in
+                // a next catalog file.
+                { "http://remote/dtd/uri/docAlice.dtd",
+                        "http://local/base/dtd/docAliceNextLeftURI.dtd" },
+
+                // There are two matches of the specified URI reference. One is
+                // in the current catalog file, and the other is in a next
+                // catalog file. But finally, the returned matched URI is the
+                // one in the current catalog file.
+                { "http://remote/dtd/uri/docBob.dtd",
+                        "http://local/base/dtd/docBobLeftURI.dtd" },
+
+                // The matched URI of the specified URI reference is defined in
+                // a two-level next catalog file.
+                { "http://remote/dtd/uri/docCarl.dtd",
+                        "http://local/base/dtd/docCarlURI.dtd" },
+
+                // Multiple catalog files, which are defined as next catalog,
+                // have the matched uri entries of the specified URI reference.
+                // But finally, the returned matched URI is the first found.
+                { "http://remote/dtd/uri/docDuplicate.dtd",
+                        "http://local/base/dtd/docDuplicateLeftURI.dtd" } };
+    }
+
+    private CatalogResolver createEntityResolver() {
+        return catalogResolver(CATALOG_NEXTCATALOGLEFT,
+                CATALOG_NEXTCATALOGRIGHT);
+    }
+
+    private CatalogUriResolver createUriResolver() {
+        return catalogUriResolver(CATALOG_NEXTCATALOGLEFT,
+                CATALOG_NEXTCATALOGRIGHT);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/NormalizationTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,114 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkPubIdResolution;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+import static catalog.ResolutionChecker.checkUriResolution;
+
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class NormalizationTest {
+
+    private static final String CATALOG_NORMALIZATION = "normalization.xml";
+
+    @Test(dataProvider = "systemId_uri-matchedUri")
+    public void testNormalizationOnSysId(String sytemId, String matchedUri) {
+        checkSysIdResolution(createEntityResolver(), sytemId, matchedUri);
+    }
+
+    @Test(dataProvider = "publicId-matchedUri")
+    public void testNormalizationOnPubId(String publicId, String matchedUri) {
+        checkPubIdResolution(createEntityResolver(), publicId, matchedUri);
+    }
+
+    @Test(dataProvider = "systemId_uri-matchedUri")
+    public void testNormalizationOnUri(String uri, String matchedUri) {
+        checkUriResolution(createUriResolver(), uri, matchedUri);
+    }
+
+    @DataProvider(name = "systemId_uri-matchedUri")
+    private Object[][] dataOnSysIdAndUri() {
+        return new Object[][] {
+                // The specified system id/URI reference contains spaces. And
+                // the counterparts in system/uri entries also contain spaces.
+                { "  http://remote/dtd/alice/docAlice.dtd  ",
+                        "http://local/base/dtd/docAliceSys.dtd" },
+
+                // The specified system id/URI reference doesn't contain space.
+                // But the counterparts in system/uri entries contain spaces.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/base/dtd/docAliceSys.dtd" },
+
+                // The specified system id/URI reference contains special chars.
+                { "http://remote/dtd/bob/docBob<>\\^`{|}.dtd",
+                        "http://local/base/dtd/docBobSys.dtd" },
+
+                // The specified system identifier/uri contains normalized chars.
+                { "http://remote/dtd/bob/docBob%3C%3E%5C%5E%60%7B%7C%7D.dtd",
+                        "http://local/base/dtd/docBobSys.dtd" } };
+    }
+
+    @DataProvider(name = "publicId-matchedUri")
+    private Object[][] dataOnPubId() {
+        return new Object[][] {
+                // The specified public id contains spaces. And the counterparts
+                // in public entry also contains spaces.
+                { "   -//REMOTE//DTD    ALICE DOCALICE   XML//EN  ",
+                        "http://local/base/dtd/docAlicePub.dtd" },
+
+                // The specified public id doesn't contain space. But the
+                // counterpart in public entry contains spaces.
+                { "-//REMOTE//DTD ALICE DOCALICE XML//EN",
+                        "http://local/base/dtd/docAlicePub.dtd" },
+
+                // The specified public id contains spaces.
+                { "  -//REMOTE//DTD   BOB  DOCBOB  XML//EN",
+                        "http://local/base/dtd/docBobPub.dtd" } };
+    }
+
+    private CatalogResolver createEntityResolver() {
+        return catalogResolver(CATALOG_NORMALIZATION);
+    }
+
+    private CatalogUriResolver createUriResolver() {
+        return catalogUriResolver(CATALOG_NORMALIZATION);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferFeatureTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,79 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.PREFER_PUBLIC;
+import static catalog.CatalogTestUtils.PREFER_SYSTEM;
+import static catalog.CatalogTestUtils.catalogResolver;
+import static javax.xml.catalog.CatalogFeatures.Feature.PREFER;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class PreferFeatureTest {
+
+    @Test(dataProvider = "prefer-publicId-systemId",
+            expectedExceptions = CatalogException.class)
+    public void testPreferFeature(String prefer, String systemId,
+            String publicId) {
+        createResolver(prefer).resolveEntity(systemId, publicId);
+    }
+
+    @DataProvider(name = "prefer-publicId-systemId")
+    private 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.
+                // But the resolver cannot find the expected match, and raises a
+                // CatalogException.
+                { PREFER_SYSTEM, "-//REMOTE//DTD ALICE DOCALICE XML//EN",
+                        "http://remote/dtd/alice/docAliceDummy.dtd" },
+
+                // The feature prefer is public, and the prefer attribute of a
+                // group entry is system. There's a match for the specified
+                // public id, and no match for the specified system id. But the
+                // resolver still cannot find the expected match, and raises a
+                // CatalogException.
+                { PREFER_PUBLIC, "-//REMOTE//DTD BOB DOCBOB XML//EN",
+                         "http://remote/dtd/bob/docBobDummy.dtd"} };
+    }
+
+    private CatalogResolver createResolver(String prefer) {
+        return catalogResolver(
+                CatalogFeatures.builder().with(PREFER, prefer).build(),
+                "preferFeature.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PreferTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,91 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.ResolutionChecker.checkExtIdResolution;
+
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class PreferTest {
+
+    @Test(dataProvider = "publicId-systemId-matchedUri")
+    public void testPrefer(String publicId, String systemId,
+            String expected) {
+        checkExtIdResolution(createResolver(), publicId, systemId, expected);
+    }
+
+    @DataProvider(name = "publicId-systemId-matchedUri")
+    private 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
+                // finally, the returned URI is the system match.
+                { "-//REMOTE//DTD ALICE DOCALICE XML//EN",
+                        "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/base/dtd/docAliceSys.dtd" },
+
+                // The prefer attribute is public, and only the specified system
+                // id has match. The returned URI is the system match.
+                { "-//REMOTE//DTD ALICE DOCALICEDUMMY XML//EN",
+                        "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/base/dtd/docAliceSys.dtd"},
+
+                // The prefer attribute is public, and only the specified public
+                // id has match. The returned URI is the system match.
+                { "-//REMOTE//DTD ALICE DOCALICE XML//EN",
+                        "http://remote/dtd/alice/docAliceDummy.dtd",
+                        "http://local/base/dtd/docAlicePub.dtd" },
+
+                // The prefer attribute is system, and both of the specified
+                // system id and public id have matches. But the returned URI is
+                // the system match.
+                { "-//REMOTE//DTD BOB DOCBOB XML//EN",
+                        "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/docBobSys.dtd" },
+
+                // The prefer attribute is system, and only system id has match.
+                // The returned URI is the system match.
+                { "-//REMOTE//DTD BOB DOCBOBDUMMY XML//EN",
+                        "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/docBobSys.dtd" } };
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver("prefer.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicFamilyTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,69 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkPubIdResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class PublicFamilyTest {
+
+    /*
+     * Gets the best match from public and delegatePublic entries.
+     * The match in public entry is prior to the match in delegatePublic entry.
+     */
+    @Test
+    public void testMatch() {
+        checkPubIdResolution(createResolver(),
+                "-//REMOTE//DTD ALICE DOCALICE XML//EN",
+                "http://local/base/dtd/docAlicePub.dtd");
+    }
+
+    /*
+     * If no match is found, a CatalogException should be thrown.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testNoMatched() {
+        checkNoMatch(createResolver());
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver("publicFamily.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/PublicTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,91 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.CATALOG_PUBLIC;
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkPubIdResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary Get matched URIs from public entries.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class PublicTest {
+
+    @Test(dataProvider = "publicId-matchedUri")
+    public void testPublic(String publicId, String matchedUri) {
+        checkPubIdResolution(createResolver(), publicId, matchedUri);
+    }
+
+    @DataProvider(name = "publicId-matchedUri")
+    public Object[][] data() {
+        return new Object[][] {
+                // The matched URI of the specified public id is defined in a
+                // public entry. The match is an absolute path.
+                { "-//REMOTE//DTD ALICE DOCALICE XML//EN",
+                        "http://local/dtd/docAlicePub.dtd" },
+
+                // The matched URI of the specified public id is defined in a
+                // public entry. But the match isn't an absolute path, so the
+                // returned URI should include the base, which is defined by the
+                // catalog file, as the prefix.
+                { "-//REMOTE//DTD BOB DOCBOB XML//EN",
+                        "http://local/base/dtd/docBobPub.dtd" },
+
+                // The matched URI of the specified public id is defined in a
+                // public entry. The match isn't an absolute path, and the
+                // public entry defines alternative base. So the returned URI
+                // should include the alternative base.
+                { "-//REMOTE//DTD CARL DOCCARL XML//EN",
+                        "http://local/carlBase/dtd/docCarlPub.dtd" },
+
+                // The catalog file defines two public entries, and both of them
+                // match the specified public id. But the first matched URI
+                // should be returned.
+                { "-//REMOTE//DTD DAVID DOCDAVID XML//EN",
+                        "http://local/base/dtd/docDavidPub1.dtd" } };
+    }
+
+    /*
+     * If no match is found, a CatalogException should be thrown.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testNoMatch() {
+        checkNoMatch(createResolver());
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver(CATALOG_PUBLIC);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/ResolveFeatureTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,130 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.CATALOG_SYSTEM;
+import static catalog.CatalogTestUtils.CATALOG_URI;
+import static catalog.CatalogTestUtils.RESOLVE_CONTINUE;
+import static catalog.CatalogTestUtils.RESOLVE_IGNORE;
+import static catalog.CatalogTestUtils.RESOLVE_STRICT;
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+import static catalog.ResolutionChecker.checkUriResolution;
+import static javax.xml.catalog.CatalogFeatures.builder;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogFeatures.Feature;
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary This case tests how does resolve feature affect the catalog
+ *          resolution.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class ResolveFeatureTest {
+
+    /*
+     * For strict external identifier resolution, if no match is found,
+     * it should throw CatalogException.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testStrictResolutionOnEntityResolver() {
+        createEntityResolver(RESOLVE_STRICT).resolveEntity(null,
+                "http://remote/dtd/alice/docAliceDummy.dtd");
+    }
+
+    /*
+     * For strict URI reference resolution, if no match is found,
+     * it should throw CatalogException.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testStrictResolutionOnUriResolver() {
+        createUriResolver(RESOLVE_STRICT).resolve(
+                "http://remote/dtd/alice/docAliceDummy.dtd", null);
+    }
+
+    /*
+     * For continue external identifier resolution, if no match is found,
+     * it should continue the process.
+     */
+    @Test
+    public void testContinueResolutionOnEntityResolver() {
+        CatalogResolver resolver = createEntityResolver(RESOLVE_CONTINUE);
+        resolver.resolveEntity(null, "http://remote/dtd/bob/docBobDummy.dtd");
+        checkSysIdResolution(resolver, "http://remote/dtd/bob/docBob.dtd",
+                "http://local/base/dtd/docBobSys.dtd");
+    }
+
+    /*
+     * For continue URI reference resolution, if no match is found,
+     * it should continue the process.
+     */
+    @Test
+    public void testContinueResolutionOnUriResolver() {
+        CatalogUriResolver resolver = createUriResolver(RESOLVE_CONTINUE);
+        resolver.resolve("http://remote/dtd/bob/docBobDummy.dtd", null);
+        checkUriResolution(resolver, "http://remote/dtd/bob/docBob.dtd",
+                "http://local/base/dtd/docBobURI.dtd");
+    }
+
+    /*
+     * For ignore external identifier resolution, if no match is found,
+     * it should break the process and return null.
+     */
+    @Test
+    public void testIgnoreResolutionOnEntityResolver() {
+        checkSysIdResolution(createEntityResolver(RESOLVE_IGNORE),
+                "http://remote/dtd/carl/docCarlDummy.dtd", null);
+    }
+
+    /*
+     * For ignore URI reference resolution, if no match is found,
+     * it should break the process and return null.
+     */
+    @Test
+    public void testIgnoreResolutionOnUriResolver() {
+        checkUriResolution(createUriResolver(RESOLVE_IGNORE),
+                "http://remote/dtd/carl/docCarlDummy.dtd", null);
+    }
+
+    private CatalogResolver createEntityResolver(String resolve) {
+        return catalogResolver(createFeature(resolve), CATALOG_SYSTEM);
+    }
+
+    private CatalogUriResolver createUriResolver(String resolve) {
+        return catalogUriResolver(createFeature(resolve), CATALOG_URI);
+    }
+
+    private CatalogFeatures createFeature(String resolve) {
+        return builder().with(Feature.RESOLVE, resolve).build();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteSystemTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,94 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary Get matched URIs from rewriteSystem entries.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class RewriteSystemTest {
+
+    @Test(dataProvider = "systemId-matchedUri")
+    public void testMatch(String systemId, String matchedUri) {
+        checkSysIdResolution(createResolver(), systemId, matchedUri);
+    }
+
+    @DataProvider(name = "systemId-matchedUri")
+    public Object[][] dataOnMatch() {
+        return new Object[][] {
+                // The matched URI of the specified system id is defined in a
+                // rewriteSystem entry. The match is an absolute path.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/dtd/alice/rs/docAlice.dtd" },
+
+                // The matched URI of the specified system id is defined in a
+                // rewriteSystem entry. The match isn't an absolute path.
+                { "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/bob/rs/docBob.dtd" },
+
+                // The matched URI of the specified system id is defined in a
+                // rewriteSystem entry. The match isn't an absolute path, and
+                // the rewriteSystem entry defines alternative base. So the
+                // returned URI should include the alternative base.
+                { "http://remote/dtd/carl/docCarl.dtd",
+                        "http://local/carlBase/dtd/carl/rs/docCarl.dtd" },
+
+                // The catalog file defines two rewriteSystem entries, and both
+                // of them match the specified system id. But the first matched
+                // URI should be returned.
+                { "http://remote/dtd/david/docDavid.dtd",
+                        "http://local/base/dtd/david1/rs/docDavid.dtd" },
+
+                // The catalog file defines two rewriteSystem entries, and both
+                // of them match the specified system id. But the longest match
+                // should be used.
+                { "http://remote/dtd/ella/docElla.dtd",
+                        "http://local/base/dtd/ella/rs/docElla.dtd" } };
+    }
+
+    /*
+     * If no match is found, a CatalogException should be thrown.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testNoMatch() {
+        checkNoMatch(createResolver());
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver("rewriteSystem.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/RewriteUriTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,94 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkUriResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary Get matched URIs from rewriteURI entries.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class RewriteUriTest {
+
+    @Test(dataProvider = "uri-matchedUri")
+    public void testMatch(String uri, String matchedUri) {
+        checkUriResolution(createResolver(), uri, matchedUri);
+    }
+
+    @DataProvider(name = "uri-matchedUri")
+    public Object[][] dataOnMatch() {
+        return new Object[][] {
+                // The matched URI of the specified URI reference is defined in
+                // a rewriteURI entry. The match is an absolute path.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/dtd/alice/ru/docAlice.dtd" },
+
+                // The matched URI of the specified URI reference is defined in
+                // a rewriteURI entry. The match isn't an absolute path.
+                { "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/bob/ru/docBob.dtd" },
+
+                // The matched URI of the specified URI reference is defined in
+                // a rewriteURI entry. The match isn't an absolute path, and the
+                // rewriteURI entry defines alternative base. So the returned
+                // URI should include the alternative base.
+                { "http://remote/dtd/carl/docCarl.dtd",
+                        "http://local/carlBase/dtd/carl/ru/docCarl.dtd" },
+
+                // The catalog file defines two rewriteURI entries, and both of
+                // them match the specified URI reference. But the first matched
+                // URI should be returned.
+                { "http://remote/dtd/david/docDavid.dtd",
+                        "http://local/base/dtd/david1/ru/docDavid.dtd" },
+
+                // The catalog file defines two rewriteURI entries, and both
+                // of them match the specified URI reference. But the longest
+                // match should be used.
+                { "http://remote/dtd/ella/docElla.dtd",
+                        "http://local/base/dtd/ella/ru/docElla.dtd" } };
+    }
+
+    /*
+     * If no match is found, a CatalogException should be thrown.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testNoMatch() {
+        checkNoMatch(createResolver());
+    }
+
+    private CatalogUriResolver createResolver() {
+        return catalogUriResolver("rewriteUri.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,108 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.FEATURE_FILES;
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.CatalogTestUtils.getCatalogPath;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+import static catalog.ResolutionChecker.checkUriResolution;
+import static javax.xml.catalog.CatalogFeatures.builder;
+import static javax.xml.catalog.CatalogFeatures.Feature.FILES;
+
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary This case tests how to specify the catalog files.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class SpecifyCatalogTest {
+
+    private static final String ID_URI = "http://remote/dtd/uri/doc.dtd";
+    private static final String ID_SYS = "http://remote/dtd/sys/doc.dtd";
+
+    private static final CatalogFeatures FILES_FEATURE = createFeature(
+            "specifyCatalog-feature.xml");
+
+    /*
+     * CatalogResolver specifies catalog via feature javax.xml.catalog.files.
+     */
+    @Test
+    public void specifyCatalogOnEntityResolver() {
+        checkSysIdResolution(catalogResolver(FILES_FEATURE, (String[]) null),
+                ID_SYS, "http://local/base/dtd/docFeatureSys.dtd");
+    }
+
+    /*
+     * CatalogUriResolver specifies catalog via feature javax.xml.catalog.files.
+     */
+    @Test
+    public void specifyCatalogOnUriResolver() {
+        checkUriResolution(catalogUriResolver(FILES_FEATURE, (String[]) null),
+                ID_URI, "http://local/base/dtd/docFeatureURI.dtd");
+    }
+
+    /*
+     * Resolver specifies catalog via system property javax.xml.catalog.files.
+     */
+    @Test
+    public void specifyCatalogViaSysProps() {
+        System.setProperty(FEATURE_FILES,
+                getCatalogPath("specifyCatalog-sysProps.xml"));
+
+        checkResolutionOnEntityResolver(catalogResolver((String[]) null),
+                "http://local/base/dtd/docSysPropsSys.dtd");
+        checkResolutionOnEntityResolver(
+                catalogResolver(FILES_FEATURE, "specifyCatalog-api.xml"),
+                "http://local/base/dtd/docAPISys.dtd");
+
+        checkResolutionOnUriResolver(catalogUriResolver((String[]) null),
+                "http://local/base/dtd/docSysPropsURI.dtd");
+        checkResolutionOnUriResolver(
+                catalogUriResolver(FILES_FEATURE, "specifyCatalog-api.xml"),
+                "http://local/base/dtd/docAPIURI.dtd");
+    }
+
+    private void checkResolutionOnEntityResolver(CatalogResolver resolver,
+            String matchedUri) {
+        checkSysIdResolution(resolver, ID_SYS, matchedUri);
+    }
+
+    private void checkResolutionOnUriResolver(CatalogUriResolver resolver,
+            String matchedUri) {
+        checkUriResolution(resolver, ID_URI, matchedUri);
+    }
+
+    private static CatalogFeatures createFeature(String catalogName) {
+        return builder().with(FILES, getCatalogPath(catalogName)).build();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemFamilyTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,83 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class SystemFamilyTest {
+
+    @Test(dataProvider = "systemId-matchedUri")
+    public void testMatch(String systemId, String matchedUri) {
+        checkSysIdResolution(createResolver(), systemId, matchedUri);
+    }
+
+    @DataProvider(name = "systemId-matchedUri")
+    public Object[][] dataOnMatch() {
+        return new Object[][] {
+                // The matched URI of the specified system id is defined in a
+                // system entry.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/base/dtd/docAliceSys.dtd" },
+
+                // The matched URI of the specified system id is defined in a
+                // rewriteSystem entry.
+                { "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/rs/docBob.dtd" },
+
+                // The matched URI of the specified system id is defined in a
+                // systemSuffix entry.
+                { "http://remote/dtd/carl/docCarl.dtd",
+                         "http://local/base/dtd/docCarlSS.dtd" } };
+    }
+
+    /*
+     * If no match is found, a CatalogException should be thrown.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testNoMatch() {
+        checkNoMatch(createResolver());
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver("systemFamily.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemSuffixTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,94 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary Get matched URIs from systemSuffix entries.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class SystemSuffixTest {
+
+    @Test(dataProvider = "systemId-matchedUri")
+    public void testMatch(String systemId, String matchedUri) {
+        checkSysIdResolution(createResolver(), systemId, matchedUri);
+    }
+
+    @DataProvider(name = "systemId-matchedUri")
+    public Object[][] dataOnMatch() {
+        return new Object[][] {
+                // The matched URI of the specified system id is defined in a
+                // systemIdSuffix entry. The match is an absolute path.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/dtd/docAliceSS.dtd" },
+
+                // The matched URI of the specified system id is defined in a
+                // systemIdSuffix entry. The match isn't an absolute path.
+                { "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/docBobSS.dtd" },
+
+                // The matched URI of the specified system id is defined in a
+                // systemIdSuffix entry. The match isn't an absolute path, and
+                // the systemIdSuffix entry defines alternative base. So the
+                // returned URI should include the alternative base.
+                { "http://remote/dtd/carl/cdocCarl.dtd",
+                        "http://local/carlBase/dtd/docCarlSS.dtd" },
+
+                // The catalog file defines two systemIdSuffix entries, and both
+                // of them match the specified system id. But the first matched
+                // URI should be returned.
+                { "http://remote/dtd/david/docDavid.dtd",
+                        "http://local/base/dtd/docDavidSS1.dtd" },
+
+                // The catalog file defines two systemIdSuffix entries, and both
+                // of them match the specified system id. But the longest match
+                // should be used.
+                { "http://remote/dtd/ella/docElla.dtd",
+                        "http://local/base/dtd/docEllaSS.dtd" } };
+    }
+
+    /*
+     * If no match is found, a CatalogException should be thrown.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testNoMatch() {
+        checkNoMatch(createResolver());
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver("systemSuffix.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SystemTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,91 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.CATALOG_SYSTEM;
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary Get matched URIs from system entries.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class SystemTest {
+
+    @Test(dataProvider = "systemId-matchedUri")
+    public void testMatch(String systemId, String matchedUri) {
+        checkSysIdResolution(createResolver(), systemId, matchedUri);
+    }
+
+    @DataProvider(name = "systemId-matchedUri")
+    public Object[][] dataOnMatch() {
+        return new Object[][] {
+                // The matched URI of the specified system id is defined in a
+                // system entry. The match is an absolute path.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/dtd/docAliceSys.dtd" },
+
+                // The matched URI of the specified system id is defined in a
+                // public entry. But the match isn't an absolute path, so the
+                // returned URI should include the base, which is defined by the
+                // catalog file, as the prefix.
+                { "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/docBobSys.dtd" },
+
+                // The matched URI of the specified system id is defined in a
+                // system entry. The match isn't an absolute path, and the
+                // system entry defines alternative base. So the returned URI
+                // should include the alternative base.
+                { "http://remote/dtd/carl/docCarl.dtd",
+                        "http://local/carlBase/dtd/docCarlSys.dtd" },
+
+                // The catalog file defines two system entries, and both of them
+                // match the specified system id. But the first matched URI
+                // should be returned.
+                { "http://remote/dtd/david/docDavid.dtd",
+                        "http://local/base/dtd/docDavidSys1.dtd" } };
+    }
+
+    /*
+     * If no match is found, a CatalogException should be thrown.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testNoMatch() {
+        checkNoMatch(createResolver());
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver(CATALOG_SYSTEM);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriFamilyTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,83 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkUriResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class UriFamilyTest {
+
+    @Test(dataProvider = "uri-matchedUri")
+    public void testMatch(String systemId, String matchedUri) {
+        checkUriResolution(createResolver(), systemId, matchedUri);
+    }
+
+    @DataProvider(name = "uri-matchedUri")
+    public Object[][] dataOnMatch() {
+        return new Object[][] {
+                // The matched URI of the specified URI reference is defined in
+                // a uri entry.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/base/dtd/docAliceURI.dtd" },
+
+                // The matched URI of the specified URI reference is defined in
+                // a rewriteURI entry.
+                { "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/ru/docBob.dtd" },
+
+                // The matched URI of the specified URI reference is defined in
+                // a uriSuffix entry.
+                { "http://remote/dtd/carl/docCarl.dtd",
+                        "http://local/base/dtd/docCarlUS.dtd" } };
+    }
+
+    /*
+     * If no match is found, a CatalogException should be thrown.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testNoMatch() {
+        checkNoMatch(createResolver());
+    }
+
+    private CatalogUriResolver createResolver() {
+        return catalogUriResolver("uriFamily.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriSuffixTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,94 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkUriResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary Get matched URIs from rewriteURI entries.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class UriSuffixTest {
+
+    @Test(dataProvider = "uri-matchedUri")
+    public void testMatch(String uri, String matchedUri) {
+        checkUriResolution(createResolver(), uri, matchedUri);
+    }
+
+    @DataProvider(name = "uri-matchedUri")
+    public Object[][] dataOnMatch() {
+        return new Object[][] {
+                // The matched URI of the specified URI reference is defined in
+                // a uriSuffix entry. The match is an absolute path.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/dtd/docAliceUS.dtd" },
+
+                // The matched URI of the specified URI reference is defined in
+                // a uriSuffix entry. The match isn't an absolute path.
+                { "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/docBobUS.dtd" },
+
+                // The matched URI of the specified URI reference is defined in
+                // a uriSuffix entry. The match isn't an absolute path, and the
+                // uriSuffix entry defines alternative base. So the returned
+                // URI should include the alternative base.
+                { "http://remote/dtd/carl/cdocCarl.dtd",
+                        "http://local/carlBase/dtd/docCarlUS.dtd" },
+
+                // The catalog file defines two uriSuffix entries, and both of
+                // them match the specified URI reference. But the first matched
+                // URI should be returned.
+                { "http://remote/dtd/david/docDavid.dtd",
+                        "http://local/base/dtd/docDavidUS1.dtd" },
+
+                // The catalog file defines two uriSuffix entries, and both
+                // of them match the specified URI reference. But the longest
+                // match should be used.
+                { "http://remote/dtd/ella/docElla.dtd",
+                        "http://local/base/dtd/docEllaUS.dtd" } };
+    }
+
+    /*
+     * If no match is found, a CatalogException should be thrown.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testNoMatch() {
+        checkNoMatch(createResolver());
+    }
+
+    private CatalogUriResolver createResolver() {
+        return catalogUriResolver("uriSuffix.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UriTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,103 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.CATALOG_URI;
+import static catalog.CatalogTestUtils.RESOLVE_CONTINUE;
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkNoMatch;
+import static catalog.ResolutionChecker.checkUriResolution;
+
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @summary Get matched URIs from uri entries.
+ * @compile ../../libs/catalog/CatalogTestUtils.java
+ * @compile ../../libs/catalog/ResolutionChecker.java
+ */
+public class UriTest {
+
+    @Test(dataProvider = "uri-matchedUri")
+    public void testMatch(String uri, String matchedUri) {
+        checkUriResolution(createResolver(), uri, matchedUri);
+    }
+
+    @DataProvider(name = "uri-matchedUri")
+    public Object[][] dataOnMatch() {
+        return new Object[][] {
+                // The matched URI of the specified URI reference is defined in
+                // a uri entry. The match is an absolute path.
+                { "http://remote/dtd/alice/docAlice.dtd",
+                        "http://local/dtd/docAliceURI.dtd" },
+
+                // The matched URI of the specified URI reference is defined in
+                // a uri entry. But the match isn't an absolute path, so the
+                // returned URI should include the base, which is defined by the
+                // catalog file, as the prefix.
+                { "http://remote/dtd/bob/docBob.dtd",
+                        "http://local/base/dtd/docBobURI.dtd" },
+
+                // The catalog file defines two uri entries, and both of them
+                // match the specified URI reference. But the first matched URI
+                // should be returned.
+                { "http://remote/dtd/david/docDavid.dtd",
+                        "http://local/base/dtd/docDavidURI1.dtd" } };
+    }
+
+    /*
+     * Specify base location via method CatalogUriResolver.resolve(href, base).
+     */
+    @Test
+    public void testSpecifyBaseByAPI() {
+        checkUriResolution(createResolver(),
+                "http://remote/dtd/carl/docCarl.dtd",
+                "http://local/carlBase/dtd/docCarlURI.dtd");
+
+        CatalogUriResolver continueResolver = catalogUriResolver(
+                CatalogFeatures.builder().with(CatalogFeatures.Feature.RESOLVE,
+                        RESOLVE_CONTINUE).build(), CATALOG_URI);
+        checkUriResolution(continueResolver, "docCarl.dtd",
+                "http://local/alternativeBase/dtd/",
+                "http://local/alternativeBase/dtd/docCarl.dtd");
+    }
+
+    /*
+     * If no match is found, a CatalogException should be thrown.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void testNoMatch() {
+        checkNoMatch(createResolver());
+    }
+
+    private CatalogUriResolver createResolver() {
+        return catalogUriResolver(CATALOG_URI);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/UrnUnwrappingTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,66 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.ResolutionChecker.checkPubIdResolution;
+
+import javax.xml.catalog.CatalogResolver;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class UrnUnwrappingTest {
+
+    @Test(dataProvider = "urn-matchedUri")
+    public void testUnwrapping(String urn, String matchedUri) {
+        checkPubIdResolution(createResolver(), urn, matchedUri);
+    }
+
+    @DataProvider(name = "urn-matchedUri")
+    private Object[][] data() {
+        return new Object[][] {
+                // The specified public id is URN format.
+                { "urn:publicid:-:REMOTE:DTD+ALICE+DOCALICE+XML:EN",
+                        "http://local/base/dtd/docAlicePub.dtd" },
+
+                // The specified public id includes some special URN chars.
+                { "urn:publicid:-:REMOTE:DTD+BOB+DOCBOB+;+%2B+%3A+%2F+%3B+%27"
+                        + "+%3F+%23+%25:EN",
+                        "http://local/base/dtd/docBobPub.dtd" } };
+    }
+
+    private CatalogResolver createResolver() {
+        return catalogResolver("urnUnwrapping.xml");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/ValidateCatalogTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,101 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.CATALOG_SYSTEM;
+import static catalog.CatalogTestUtils.CATALOG_URI;
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.ResolutionChecker.checkSysIdResolution;
+import static catalog.ResolutionChecker.checkUriResolution;
+
+import javax.xml.catalog.CatalogException;
+
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8077931
+ * @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
+ */
+public class ValidateCatalogTest {
+
+    private static final String CATALOG_WRONGROOT = "validateCatalog-wrongRoot.xml";
+    private static final String CATALOG_MALFORMED = "validateCatalog-malformed.xml";
+
+    /*
+     * EntityResolver tries to load catalog with wrong root,
+     * it should throw CatalogException.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void validateWrongRootCatalogOnEntityResolver() {
+        catalogResolver(CATALOG_WRONGROOT);
+    }
+
+    /*
+     * URIResolver tries to load catalog with wrong root,
+     * it should throw CatalogException.
+     */
+    @Test(expectedExceptions = CatalogException.class)
+    public void validateWrongRootCatalogOnUriResolver() {
+        catalogUriResolver(CATALOG_WRONGROOT);
+    }
+
+    /*
+     * EntityResolver tries to load malformed catalog,
+     * it should throw RuntimeException.
+     */
+    @Test(expectedExceptions = RuntimeException.class)
+    public void validateMalformedCatalogOnEntityResolver() {
+        catalogResolver(CATALOG_MALFORMED);
+    }
+
+    /*
+     * UriResolver tries to load malformed catalog,
+     * it should throw RuntimeException.
+     */
+    @Test(expectedExceptions = RuntimeException.class)
+    public void validateMalformedCatalogOnUriResolver() {
+        catalogUriResolver(CATALOG_MALFORMED);
+    }
+
+    /*
+     * Resolver should ignore the catalog which doesn't declare the correct
+     * naming space.
+     */
+    @Test
+    public void validateWrongNamingSpaceCatalog() {
+        String catalogName = "validateCatalog-noNamingSpace.xml";
+        checkSysIdResolution(catalogResolver(catalogName, CATALOG_SYSTEM),
+                "http://remote/dtd/alice/docAlice.dtd",
+                "http://local/dtd/docAliceSys.dtd");
+        checkUriResolution(catalogUriResolver(catalogName, CATALOG_URI),
+                "http://remote/dtd/alice/docAlice.dtd",
+                "http://local/dtd/docAliceURI.dtd");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/catalogReferCircle-itself.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <nextCatalog catalog="catalogReferCircle-itself.xml" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/catalogReferCircle-left.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <nextCatalog catalog="catalogReferCircle-right.xml" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/catalogReferCircle-right.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <nextCatalog catalog="catalogReferCircle-left.xml" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/deferFeature.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <system systemId="http://remote/dtd/alice/docAlice.dtd" uri="http://local/dtd/docAliceSys.dtd" />
+    <uri name="http://remote/dtd/alice/docAlice.dtd" uri="http://local/dtd/docAliceURI.dtd" />
+
+    <delegateSystem systemIdStartString="http://remote/dtd/alice/" catalog="delegateSystem-alice.xml" />
+    <delegatePublic publicIdStartString="-//REMOTE//DTD ALICE DOCALICE" catalog="delegatePublic-alice.xml" />
+    <nextCatalog catalog="nextCatalog-rightAlice.xml" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegatePublic-alice.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <public publicId="-//REMOTE//DTD ALICE DOCALICE XML//EN" uri="http://local/dtd/docAlicePub.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegatePublic-bob.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/bob/">
+    <public publicId="-//REMOTE//DTD BOB DOCBOB XML//EN" uri="docBobPub.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegatePublic-carl.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/carl/">
+    <public publicId="-//REMOTE//DTD CARL DOCCARL XML//EN" uri="docCarlPub.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegatePublic.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <delegatePublic publicIdStartString="-//REMOTE//DTD ALICE DOCALICE" catalog="delegatePublic-alice.xml" />
+
+    <!-- delegateSystem-bobDummy.xml is not existing -->
+    <delegatePublic publicIdStartString="-//REMOTE//DTD BOB DOCBOB" catalog="delegatePublic-bob.xml" />
+    <delegatePublic publicIdStartString="-//REMOTE//DTD BOB DOCBOB" catalog="delegatePublic-bobDummy.xml" />
+
+    <!-- delegateSystem-carlDummy.xml is not existing -->
+    <delegatePublic publicIdStartString="-//REMOTE//DTD CARL DOCCARL" catalog="delegatePublic-carlDummy.xml" />
+    <delegatePublic publicIdStartString="-//REMOTE//DTD CARL DOCCARL XML" catalog="delegatePublic-carl.xml" />
+
+    <!-- delegateSystem-david.xml is not existing -->
+    <delegatePublic publicIdStartString="-//REMOTE//DTD DAVID DOCDAVID" catalog="delegatePublic-david.xml" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateSystem-alice.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/alice/">
+    <system systemId="http://remote/dtd/alice/docAlice.dtd" uri="docAliceDS.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateSystem-bob.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/bob/">
+    <system systemId="http://remote/dtd/bob/docBob.dtd" uri="docBobDS.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateSystem-carl.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/carl/">
+    <system systemId="http://remote/dtd/carl/docCarl.dtd" uri="docCarlDS.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateSystem.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <delegateSystem systemIdStartString="http://remote/dtd/alice/" catalog="delegateSystem-alice.xml" />
+
+    <!-- delegateSystem-bobDummy.xml is not existing -->
+    <delegateSystem systemIdStartString="http://remote/dtd/" catalog="delegateSystem-bobDummy.xml" />
+    <delegateSystem systemIdStartString="http://remote/dtd/bob/" catalog="delegateSystem-bob.xml" />
+
+    <!-- delegateSystem-carlDummy.xml is not existing -->
+    <delegateSystem systemIdStartString="http://remote/dtd/carl/" catalog="delegateSystem-carl.xml" />
+    <delegateSystem systemIdStartString="http://remote/dtd/carl/" catalog="delegateSystem-carlDummy.xml" />
+
+    <!-- delegateSystem-carlDummy.xml is not existing -->
+    <delegateSystem systemIdStartString="http://remote/dtd/david/" catalog="delegateSystem-davidDummy.xml" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateUri-alice.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/alice/">
+    <uri name="http://remote/dtd/alice/docAlice.dtd" uri="docAliceDU.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateUri-bob.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/bob/">
+    <uri name="http://remote/dtd/bob/docBob.dtd" uri="docBobDU.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateUri-carl.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/carl/">
+    <uri name="http://remote/dtd/carl/docCarl.dtd" uri="docCarlDU.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/delegateUri.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <delegateURI uriStartString="http://remote/dtd/alice/" catalog="delegateUri-alice.xml" />
+
+    <delegateURI uriStartString="http://remote/dtd/" catalog="delegateUri-bobDummy.xml" />
+    <delegateURI uriStartString="http://remote/dtd/bob/" catalog="delegateUri-bob.xml" />
+
+    <delegateURI uriStartString="http://remote/dtd/carl/" catalog="delegateUri-carl.xml" />
+    <delegateURI uriStartString="http://remote/dtd/carl/" catalog="delegateUri-carlDummy.xml" />
+
+    <delegateURI uriStartString="http://remote/dtd/david/" catalog="delegateUri-davidDummy.xml" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/group.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <group>
+        <system systemId="http://remote/dtd/sys/alice/docAlice.dtd" uri="docAliceSys.dtd" />
+        <public publicId="-//REMOTE//DTD ALICE DOCALICE XML//EN" uri="docAlicePub.dtd" />
+        <uri name="http://remote/dtd/uri/alice/docAlice.dtd" uri="docAliceURI.dtd" />
+    </group>
+
+    <group xml:base="http://local/bobBase/dtd/">
+        <system systemId="http://remote/dtd/sys/bob/docBob.dtd" uri="docBobSys.dtd" />
+        <public publicId="-//REMOTE//DTD BOB DOCBOB XML//EN" uri="docBobPub.dtd" />
+        <uri name="http://remote/dtd/uri/bob/docBob.dtd" uri="docBobURI.dtd" />
+    </group>
+
+    <system systemId="http://remote/dtd/sys/carl/docCarl.dtd" uri="docCarlSys1.dtd" />
+    <public publicId="-//REMOTE//DTD CARL DOCCARL XML//EN" uri="docCarlPub1.dtd" />
+    <uri name="http://remote/dtd/uri/carl/docCarl.dtd" uri="docCarlURI1.dtd" />
+    <group>
+        <system systemId="http://remote/dtd/sys/carl/docCarl.dtd" uri="docCarlSys2.dtd" />
+        <public publicId="-//REMOTE//DTD CARL DOCCARL XML//EN" uri="docCarlPub2.dtd" />
+        <uri name="http://remote/dtd/uri/carl/docCarl.dtd" uri="docCarlURI2.dtd" />
+    </group>
+    <system systemId="http://remote/dtd/sys/carl/docCarl.dtd" uri="docCarlSys3.dtd" />
+    <public publicId="-//REMOTE//DTD CARL DOCCARL XML//EN" uri="docCarlPub3.dtd" />
+    <uri name="http://remote/dtd/uri/carl/docCarl.dtd" uri="docCarlURI3.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/loadCatalogFiles.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catalog
+  PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN"
+         "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <nextCatalog catalog="nextCatalog-dummy.xml" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-left.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <nextCatalog catalog="nextCatalog-leftAlice.xml" />
+
+    <nextCatalog catalog="nextCatalog-leftBob.xml" />
+    <group xml:base="http://local/base/dtd/">
+        <system systemId="http://remote/dtd/sys/docBob.dtd" uri="docBobLeftSys.dtd" />
+        <public publicId="-//REMOTE//DTD BOB DOCBOB XML//EN" uri="docBobLeftPub.dtd" />
+        <uri name="http://remote/dtd/uri/docBob.dtd" uri="docBobLeftURI.dtd" />
+    </group>
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-leftAlice.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId="http://remote/dtd/sys/docAlice.dtd" uri="docAliceNextLeftSys.dtd" />
+    <public publicId="-//REMOTE//DTD ALICE DOCALICE XML//EN" uri="docAliceNextLeftPub.dtd" />
+    <uri name="http://remote/dtd/uri/docAlice.dtd" uri="docAliceNextLeftURI.dtd" />
+
+    <system systemId="http://remote/dtd/sys/docDuplicate.dtd" uri="docDuplicateLeftSys.dtd" />
+    <public publicId="-//REMOTE//DTD DUPLICATE DOCDUPLICATE XML//EN" uri="docDuplicateLeftPub.dtd" />
+    <uri name="http://remote/dtd/uri/docDuplicate.dtd" uri="docDuplicateLeftURI.dtd" />
+
+    <systemSuffix systemIdSuffix="ss/doc.dtd" uri="docSSShorter.dtd" />
+    <rewriteSystem systemIdStartString="http://remote/dtd/rs/" rewritePrefix="http://local/base/dtd/rsShorter/" />
+    <uriSuffix uriSuffix="us/doc.dtd" uri="docUSShorter.dtd" />
+    <rewriteURI uriStartString="http://remote/dtd/ru/" rewritePrefix="http://local/base/dtd/ruShorter/" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-leftBob.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <group xml:base="http://local/base/dtd/">
+        <system systemId="http://remote/dtd/sys/docBob.dtd" uri="docBobNextLeftSys.dtd" />
+        <public publicId="-//REMOTE//DTD BOB DOCBOB XML//EN" uri="docBobNextLeftPub.dtd" />
+        <uri name="http://remote/dtd/uri/docAlice.dtd" uri="docAliceNextLeftURI.dtd" />
+    </group>
+
+    <nextCatalog catalog="nextCatalog-leftCarl.xml" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-leftCarl.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId="http://remote/dtd/sys/docCarl.dtd" uri="docCarlSys.dtd" />
+    <public publicId="-//REMOTE//DTD CARL DOCCARL XML//EN" uri="docCarlPub.dtd" />
+    <uri name="http://remote/dtd/uri/docCarl.dtd" uri="docCarlURI.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-right.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <nextCatalog catalog="nextCatalog-rightAlice.xml" />
+
+    <nextCatalog catalog="nextCatalog-rightAlice.xml" />
+    <group xml:base="http://local/base/dtd/">
+        <system systemId="http://remote/dtd/sys/docBob.dtd" uri="docBobLeftSys.dtd" />
+        <public publicId="-//REMOTE//DTD BOB DOCBOB XML//EN" uri="docBobLeftPub.dtd" />
+        <uri name="http://remote/dtd/uri/docBob.dtd" uri="docBobLeftURI.dtd" />
+    </group>
+
+    <system systemId="http://remote/dtd/sys/docDuplicate.dtd" uri="docDuplicateRightSys.dtd" />
+    <public publicId="-//REMOTE//DTD DUPLICATE DOCDUPLICATE XML//EN" uri="docDuplicateRightPub.dtd" />
+    <uri name="http://remote/dtd/uri/docDuplicate.dtd" uri="docDuplicateRightURI.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-rightAlice.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId="http://remote/dtd/sys/docAlice.dtd" uri="docAliceNextRightSys.dtd" />
+    <public publicId="-//REMOTE//DTD ALICE DOCALICE XML//EN" uri="docAliceNextRightPub.dtd" />
+    <uri name="http://remote/dtd/uri/docAlice.dtd" uri="docAliceNextRightURI.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/nextCatalog-rightBob.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId="http://remote/dtd/sys/docBob.dtd" uri="docBobNextRightSys.dtd" />
+    <public publicId="-//REMOTE//DTD BOB DOCBOB XML//EN" uri="docBobNextRightPub.dtd" />
+    <uri name="http://remote/dtd/uri/docAlice.dtd" uri="docAliceNextRightURI.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/normalization.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId=" http://remote/dtd/alice/docAlice.dtd " uri="docAliceSys.dtd" />
+    <system systemId="http://remote/dtd/bob/docBob&lt;&gt;\^`{|}.dtd" uri="docBobSys.dtd" />
+
+    <uri name=" http://remote/dtd/alice/docAlice.dtd " uri="docAliceSys.dtd" />
+    <uri name="http://remote/dtd/bob/docBob&lt;&gt;\^`{|}.dtd" uri="docBobSys.dtd" />
+
+    <public publicId=" -//REMOTE//DTD  ALICE DOCALICE XML//EN " uri="docAlicePub.dtd" />
+    <public publicId="-//REMOTE//DTD BOB DOCBOB XML//EN" uri="docBobPub.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/prefer.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <group prefer="public">
+        <system systemId="http://remote/dtd/alice/docAlice.dtd" uri="docAliceSys.dtd" />
+        <public publicId="-//REMOTE//DTD ALICE DOCALICE XML//EN" uri="docAlicePub.dtd" />
+    </group>
+
+    <group prefer="system">
+        <system systemId="http://remote/dtd/bob/docBob.dtd" uri="docBobSys.dtd" />
+        <public publicId="-//REMOTE//DTD BOB DOCBOB XML//EN" uri="docBobPub.dtd" />
+    </group>
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/preferFeature.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId="http://remote/dtd/alice/docAlice.dtd" uri="docAliceSys.dtd" />
+    <public publicId="-//REMOTE//DTD ALICE DOCALICE XML//EN" uri="docAlicePub.dtd" />
+
+    <group prefer="system">
+        <system systemId="http://remote/dtd/bob/docBob.dtd" uri="docBobSys.dtd" />
+        <public publicId="-//REMOTE//DTD BOB DOCBOB XML//EN" uri="docBobPub.dtd" />
+    </group>
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/public.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <public publicId="-//REMOTE//DTD ALICE DOCALICE XML//EN" uri="http://local/dtd/docAlicePub.dtd" />
+
+    <public publicId="-//REMOTE//DTD BOB DOCBOB XML//EN" uri="docBobPub.dtd" />
+
+    <public publicId="-//REMOTE//DTD CARL DOCCARL XML//EN" uri="docCarlPub.dtd" xml:base="http://local/carlBase/dtd/" />
+
+    <public publicId="-//REMOTE//DTD DAVID DOCDAVID XML//EN" uri="docDavidPub1.dtd" />
+    <public publicId="-//REMOTE//DTD DAVID DOCDAVID XML//EN" uri="docDavidPub2.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/publicFamily.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <delegatePublic publicIdStartString="-//REMOTE//DTD ALICE DOCALICE" catalog="delegatePublic-alice.xml" />
+    <public publicId="-//REMOTE//DTD ALICE DOCALICE XML//EN" uri="docAlicePub.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/rewriteSystem.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <rewriteSystem systemIdStartString="http://remote/dtd/alice/" rewritePrefix="http://local/dtd/alice/rs/" />
+
+    <rewriteSystem systemIdStartString="http://remote/dtd/bob/" rewritePrefix="bob/rs/" />
+
+    <rewriteSystem systemIdStartString="http://remote/dtd/carl/" rewritePrefix="carl/rs/"
+        xml:base="http://local/carlBase/dtd/" />
+
+    <rewriteSystem systemIdStartString="http://remote/dtd/david/" rewritePrefix="david1/rs/" />
+    <rewriteSystem systemIdStartString="http://remote/dtd/david/" rewritePrefix="david2/rs/" />
+
+    <rewriteSystem systemIdStartString="http://remote/dtd/" rewritePrefix="ella/" />
+    <rewriteSystem systemIdStartString="http://remote/dtd/ella/" rewritePrefix="ella/rs/" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/rewriteUri.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <rewriteURI uriStartString="http://remote/dtd/alice/" rewritePrefix="http://local/dtd/alice/ru/" />
+
+    <rewriteURI uriStartString="http://remote/dtd/bob/" rewritePrefix="bob/ru/" />
+
+    <rewriteURI uriStartString="http://remote/dtd/carl/" rewritePrefix="carl/ru/"
+        xml:base="http://local/carlBase/dtd/" />
+
+    <rewriteURI uriStartString="http://remote/dtd/david/" rewritePrefix="david1/ru/" />
+    <rewriteURI uriStartString="http://remote/dtd/david/" rewritePrefix="david2/ru/" />
+
+    <rewriteURI uriStartString="http://remote/dtd/" rewritePrefix="ella/" />
+    <rewriteURI uriStartString="http://remote/dtd/ella/" rewritePrefix="ella/ru/" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/specifyCatalog-api.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId="http://remote/dtd/sys/doc.dtd" uri="docAPISys.dtd" />
+    <uri name="http://remote/dtd/uri/doc.dtd" uri="docAPIURI.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/specifyCatalog-feature.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId="http://remote/dtd/sys/doc.dtd" uri="docFeatureSys.dtd" />
+    <uri name="http://remote/dtd/uri/doc.dtd" uri="docFeatureURI.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/specifyCatalog-sysProps.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId="http://remote/dtd/sys/doc.dtd" uri="docSysPropsSys.dtd" />
+    <uri name="http://remote/dtd/uri/doc.dtd" uri="docSysPropsURI.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/system.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId="http://remote/dtd/alice/docAlice.dtd" uri="http://local/dtd/docAliceSys.dtd" />
+
+    <system systemId="http://remote/dtd/bob/docBob.dtd" uri="docBobSys.dtd" />
+
+    <system systemId="http://remote/dtd/carl/docCarl.dtd" uri="docCarlSys.dtd" xml:base="http://local/carlBase/dtd/" />
+
+    <system systemId="http://remote/dtd/david/docDavid.dtd" uri="docDavidSys1.dtd" />
+    <system systemId="http://remote/dtd/david/docDavid.dtd" uri="docDavidSys2.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/systemFamily.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <delegateSystem systemIdStartString="http://remote/dtd/alice/" catalog="delegateSystem-alice.xml" />
+    <systemSuffix systemIdSuffix="docAlice.dtd" uri="docAliceSS.dtd" />
+    <rewriteSystem systemIdStartString="http://remote/dtd/alice/" rewritePrefix="http://local/base/rs/" />
+    <system systemId="http://remote/dtd/alice/docAlice.dtd" uri="docAliceSys.dtd" />
+
+    <delegateSystem systemIdStartString="http://remote/dtd/bob/" catalog="delegateSystem-bob.xml" />
+    <systemSuffix systemIdSuffix="docBob.dtd" uri="docBobSS.dtd" />
+    <rewriteSystem systemIdStartString="http://remote/dtd/bob/" rewritePrefix="http://local/base/dtd/rs/" />
+
+    <delegateSystem systemIdStartString="http://remote/dtd/carl/" catalog="delegateSystem-carl.xml" />
+    <systemSuffix systemIdSuffix="docCarl.dtd" uri="docCarlSS.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/systemSuffix.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <systemSuffix systemIdSuffix="docAlice.dtd" uri="http://local/dtd/docAliceSS.dtd" />
+
+    <systemSuffix systemIdSuffix="docBob.dtd" uri="docBobSS.dtd" />
+
+    <systemSuffix systemIdSuffix="docCarl.dtd" uri="docCarlSS.dtd" xml:base="http://local/carlBase/dtd/" />
+
+    <systemSuffix systemIdSuffix="docDavid.dtd" uri="docDavidSS1.dtd" />
+    <systemSuffix systemIdSuffix="docDavid.dtd" uri="docDavidSS2.dtd" />
+
+    <systemSuffix systemIdSuffix="docElla.dtd" uri="/" />
+    <systemSuffix systemIdSuffix="ella/docElla.dtd" uri="docEllaSS.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/uri.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <uri name="http://remote/dtd/alice/docAlice.dtd" uri="http://local/dtd/docAliceURI.dtd" />
+
+    <uri name="http://remote/dtd/bob/docBob.dtd" uri="docBobURI.dtd" />
+
+    <uri name="http://remote/dtd/carl/docCarl.dtd" uri="docCarlURI.dtd" xml:base="http://local/carlBase/dtd/" />
+
+    <uri name="http://remote/dtd/david/docDavid.dtd" uri="docDavidURI1.dtd" />
+    <uri name="http://remote/dtd/david/docDavid.dtd" uri="docDavidURI2.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/uriFamily.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <delegateURI uriStartString="http://remote/dtd/alice/" catalog="delegateURI-alice.xml" />
+    <uriSuffix uriSuffix="docAlice.dtd" uri="docAliceUS.dtd" />
+    <rewriteURI uriStartString="http://remote/dtd/alice/" rewritePrefix="http://local/base/ru/" />
+    <uri name="http://remote/dtd/alice/docAlice.dtd" uri="docAliceURI.dtd" />
+
+    <delegateURI uriStartString="http://remote/dtd/bob/" catalog="delegateURI-bob.xml" />
+    <uriSuffix uriSuffix="docBob.dtd" uri="docBobUS.dtd" />
+    <rewriteURI uriStartString="http://remote/dtd/bob/" rewritePrefix="http://local/base/dtd/ru/" />
+
+    <delegateURI uriStartString="http://remote/dtd/carl/" catalog="delegateURI-carl.xml" />
+    <uriSuffix uriSuffix="docCarl.dtd" uri="docCarlUS.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/uriSuffix.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <uriSuffix uriSuffix="docAlice.dtd" uri="http://local/dtd/docAliceUS.dtd" />
+
+    <uriSuffix uriSuffix="docBob.dtd" uri="docBobUS.dtd" />
+
+    <uriSuffix uriSuffix="docCarl.dtd" uri="docCarlUS.dtd" xml:base="http://local/carlBase/dtd/" />
+
+    <uriSuffix uriSuffix="docDavid.dtd" uri="docDavidUS1.dtd" />
+    <uriSuffix uriSuffix="docDavid.dtd" uri="docDavidUS2.dtd" />
+
+    <uriSuffix uriSuffix="docElla.dtd" uri="/" />
+    <uriSuffix uriSuffix="ella/docElla.dtd" uri="docEllaUS.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/urnUnwrapping.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <public publicId="-//REMOTE//DTD ALICE DOCALICE XML//EN" uri="docAlicePub.dtd" />
+    <public publicId="-//REMOTE//DTD BOB DOCBOB :: + : / ; ' ? # %//EN" uri="docBobPub.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/validateCatalog-malformed.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This catalog is malformed XML -->
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <system systemId="http://remote/dtd/doc.dtd" uri="docSys.dtd" />
+</cat>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/validateCatalog-noNamingSpace.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- This catalog doesn't define the correct naming space -->
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog1">
+    <system systemId="http://remote/dtd/alice/docAlice.dtd" uri="http://local/dtd/docAliceSysWrongNS.dtd" />
+    <uri name="http://remote/dtd/alice/docAlice.dtd" uri="http://local/dtd/docAliceURIWrongNS.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/validateCatalog-wrongRoot.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- The root of this catalog isn't named "catalog" -->
+<cat xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+    <system systemId="http://remote/dtd/doc.dtd" uri="docSys.dtd" />
+</cat>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/isolatedjdk/IsolatedJDK.sh	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# 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.
+
+if [ $# = 0 ]; then
+  echo "The suffix of ISOLATED_JDK is mandatory"
+  exit 1
+fi
+
+checkVariable() {
+  variable='$'$1
+
+  if [ "${variable}" = "" ]; then
+    echo "Failed due to $1 is not set."
+    exit 1
+  fi
+}
+
+checkVariables() {
+  for variable in $*
+  do
+    checkVariable ${variable}
+  done
+}
+
+# Check essential variables
+checkVariables TESTJAVA TESTSRC TESTCLASSES TESTCLASSPATH
+
+echo "TESTJAVA=${TESTJAVA}"
+echo "TESTSRC=${TESTSRC}"
+echo "TESTCLASSES=${TESTCLASSES}"
+echo "TESTCLASSPATH=${TESTCLASSPATH}"
+
+# Make an isolated copy of the testing JDK
+ISOLATED_JDK="./ISOLATED_JDK_$1"
+echo "ISOLATED_JDK=${ISOLATED_JDK}"
+
+echo "Copy testing JDK started"
+cp -H -R ${TESTJAVA} ${ISOLATED_JDK} || exit 1
+chmod -R +w ${ISOLATED_JDK} || exit 1
+echo "Copy testing JDK ended"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/isolatedjdk/TEST.properties	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,4 @@
+lib.dirs=/javax/xml/jaxp/libs
+
+# Declare module dependency
+modules=java.xml
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/isolatedjdk/catalog/PropertiesTest.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,122 @@
+/*
+ * 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 catalog;
+
+import static catalog.CatalogTestUtils.DEFER_FALSE;
+import static catalog.CatalogTestUtils.FEATURE_DEFER;
+import static catalog.CatalogTestUtils.FEATURE_FILES;
+import static catalog.CatalogTestUtils.FEATURE_PREFER;
+import static catalog.CatalogTestUtils.FEATURE_RESOLVE;
+import static catalog.CatalogTestUtils.PREFER_SYSTEM;
+import static catalog.CatalogTestUtils.RESOLVE_CONTINUE;
+import static catalog.CatalogTestUtils.catalogResolver;
+import static catalog.CatalogTestUtils.catalogUriResolver;
+import static catalog.CatalogTestUtils.createPropsContent;
+import static catalog.CatalogTestUtils.deleteJAXPProps;
+import static catalog.CatalogTestUtils.generateJAXPProps;
+import static catalog.CatalogTestUtils.getCatalogPath;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
+
+/*
+ * This case tests if the properties FILES, DEFER, PREFER, RESOLVE in
+ * jaxp.properties and system properties could be cared.
+ */
+public class PropertiesTest {
+
+    private static final String CATALOG_PROPERTIES = "properties.xml";
+
+    public static void main(String[] args) throws Exception {
+        System.out.println("testJAXPProperties started");
+        testJAXPProperties();
+        System.out.println("testJAXPProperties ended");
+
+        System.out.println("testSystemProperties started");
+        testSystemProperties();
+        System.out.println("testSystemProperties ended");
+
+        System.out.println("Test passed");
+    }
+
+    /*
+     * Tests how does jaxp.properties affects the resolution.
+     */
+    private static void testJAXPProperties() throws IOException {
+        generateJAXPProps(createJAXPPropsContent());
+        testProperties();
+        deleteJAXPProps();
+    }
+
+    /*
+     * Tests how does system properties affects the resolution.
+     */
+    private static void testSystemProperties() {
+        setSystemProperties();
+        testProperties();
+    }
+
+    private static void testProperties() {
+        testPropertiesOnEntityResolver();
+        testPropertiesOnUriResolver();
+    }
+
+    private static void testPropertiesOnEntityResolver() {
+        CatalogResolver entityResolver = catalogResolver((String[]) null);
+        entityResolver.resolveEntity("-//REMOTE//DTD DOCDUMMY XML//EN",
+                "http://remote/sys/dtd/docDummy.dtd");
+        "http://local/base/dtd/docSys.dtd".equals(
+                entityResolver.resolveEntity("-//REMOTE//DTD DOC XML//EN",
+                        "http://remote/dtd/doc.dtd").getSystemId());
+    }
+
+    private static void testPropertiesOnUriResolver() {
+        CatalogUriResolver uriResolver = catalogUriResolver((String[]) null);
+        uriResolver.resolve("http://remote/uri/dtd/docDummy.dtd", null);
+        "http://local/base/dtd/docURI.dtd".equals(uriResolver.resolve(
+                "http://remote/dtd/doc.dtd", null).getSystemId());
+    }
+
+    // The properties in jaxp.properties don't use default values
+    private static String createJAXPPropsContent() {
+        Map<String, String> props = new HashMap<>();
+        props.put(FEATURE_FILES, getCatalogPath(CATALOG_PROPERTIES));
+        props.put(FEATURE_DEFER, DEFER_FALSE);
+        props.put(FEATURE_PREFER, PREFER_SYSTEM);
+        props.put(FEATURE_RESOLVE, RESOLVE_CONTINUE);
+        return createPropsContent(props);
+    }
+
+    // The system properties don't use default values
+    private static void setSystemProperties() {
+        System.setProperty(FEATURE_FILES, getCatalogPath(CATALOG_PROPERTIES));
+        System.setProperty(FEATURE_DEFER, DEFER_FALSE);
+        System.setProperty(FEATURE_PREFER, PREFER_SYSTEM);
+        System.setProperty(FEATURE_RESOLVE, RESOLVE_CONTINUE);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/isolatedjdk/catalog/PropertiesTest.sh	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# 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.
+
+# @test
+# @bug 8077931
+# @summary This case tests if the properties FILES, DEFER, PREFER, RESOLVE in
+#          jaxp.properties and system properties could be used.
+# @library ../../libs/
+# @build catalog.CatalogTestUtils
+# @build PropertiesTest
+# @run shell/timeout=600 ../IsolatedJDK.sh JAXP_PROPS
+# @run shell/timeout=600 PropertiesTest.sh
+
+echo "Copies properties.xml to class path"
+TEST_CATALOG_PATH=${TESTCLASSES}/catalog/catalogFiles
+echo "TEST_CATALOG_PATH=${TEST_CATALOG_PATH}"
+mkdir -p ${TEST_CATALOG_PATH}
+cp ${TESTSRC}/catalogFiles/properties.xml ${TEST_CATALOG_PATH}/properties.xml
+
+# Execute test
+ISOLATED_JDK=./ISOLATED_JDK_JAXP_PROPS
+echo "Executes PropertiesTest"
+${ISOLATED_JDK}/bin/java -Dtest.src="${TESTSRC}/.." ${TESTVMOPTS} -cp "${TESTCLASSPATH}" catalog.PropertiesTest
+exitCode=$?
+
+# Cleanup ISOLATED_JDK
+rm -rf ${ISOLATED_JDK}
+
+# Results
+echo ''
+if [ $exitCode -gt 0 ]; then
+  echo "PropertiesTest failed";
+else
+  echo "PropertiesTest passed";
+fi
+exit $exitCode
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/isolatedjdk/catalog/catalogFiles/properties.xml	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" xml:base="http://local/base/dtd/">
+    <system systemId="http://remote/dtd/doc.dtd" uri="docSys.dtd" />
+    <public publicId="-//REMOTE//DTD DOC XML//EN" uri="docPub.dtd" />
+    <uri name="http://remote/dtd/doc.dtd" uri="docURI.dtd" />
+</catalog>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,190 @@
+/*
+ * 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 catalog;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogManager;
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
+
+/*
+ * Utilities for testing XML Catalog API.
+ */
+final class CatalogTestUtils {
+
+    /* catalog files */
+    static final String CATALOG_PUBLIC = "public.xml";
+    static final String CATALOG_SYSTEM = "system.xml";
+    static final String CATALOG_URI = "uri.xml";
+
+    /* features */
+    static final String FEATURE_FILES = "javax.xml.catalog.files";
+    static final String FEATURE_PREFER = "javax.xml.catalog.prefer";
+    static final String FEATURE_DEFER = "javax.xml.catalog.defer";
+    static final String FEATURE_RESOLVE = "javax.xml.catalog.resolve";
+
+    /* values of prefer feature */
+    static final String PREFER_SYSTEM = "system";
+    static final String PREFER_PUBLIC = "public";
+
+    /* values of defer feature */
+    static final String DEFER_TRUE = "true";
+    static final String DEFER_FALSE = "false";
+
+    /* values of resolve feature */
+    static final String RESOLVE_STRICT = "strict";
+    static final String RESOLVE_CONTINUE = "continue";
+    static final String RESOLVE_IGNORE = "ignore";
+
+    private static final String JAXP_PROPS = "jaxp.properties";
+    private static final String JAXP_PROPS_BAK = JAXP_PROPS + ".bak";
+
+    /*
+     * Force using slash as File separator as we always use cygwin to test in
+     * Windows platform.
+     */
+    private static final String FILE_SEP = "/";
+
+    private CatalogTestUtils() { }
+
+    /* ********** create resolver ********** */
+
+    /*
+     * Creates CatalogResolver with a set of catalogs.
+     */
+    static CatalogResolver catalogResolver(String... catalogName) {
+        return catalogResolver(null, catalogName);
+    }
+
+    /*
+     * Creates CatalogResolver with a feature and a set of catalogs.
+     */
+    static CatalogResolver catalogResolver(CatalogFeatures features,
+            String... catalogName) {
+        return CatalogManager.catalogResolver(features,
+                getCatalogPaths(catalogName));
+    }
+
+    /*
+     * Creates catalogUriResolver with a set of catalogs.
+     */
+    static CatalogUriResolver catalogUriResolver(String... catalogName) {
+        return catalogUriResolver(null, catalogName);
+    }
+
+    /*
+     * Creates catalogUriResolver with a feature and a set of catalogs.
+     */
+    static CatalogUriResolver catalogUriResolver(
+            CatalogFeatures features, String... catalogName) {
+        return CatalogManager.catalogUriResolver(features,
+                getCatalogPaths(catalogName));
+    }
+
+    // Gets the paths of the specified catalogs.
+    private static String[] getCatalogPaths(String... catalogNames) {
+        return catalogNames == null
+                ? null
+                : Stream.of(catalogNames).map(
+                        catalogName -> getCatalogPath(catalogName)).collect(
+                                Collectors.toList()).toArray(new String[0]);
+    }
+
+    // Gets the paths of the specified catalogs.
+    static String getCatalogPath(String catalogName) {
+        return catalogName == null
+                ? null
+                : 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 ********** */
+
+    /*
+     * Generates the jaxp.properties with the specified content.
+     */
+    static void generateJAXPProps(String content) throws IOException {
+        Path filePath = getJAXPPropsPath();
+        Path bakPath = filePath.resolveSibling(JAXP_PROPS_BAK);
+        if (Files.exists(filePath) && !Files.exists(bakPath)) {
+            Files.move(filePath, bakPath);
+        }
+
+        Files.write(filePath, content.getBytes());
+    }
+
+    /*
+     * Deletes the jaxp.properties.
+     */
+    static void deleteJAXPProps() throws IOException {
+        Path filePath = getJAXPPropsPath();
+        Files.delete(filePath);
+        Path bakFilePath = filePath.resolveSibling(JAXP_PROPS_BAK);
+        if (Files.exists(bakFilePath)) {
+            Files.move(bakFilePath, filePath);
+        }
+    }
+
+    /*
+     * Gets the path of jaxp.properties.
+     */
+    private static Path getJAXPPropsPath() {
+        return Paths.get(System.getProperty("java.home") + File.separator
+                + "conf" + File.separator + JAXP_PROPS);
+    }
+
+    /*
+     * Creates the content of properties file with the specified
+     * property-value pairs.
+     */
+    static String createPropsContent(Map<String, String> props) {
+        return props.entrySet().stream().map(
+                entry -> String.format("%s=%s%n", entry.getKey(),
+                        entry.getValue())).reduce(
+                                (line1, line2) -> line1 + line2).get();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/ResolutionChecker.java	Thu Oct 29 22:12:53 2015 -0700
@@ -0,0 +1,187 @@
+/*
+ * 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 catalog;
+
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.catalog.CatalogUriResolver;
+
+import org.testng.Assert;
+
+/*
+ * Utilities for checking catalog resolution.
+ */
+class ResolutionChecker {
+
+    /* ********** Checks normal resolution ********** */
+
+    /*
+     * Checks the resolution result for specified external identifier.
+     */
+    static void checkExtIdResolution(CatalogResolver resolver,
+            String publicId, String systemId, String matchedUri) {
+        Assert.assertEquals(
+                resolver.resolveEntity(publicId, systemId).getSystemId(),
+                matchedUri);
+    }
+
+    /*
+     * Checks the resolution result for specified system identifier.
+     */
+    static void checkSysIdResolution(CatalogResolver resolver,
+            String systemId, String matchedUri) {
+        checkExtIdResolution(resolver, null, systemId, matchedUri);
+    }
+
+    /*
+     * Checks the resolution result for specified public identifier.
+     */
+    static void checkPubIdResolution(CatalogResolver resolver,
+            String publicId, String matchedUri) {
+        checkExtIdResolution(resolver, publicId, null, matchedUri);
+    }
+
+    /*
+     * Checks the resolution result for specified URI references
+     * with the specified base location.
+     */
+    static void checkUriResolution(CatalogUriResolver resolver,
+            String href, String base, String matchedUri) {
+        Assert.assertEquals(resolver.resolve(href, base).getSystemId(),
+                matchedUri);
+    }
+
+    /*
+     * Checks the resolution result for specified URI references.
+     */
+    static void checkUriResolution(CatalogUriResolver resolver,
+            String href, String matchedUri) {
+        checkUriResolution(resolver, href, null, matchedUri);
+    }
+
+    /* ********** Checks no match is found ********** */
+
+    /*
+     * With strict resolution, if no match is found,
+     * CatalogResolver should throw CatalogException.
+     */
+    static void checkNoMatch(CatalogResolver resolver) {
+        resolver.resolveEntity("-//EXTID//DTD NOMATCH DOCNOMATCH XML//EN",
+                "http://extId/noMatch/docNoMatch.dtd");
+    }
+
+    /*
+     * With strict resolution, if no match is found,
+     * CatalogUriResolver should throw CatalogException.
+     */
+    static void checkNoMatch(CatalogUriResolver resolver) {
+        resolver.resolve("http://uri/noMatch/docNoMatch.dtd", null);
+    }
+
+    /* ********** Checks expected exception ********** */
+
+    /*
+     * Checks the expected exception during the resolution for specified
+     * external identifier.
+     */
+    static <T extends Throwable> void expectExceptionOnExtId(
+            CatalogResolver resolver, String publicId, String systemId,
+            Class<T> expectedExceptionClass) {
+        expectThrows(expectedExceptionClass, () -> {
+            resolver.resolveEntity(publicId, systemId);
+        });
+    }
+
+    /*
+     * Checks the expected exception during the resolution for specified
+     * system identifier.
+     */
+    static <T extends Throwable> void expectExceptionOnSysId(
+            CatalogResolver resolver, String systemId,
+            Class<? extends Throwable> expectedExceptionClass) {
+        expectExceptionOnExtId(resolver, null, systemId,
+                expectedExceptionClass);
+    }
+
+    /*
+     * Checks the expected exception during the resolution for specified
+     * public identifier.
+     */
+    static <T extends Throwable> void expectExceptionOnPubId(
+            CatalogResolver resolver, String publicId,
+            Class<T> expectedExceptionClass) {
+        expectExceptionOnExtId(resolver, publicId, null,
+                expectedExceptionClass);
+    }
+
+    /*
+     * Checks the expected exception during the resolution for specified
+     * URI reference with a specified base location.
+     */
+    static <T extends Throwable> void expectExceptionOnUri(
+            CatalogUriResolver resolver, String href, String base,
+            Class<T> expectedExceptionClass) {
+        expectThrows(expectedExceptionClass, () -> {
+            resolver.resolve(href, base);
+        });
+    }
+
+    /*
+     * Checks the expected exception during the resolution for specified
+     * URI reference without any specified base location.
+     */
+    static <T extends Throwable> void expectExceptionOnUri(
+            CatalogUriResolver resolver, String href,
+            Class<T> expectedExceptionClass) {
+        expectExceptionOnUri(resolver, href, null, expectedExceptionClass);
+    }
+
+    // The TestNG distribution in current JTREG build doesn't support
+    // method Assert.expectThrows().
+    private static <T extends Throwable> T expectThrows(Class<T> throwableClass,
+            ThrowingRunnable runnable) {
+        try {
+            runnable.run();
+        } catch (Throwable t) {
+            if (throwableClass.isInstance(t)) {
+                return throwableClass.cast(t);
+            } else {
+                String mismatchMessage = String.format(
+                        "Expected %s to be thrown, but %s was thrown",
+                        throwableClass.getSimpleName(),
+                        t.getClass().getSimpleName());
+
+                throw new AssertionError(mismatchMessage, t);
+            }
+        }
+
+        String message = String.format(
+                "Expected %s to be thrown, but nothing was thrown",
+                throwableClass.getSimpleName());
+        throw new AssertionError(message);
+    }
+
+    private interface ThrowingRunnable {
+        void run() throws Throwable;
+    }
+}