From 1cc2024ab57a022ef8ffbec9f395206df8e23742 Mon Sep 17 00:00:00 2001 From: Xavier Hanin Date: Mon, 21 Aug 2006 04:44:00 +0000 Subject: [PATCH] introduce offline target in build.xml allowing to disable tests requiring internet resources git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/trunk@484460 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 44 ++++++++++++++++--- .../ivy/resolver/IBiblioResolverTest.java | 4 +- .../ivy/resolver/IvyRepResolverTest.java | 2 + .../ivy/resolver/URLResolverTest.java | 1 + .../jayasoft/ivy/url/ApacheURLListerTest.java | 1 + .../jayasoft/ivy/url/BasicURLHandlerTest.java | 1 + .../ivy/url/HttpclientURLHandlerTest.java | 1 + .../OnlineXmlIvyConfigurationParserTest.java | 43 ++++++++++++++++++ .../xml/XmlIvyConfigurationParserTest.java | 11 ----- 9 files changed, 90 insertions(+), 18 deletions(-) create mode 100644 test/java/fr/jayasoft/ivy/xml/OnlineXmlIvyConfigurationParserTest.java diff --git a/build.xml b/build.xml index b0b81262..34185c8e 100644 --- a/build.xml +++ b/build.xml @@ -24,6 +24,8 @@ + + @@ -39,9 +41,14 @@ - + + + + + + @@ -81,8 +88,27 @@ + + + + + + + - + + + + + + + + + + + + + @@ -107,13 +133,19 @@ - - - - + + + + + + + + + + diff --git a/test/java/fr/jayasoft/ivy/resolver/IBiblioResolverTest.java b/test/java/fr/jayasoft/ivy/resolver/IBiblioResolverTest.java index 66c3a65b..184c2ff0 100644 --- a/test/java/fr/jayasoft/ivy/resolver/IBiblioResolverTest.java +++ b/test/java/fr/jayasoft/ivy/resolver/IBiblioResolverTest.java @@ -30,7 +30,9 @@ import fr.jayasoft.ivy.report.DownloadStatus; * */ public class IBiblioResolverTest extends TestCase { - private File _cache; + // remote.test + + private File _cache; private ResolveData _data; private Ivy _ivy; diff --git a/test/java/fr/jayasoft/ivy/resolver/IvyRepResolverTest.java b/test/java/fr/jayasoft/ivy/resolver/IvyRepResolverTest.java index df34d11a..2a3a6024 100644 --- a/test/java/fr/jayasoft/ivy/resolver/IvyRepResolverTest.java +++ b/test/java/fr/jayasoft/ivy/resolver/IvyRepResolverTest.java @@ -28,6 +28,8 @@ import fr.jayasoft.ivy.report.DownloadStatus; * */ public class IvyRepResolverTest extends TestCase { + // remote.test + private File _cache; private ResolveData _data; private Ivy _ivy; diff --git a/test/java/fr/jayasoft/ivy/resolver/URLResolverTest.java b/test/java/fr/jayasoft/ivy/resolver/URLResolverTest.java index 7bd1e315..bcdff852 100644 --- a/test/java/fr/jayasoft/ivy/resolver/URLResolverTest.java +++ b/test/java/fr/jayasoft/ivy/resolver/URLResolverTest.java @@ -32,6 +32,7 @@ import fr.jayasoft.ivy.report.DownloadStatus; * */ public class URLResolverTest extends TestCase { + // remote.test private File _cache; private ResolveData _data; private Ivy _ivy = new Ivy(); diff --git a/test/java/fr/jayasoft/ivy/url/ApacheURLListerTest.java b/test/java/fr/jayasoft/ivy/url/ApacheURLListerTest.java index 97e73f06..c69ff95d 100644 --- a/test/java/fr/jayasoft/ivy/url/ApacheURLListerTest.java +++ b/test/java/fr/jayasoft/ivy/url/ApacheURLListerTest.java @@ -19,6 +19,7 @@ import java.util.List; * @author John M. Shields */ public class ApacheURLListerTest extends TestCase { + // remote.test //~ Methods ---------------------------------------------------------------- /** diff --git a/test/java/fr/jayasoft/ivy/url/BasicURLHandlerTest.java b/test/java/fr/jayasoft/ivy/url/BasicURLHandlerTest.java index cf833893..a18aa32f 100644 --- a/test/java/fr/jayasoft/ivy/url/BasicURLHandlerTest.java +++ b/test/java/fr/jayasoft/ivy/url/BasicURLHandlerTest.java @@ -14,6 +14,7 @@ import junit.framework.TestCase; * Test BasicURLHandler */ public class BasicURLHandlerTest extends TestCase { + // remote.test public void testIsReachable() throws Exception { URLHandler handler = new BasicURLHandler(); assertTrue(handler.isReachable(new URL("http://www.google.fr/"))); diff --git a/test/java/fr/jayasoft/ivy/url/HttpclientURLHandlerTest.java b/test/java/fr/jayasoft/ivy/url/HttpclientURLHandlerTest.java index 789d0173..bcf0a081 100644 --- a/test/java/fr/jayasoft/ivy/url/HttpclientURLHandlerTest.java +++ b/test/java/fr/jayasoft/ivy/url/HttpclientURLHandlerTest.java @@ -13,6 +13,7 @@ import junit.framework.TestCase; * Test HttpClientHandler */ public class HttpclientURLHandlerTest extends TestCase { + // remote.test public void testIsReachable() throws Exception { URLHandler handler = new HttpClientHandler(); assertTrue(handler.isReachable(new URL("http://www.google.fr/"))); diff --git a/test/java/fr/jayasoft/ivy/xml/OnlineXmlIvyConfigurationParserTest.java b/test/java/fr/jayasoft/ivy/xml/OnlineXmlIvyConfigurationParserTest.java new file mode 100644 index 00000000..65143da2 --- /dev/null +++ b/test/java/fr/jayasoft/ivy/xml/OnlineXmlIvyConfigurationParserTest.java @@ -0,0 +1,43 @@ +/* + * This file is subject to the license found in LICENCE.TXT in the root directory of the project. + * + * #SNAPSHOT# + */ +package fr.jayasoft.ivy.xml; + +import java.net.URL; + +import junit.framework.TestCase; +import fr.jayasoft.ivy.DependencyResolver; +import fr.jayasoft.ivy.Ivy; +import fr.jayasoft.ivy.resolver.IvyRepResolver; +import fr.jayasoft.ivy.url.URLHandler; +import fr.jayasoft.ivy.url.URLHandlerDispatcher; +import fr.jayasoft.ivy.url.URLHandlerRegistry; + +/** + * split from XmlIvyConfigurationParserTest due to dependency on network resource + */ +public class OnlineXmlIvyConfigurationParserTest extends TestCase { + // remote.test + + public void testIncludeHttpUrl() throws Exception { + configureURLHandler(); + Ivy ivy = new Ivy(); + XmlIvyConfigurationParser parser = new XmlIvyConfigurationParser(ivy); + parser.parse(new URL("http://www.jayasoft.org/misc/ivy/test/ivyconf-include-http-url.xml")); + + DependencyResolver resolver = ivy.getResolver("ivyrep"); + assertNotNull(resolver); + assertTrue(resolver instanceof IvyRepResolver); + } + + private void configureURLHandler() { + URLHandlerDispatcher dispatcher = new URLHandlerDispatcher(); + URLHandler httpHandler = URLHandlerRegistry.getHttp(); + dispatcher.setDownloader("http", httpHandler); + dispatcher.setDownloader("https", httpHandler); + URLHandlerRegistry.setDefault(dispatcher); + } + +} diff --git a/test/java/fr/jayasoft/ivy/xml/XmlIvyConfigurationParserTest.java b/test/java/fr/jayasoft/ivy/xml/XmlIvyConfigurationParserTest.java index c77fecdd..83d8dc12 100644 --- a/test/java/fr/jayasoft/ivy/xml/XmlIvyConfigurationParserTest.java +++ b/test/java/fr/jayasoft/ivy/xml/XmlIvyConfigurationParserTest.java @@ -291,17 +291,6 @@ public class XmlIvyConfigurationParserTest extends TestCase { assertEquals("included/myrep/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]", ivyPatterns.get(0)); } - public void testIncludeHttpUrl() throws Exception { - configureURLHandler(); - Ivy ivy = new Ivy(); - XmlIvyConfigurationParser parser = new XmlIvyConfigurationParser(ivy); - parser.parse(new URL("http://www.jayasoft.org/misc/ivy/test/ivyconf-include-http-url.xml")); - - DependencyResolver resolver = ivy.getResolver("ivyrep"); - assertNotNull(resolver); - assertTrue(resolver instanceof IvyRepResolver); - } - public void testParser() throws Exception { Ivy ivy = new Ivy(); XmlIvyConfigurationParser parser = new XmlIvyConfigurationParser(ivy);