13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 package catalog;
25
26 import static catalog.CatalogTestUtils.catalogResolver;
27 import static catalog.CatalogTestUtils.catalogUriResolver;
28 import static catalog.ResolutionChecker.checkPubIdResolution;
29 import static catalog.ResolutionChecker.checkSysIdResolution;
30 import static catalog.ResolutionChecker.checkUriResolution;
31
32 import javax.xml.catalog.CatalogResolver;
33 import javax.xml.catalog.CatalogUriResolver;
34
35 import org.testng.annotations.DataProvider;
36 import org.testng.annotations.Listeners;
37 import org.testng.annotations.Test;
38
39 /*
40 * @test
41 * @bug 8077931
42 * @library /javax/xml/jaxp/libs
43 * @run testng/othervm -DrunSecMngr=true catalog.NormalizationTest
44 * @run testng/othervm catalog.NormalizationTest
45 * @summary Before matching identifiers and URI references, it has to normalize
46 * the passed identifiers and URI references. And then the catalog
47 * resolver uses the normalized stuff to search the counterparts in
48 * catalog files.
49 */
50 @Listeners({jaxp.library.FilePolicy.class})
51 public class NormalizationTest {
52
53 private static final String CATALOG_NORMALIZATION = "normalization.xml";
94 return new Object[][] {
95 // The specified public id contains spaces. And the counterparts
96 // in public entry also contains spaces.
97 { " -//REMOTE//DTD ALICE DOCALICE XML//EN ",
98 "http://local/base/dtd/docAlicePub.dtd" },
99
100 // The specified public id doesn't contain space. But the
101 // counterpart in public entry contains spaces.
102 { "-//REMOTE//DTD ALICE DOCALICE XML//EN",
103 "http://local/base/dtd/docAlicePub.dtd" },
104
105 // The specified public id contains spaces.
106 { " -//REMOTE//DTD BOB DOCBOB XML//EN",
107 "http://local/base/dtd/docBobPub.dtd" } };
108 }
109
110 private CatalogResolver createEntityResolver() {
111 return catalogResolver(CATALOG_NORMALIZATION);
112 }
113
114 private CatalogUriResolver createUriResolver() {
115 return catalogUriResolver(CATALOG_NORMALIZATION);
116 }
117 }
118
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 package catalog;
25
26 import static catalog.CatalogTestUtils.catalogResolver;
27 import static catalog.CatalogTestUtils.catalogUriResolver;
28 import static catalog.ResolutionChecker.checkPubIdResolution;
29 import static catalog.ResolutionChecker.checkSysIdResolution;
30 import static catalog.ResolutionChecker.checkUriResolution;
31
32 import javax.xml.catalog.CatalogResolver;
33
34 import org.testng.annotations.DataProvider;
35 import org.testng.annotations.Listeners;
36 import org.testng.annotations.Test;
37
38 /*
39 * @test
40 * @bug 8077931
41 * @library /javax/xml/jaxp/libs
42 * @run testng/othervm -DrunSecMngr=true catalog.NormalizationTest
43 * @run testng/othervm catalog.NormalizationTest
44 * @summary Before matching identifiers and URI references, it has to normalize
45 * the passed identifiers and URI references. And then the catalog
46 * resolver uses the normalized stuff to search the counterparts in
47 * catalog files.
48 */
49 @Listeners({jaxp.library.FilePolicy.class})
50 public class NormalizationTest {
51
52 private static final String CATALOG_NORMALIZATION = "normalization.xml";
93 return new Object[][] {
94 // The specified public id contains spaces. And the counterparts
95 // in public entry also contains spaces.
96 { " -//REMOTE//DTD ALICE DOCALICE XML//EN ",
97 "http://local/base/dtd/docAlicePub.dtd" },
98
99 // The specified public id doesn't contain space. But the
100 // counterpart in public entry contains spaces.
101 { "-//REMOTE//DTD ALICE DOCALICE XML//EN",
102 "http://local/base/dtd/docAlicePub.dtd" },
103
104 // The specified public id contains spaces.
105 { " -//REMOTE//DTD BOB DOCBOB XML//EN",
106 "http://local/base/dtd/docBobPub.dtd" } };
107 }
108
109 private CatalogResolver createEntityResolver() {
110 return catalogResolver(CATALOG_NORMALIZATION);
111 }
112
113 private CatalogResolver createUriResolver() {
114 return catalogUriResolver(CATALOG_NORMALIZATION);
115 }
116 }
|