1 22 package org.jboss.test.common; 23 24 import java.io.File ; 25 import java.io.IOException ; 26 import java.net.MalformedURLException ; 27 import java.net.URI ; 28 import java.net.URISyntaxException ; 29 import java.net.URL ; 30 31 import org.jboss.util.xml.catalog.CatalogManager; 32 import org.jboss.util.xml.catalog.Resolver; 33 34 import junit.framework.TestCase; 35 36 42 public class ResolverTest extends TestCase 43 { 44 45 52 public void testResolver() throws IOException , MalformedURLException , URISyntaxException { 53 if (true) return; 54 final Resolver toTest=new Resolver(); 55 System.setProperty("xml.catalog.allowPI", "true"); 58 System.setProperty("xml.catalog.prefer", "system"); 60 System.setProperty("xml.catalog.verbosity", "0"); 63 64 toTest.setCatalogManager(CatalogManager.getStaticManager()); 65 toTest.setupReaders(); 66 67 ClassLoader loader = Thread.currentThread().getContextClassLoader(); 68 URL url = loader.getResource("jax-ws-catalog.xml"); 69 toTest.parseCatalog(url); 70 71 final String systemID="http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_1.dtd"; 72 final String publicID="-//JBoss//DTD JBOSS XMBEAN 1.1//EN"; 73 74 String resolved = toTest.resolveSystem(systemID); 75 this.testIfExists(resolved); 76 System.out.println("Resolved: "+resolved); 77 78 resolved = toTest.resolvePublic(publicID, systemID); 79 System.out.println("Resolved: "+resolved); 80 this.testIfExists(resolved); 81 82 } 83 84 private void testIfExists(String fileName) throws URISyntaxException { 85 if (true) return; 86 assertNotNull(fileName); 87 final File file=new File (new URI (fileName)); 88 assertTrue(file.exists()); 89 System.out.println(file.getName()); 90 } 91 } 92 | Popular Tags |