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
34 import org.testng.annotations.DataProvider;
35 import org.testng.annotations.Test;
36
37 /*
38 * @test
39 * @bug 8077931
40 * @summary Get matched URIs from system, public and uri entries respectively,
41 * and some of the entries are enclosed by group entries.
42 * @compile ../../libs/catalog/CatalogTestUtils.java
43 * @compile ../../libs/catalog/ResolutionChecker.java
44 */
45 public class GroupTest {
46
47 private static final String CATALOG_GROUP = "group.xml";
48
49 @Test(dataProvider = "systemId-matchedUri")
50 public void testMatchOnSysId(String uri, String matchedUri) {
51 checkSysIdResolution(createResolver(), uri, matchedUri);
52 }
53
54 @DataProvider(name = "systemId-matchedUri")
55 private Object[][] dataOnSysId() {
56 return new Object[][] {
57 // The matched URI of the specified system id is enclosed by a
58 // group entry.
59 { "http://remote/dtd/sys/alice/docAlice.dtd",
60 "http://local/base/dtd/docAliceSys.dtd" },
61
62 // The matched URI of the specified system id is enclosed by a
63 // group entry, which defines another base.
64 { "http://remote/dtd/sys/bob/docBob.dtd",
|
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
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 * @summary Get matched URIs from system, public and uri entries respectively,
42 * and some of the entries are enclosed by group entries.
43 * @compile ../../libs/catalog/CatalogTestUtils.java
44 * @compile ../../libs/catalog/ResolutionChecker.java
45 */
46 @Listeners({jaxp.library.FilePolicy.class})
47 public class GroupTest {
48
49 private static final String CATALOG_GROUP = "group.xml";
50
51 @Test(dataProvider = "systemId-matchedUri")
52 public void testMatchOnSysId(String uri, String matchedUri) {
53 checkSysIdResolution(createResolver(), uri, matchedUri);
54 }
55
56 @DataProvider(name = "systemId-matchedUri")
57 private Object[][] dataOnSysId() {
58 return new Object[][] {
59 // The matched URI of the specified system id is enclosed by a
60 // group entry.
61 { "http://remote/dtd/sys/alice/docAlice.dtd",
62 "http://local/base/dtd/docAliceSys.dtd" },
63
64 // The matched URI of the specified system id is enclosed by a
65 // group entry, which defines another base.
66 { "http://remote/dtd/sys/bob/docBob.dtd",
|