1 /*
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
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.Test;
37
38 /*
39 * @test
40 * @bug 8077931
41 * @summary Before matching identifiers and URI references, it has to normalize
42 * the passed identifiers and URI references. And then the catalog
43 * resolver uses the normalized stuff to search the counterparts in
44 * catalog files.
45 * @compile ../../libs/catalog/CatalogTestUtils.java
46 * @compile ../../libs/catalog/ResolutionChecker.java
47 */
48 public class NormalizationTest {
49
50 private static final String CATALOG_NORMALIZATION = "normalization.xml";
51
52 @Test(dataProvider = "systemId_uri-matchedUri")
53 public void testNormalizationOnSysId(String sytemId, String matchedUri) {
54 checkSysIdResolution(createEntityResolver(), sytemId, matchedUri);
55 }
56
57 @Test(dataProvider = "publicId-matchedUri")
58 public void testNormalizationOnPubId(String publicId, String matchedUri) {
59 checkPubIdResolution(createEntityResolver(), publicId, matchedUri);
60 }
61
62 @Test(dataProvider = "systemId_uri-matchedUri")
63 public void testNormalizationOnUri(String uri, String matchedUri) {
64 checkUriResolution(createUriResolver(), uri, matchedUri);
65 }
66
67 @DataProvider(name = "systemId_uri-matchedUri")
|
1 /*
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
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 * @summary Before matching identifiers and URI references, it has to normalize
43 * the passed identifiers and URI references. And then the catalog
44 * resolver uses the normalized stuff to search the counterparts in
45 * catalog files.
46 * @compile ../../libs/catalog/CatalogTestUtils.java
47 * @compile ../../libs/catalog/ResolutionChecker.java
48 */
49 @Listeners({jaxp.library.FilePolicy.class})
50 public class NormalizationTest {
51
52 private static final String CATALOG_NORMALIZATION = "normalization.xml";
53
54 @Test(dataProvider = "systemId_uri-matchedUri")
55 public void testNormalizationOnSysId(String sytemId, String matchedUri) {
56 checkSysIdResolution(createEntityResolver(), sytemId, matchedUri);
57 }
58
59 @Test(dataProvider = "publicId-matchedUri")
60 public void testNormalizationOnPubId(String publicId, String matchedUri) {
61 checkPubIdResolution(createEntityResolver(), publicId, matchedUri);
62 }
63
64 @Test(dataProvider = "systemId_uri-matchedUri")
65 public void testNormalizationOnUri(String uri, String matchedUri) {
66 checkUriResolution(createUriResolver(), uri, matchedUri);
67 }
68
69 @DataProvider(name = "systemId_uri-matchedUri")
|