1 6 package fr.jayasoft.ivy.xml; 7 8 import java.net.URL ; 9 10 import junit.framework.TestCase; 11 import fr.jayasoft.ivy.DependencyResolver; 12 import fr.jayasoft.ivy.Ivy; 13 import fr.jayasoft.ivy.resolver.IvyRepResolver; 14 import fr.jayasoft.ivy.url.URLHandler; 15 import fr.jayasoft.ivy.url.URLHandlerDispatcher; 16 import fr.jayasoft.ivy.url.URLHandlerRegistry; 17 18 21 public class OnlineXmlIvyConfigurationParserTest extends TestCase { 22 24 public void testIncludeHttpUrl() throws Exception { 25 configureURLHandler(); 26 Ivy ivy = new Ivy(); 27 XmlIvyConfigurationParser parser = new XmlIvyConfigurationParser(ivy); 28 parser.parse(new URL ("http://www.jayasoft.org/misc/ivy/test/ivyconf-include-http-url.xml")); 29 30 DependencyResolver resolver = ivy.getResolver("ivyrep"); 31 assertNotNull(resolver); 32 assertTrue(resolver instanceof IvyRepResolver); 33 } 34 35 private void configureURLHandler() { 36 URLHandlerDispatcher dispatcher = new URLHandlerDispatcher(); 37 URLHandler httpHandler = URLHandlerRegistry.getHttp(); 38 dispatcher.setDownloader("http", httpHandler); 39 dispatcher.setDownloader("https", httpHandler); 40 URLHandlerRegistry.setDefault(dispatcher); 41 } 42 43 } 44 | Popular Tags |