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.FEATURE_FILES;
27 import static catalog.CatalogTestUtils.catalogResolver;
28 import static catalog.CatalogTestUtils.catalogUriResolver;
29 import static catalog.CatalogTestUtils.getCatalogPath;
30 import static catalog.ResolutionChecker.checkSysIdResolution;
31 import static catalog.ResolutionChecker.checkUriResolution;
32 import static javax.xml.catalog.CatalogFeatures.builder;
33 import static javax.xml.catalog.CatalogFeatures.Feature.FILES;
34
35 import javax.xml.catalog.CatalogFeatures;
36 import javax.xml.catalog.CatalogResolver;
37 import javax.xml.catalog.CatalogUriResolver;
38
39 import org.testng.annotations.Test;
40
41 /*
42 * @test
43 * @bug 8077931
44 * @summary This case tests how to specify the catalog files.
45 * @compile ../../libs/catalog/CatalogTestUtils.java
46 * @compile ../../libs/catalog/ResolutionChecker.java
47 */
48 public class SpecifyCatalogTest {
49
50 private static final String ID_URI = "http://remote/dtd/uri/doc.dtd";
51 private static final String ID_SYS = "http://remote/dtd/sys/doc.dtd";
52
53 private static final CatalogFeatures FILES_FEATURE = createFeature(
54 "specifyCatalog-feature.xml");
55
56 /*
57 * CatalogResolver specifies catalog via feature javax.xml.catalog.files.
58 */
59 @Test
60 public void specifyCatalogOnEntityResolver() {
61 checkSysIdResolution(catalogResolver(FILES_FEATURE, (String[]) null),
62 ID_SYS, "http://local/base/dtd/docFeatureSys.dtd");
63 }
64
65 /*
66 * CatalogUriResolver specifies catalog via feature javax.xml.catalog.files.
67 */
|
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.FEATURE_FILES;
27 import static catalog.CatalogTestUtils.catalogResolver;
28 import static catalog.CatalogTestUtils.catalogUriResolver;
29 import static catalog.CatalogTestUtils.getCatalogPath;
30 import static catalog.ResolutionChecker.checkSysIdResolution;
31 import static catalog.ResolutionChecker.checkUriResolution;
32 import static javax.xml.catalog.CatalogFeatures.builder;
33 import static javax.xml.catalog.CatalogFeatures.Feature.FILES;
34
35 import javax.xml.catalog.CatalogFeatures;
36 import javax.xml.catalog.CatalogResolver;
37 import javax.xml.catalog.CatalogUriResolver;
38
39 import org.testng.annotations.Listeners;
40 import org.testng.annotations.Test;
41
42 /*
43 * @test
44 * @bug 8077931
45 * @summary This case tests how to specify the catalog files.
46 * @compile ../../libs/catalog/CatalogTestUtils.java
47 * @compile ../../libs/catalog/ResolutionChecker.java
48 */
49 @Listeners({jaxp.library.FilePolicy.class})
50 public class SpecifyCatalogTest {
51
52 private static final String ID_URI = "http://remote/dtd/uri/doc.dtd";
53 private static final String ID_SYS = "http://remote/dtd/sys/doc.dtd";
54
55 private static final CatalogFeatures FILES_FEATURE = createFeature(
56 "specifyCatalog-feature.xml");
57
58 /*
59 * CatalogResolver specifies catalog via feature javax.xml.catalog.files.
60 */
61 @Test
62 public void specifyCatalogOnEntityResolver() {
63 checkSysIdResolution(catalogResolver(FILES_FEATURE, (String[]) null),
64 ID_SYS, "http://local/base/dtd/docFeatureSys.dtd");
65 }
66
67 /*
68 * CatalogUriResolver specifies catalog via feature javax.xml.catalog.files.
69 */
|