KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > jayasoft > ivy > xml > OnlineXmlIvyConfigurationParserTest


1 /*
2  * This file is subject to the license found in LICENCE.TXT in the root directory of the project.
3  *
4  * #SNAPSHOT#
5  */

6 package fr.jayasoft.ivy.xml;
7
8 import java.net.URL JavaDoc;
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 /**
19  * split from XmlIvyConfigurationParserTest due to dependency on network resource
20  */

21 public class OnlineXmlIvyConfigurationParserTest extends TestCase {
22     // remote.test
23

24     public void testIncludeHttpUrl() throws Exception JavaDoc {
25         configureURLHandler();
26         Ivy ivy = new Ivy();
27         XmlIvyConfigurationParser parser = new XmlIvyConfigurationParser(ivy);
28         parser.parse(new URL JavaDoc("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