Java Code Examples for javax.xml.catalog.CatalogResolver#resolveEntity()
The following examples show how to use
javax.xml.catalog.CatalogResolver#resolveEntity() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CatalogTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "resolveEntity") public void testMatch1(String cfile, String prefer, String sysId, String pubId, String expectedUri, String expectedFile, String msg) throws Exception { URI catalogFile = getClass().getResource(cfile).toURI(); CatalogFeatures features = CatalogFeatures.builder().with(CatalogFeatures.Feature.PREFER, prefer).build(); CatalogResolver catalogResolver = CatalogManager.catalogResolver(features, catalogFile); InputSource is = catalogResolver.resolveEntity(pubId, sysId); Assert.assertNotNull(is, msg); String expected = (expectedUri == null) ? expectedFile : expectedUri; Assert.assertEquals(expected, is.getSystemId(), msg); }
Example 2
Source File: CatalogFileInputTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "acceptedURI") public void testMatch(String uri, String sysId, String pubId, String expectedId, String msg) throws Exception { CatalogResolver cr = CatalogManager.catalogResolver(FEATURES, URI.create(uri)); InputSource is = cr.resolveEntity(pubId, sysId); Assert.assertNotNull(is, msg); Assert.assertEquals(expectedId, is.getSystemId(), msg); }
Example 3
Source File: CatalogFileInputTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "invalidCatalog", expectedExceptions = CatalogException.class) public void testCatalogResolverWEmptyCatalog(String uri, String publicId, String msg) { CatalogResolver cr = CatalogManager.catalogResolver( CatalogFeatures.builder().with(CatalogFeatures.Feature.RESOLVE, "strict").build(), uri != null? URI.create(uri) : null); InputSource is = cr.resolveEntity(publicId, ""); }
Example 4
Source File: DeferFeatureTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "testDeferFeatureByResolve") public void testDeferFeatureByResolve(Catalog catalog, int catalogCount) throws Exception { CatalogResolver cr = createResolver(catalog); // trigger loading alternative catalogs try { cr.resolveEntity("-//REMOTE//DTD ALICE DOCALICE", "http://remote/dtd/alice/"); } catch (CatalogException ce) {} Assert.assertEquals(loadedCatalogCount(catalog), catalogCount); }
Example 5
Source File: ResolveFeatureTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test public void testContinueResolutionOnEntityResolver() { CatalogResolver resolver = createEntityResolver(RESOLVE_CONTINUE); resolver.resolveEntity(null, "http://remote/dtd/bob/docBobDummy.dtd"); checkSysIdResolution(resolver, "http://remote/dtd/bob/docBob.dtd", "http://local/base/dtd/docBobSys.dtd"); }
Example 6
Source File: PropertiesTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void testPropertiesOnEntityResolver() { CatalogResolver entityResolver = catalogResolver((String[]) null); entityResolver.resolveEntity("-//REMOTE//DTD DOCDUMMY XML//EN", "http://remote/sys/dtd/docDummy.dtd"); "http://local/base/dtd/docSys.dtd".equals( entityResolver.resolveEntity("-//REMOTE//DTD DOC XML//EN", "http://remote/dtd/doc.dtd").getSystemId()); }
Example 7
Source File: CatalogAccessTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "accessTest", expectedExceptions = SecurityException.class) public void testSecurity(String cfile, String sysId, String pubId) throws Exception { CatalogResolver cr = CatalogManager.catalogResolver(FEATURES, URI.create(cfile)); InputSource is = cr.resolveEntity(pubId, sysId); Assert.fail("Failed to throw SecurityException"); }
Example 8
Source File: CatalogTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Test(expectedExceptions = NullPointerException.class) public void sysIdCantBeNull() { CatalogResolver catalogResolver = CatalogManager.catalogResolver(CatalogFeatures.defaults()); InputSource is = catalogResolver.resolveEntity("-//FOO//DTD XML Dummy V0.0//EN", null); }
Example 9
Source File: ResolutionChecker.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
static void checkNoMatch(CatalogResolver resolver) { resolver.resolveEntity("-//EXTID//DTD NOMATCH DOCNOMATCH XML//EN", "http://extId/noMatch/docNoMatch.dtd"); }