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.CATALOG_SYSTEM;
27 import static catalog.CatalogTestUtils.CATALOG_URI;
28 import static catalog.CatalogTestUtils.RESOLVE_CONTINUE;
29 import static catalog.CatalogTestUtils.RESOLVE_IGNORE;
30 import static catalog.CatalogTestUtils.RESOLVE_STRICT;
31 import static catalog.CatalogTestUtils.catalogResolver;
32 import static catalog.CatalogTestUtils.catalogUriResolver;
33 import static catalog.ResolutionChecker.checkSysIdResolution;
34 import static catalog.ResolutionChecker.checkUriResolution;
35 import static javax.xml.catalog.CatalogFeatures.builder;
36
37 import javax.xml.catalog.CatalogException;
38 import javax.xml.catalog.CatalogFeatures;
39 import javax.xml.catalog.CatalogFeatures.Feature;
40 import javax.xml.catalog.CatalogResolver;
41 import javax.xml.catalog.CatalogUriResolver;
42
43 import org.testng.annotations.Test;
44
45 /*
46 * @test
47 * @bug 8077931
48 * @summary This case tests how does resolve feature affect the catalog
49 * resolution.
50 * @compile ../../libs/catalog/CatalogTestUtils.java
51 * @compile ../../libs/catalog/ResolutionChecker.java
52 */
53 public class ResolveFeatureTest {
54
55 /*
56 * For strict external identifier resolution, if no match is found,
57 * it should throw CatalogException.
58 */
59 @Test(expectedExceptions = CatalogException.class)
60 public void testStrictResolutionOnEntityResolver() {
61 createEntityResolver(RESOLVE_STRICT).resolveEntity(null,
62 "http://remote/dtd/alice/docAliceDummy.dtd");
63 }
64
65 /*
66 * For strict URI reference resolution, if no match is found,
67 * it should throw CatalogException.
68 */
69 @Test(expectedExceptions = CatalogException.class)
70 public void testStrictResolutionOnUriResolver() {
71 createUriResolver(RESOLVE_STRICT).resolve(
72 "http://remote/dtd/alice/docAliceDummy.dtd", null);
|
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.CATALOG_SYSTEM;
27 import static catalog.CatalogTestUtils.CATALOG_URI;
28 import static catalog.CatalogTestUtils.RESOLVE_CONTINUE;
29 import static catalog.CatalogTestUtils.RESOLVE_IGNORE;
30 import static catalog.CatalogTestUtils.RESOLVE_STRICT;
31 import static catalog.CatalogTestUtils.catalogResolver;
32 import static catalog.CatalogTestUtils.catalogUriResolver;
33 import static catalog.ResolutionChecker.checkSysIdResolution;
34 import static catalog.ResolutionChecker.checkUriResolution;
35 import static javax.xml.catalog.CatalogFeatures.builder;
36
37 import javax.xml.catalog.CatalogException;
38 import javax.xml.catalog.CatalogFeatures;
39 import javax.xml.catalog.CatalogFeatures.Feature;
40 import javax.xml.catalog.CatalogResolver;
41 import javax.xml.catalog.CatalogUriResolver;
42
43 import org.testng.annotations.Listeners;
44 import org.testng.annotations.Test;
45
46 /*
47 * @test
48 * @bug 8077931
49 * @summary This case tests how does resolve feature affect the catalog
50 * resolution.
51 * @compile ../../libs/catalog/CatalogTestUtils.java
52 * @compile ../../libs/catalog/ResolutionChecker.java
53 */
54 @Listeners({jaxp.library.FilePolicy.class})
55 public class ResolveFeatureTest {
56
57 /*
58 * For strict external identifier resolution, if no match is found,
59 * it should throw CatalogException.
60 */
61 @Test(expectedExceptions = CatalogException.class)
62 public void testStrictResolutionOnEntityResolver() {
63 createEntityResolver(RESOLVE_STRICT).resolveEntity(null,
64 "http://remote/dtd/alice/docAliceDummy.dtd");
65 }
66
67 /*
68 * For strict URI reference resolution, if no match is found,
69 * it should throw CatalogException.
70 */
71 @Test(expectedExceptions = CatalogException.class)
72 public void testStrictResolutionOnUriResolver() {
73 createUriResolver(RESOLVE_STRICT).resolve(
74 "http://remote/dtd/alice/docAliceDummy.dtd", null);
|