ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gin...@apache.org
Subject ant-ivy git commit: refactor tests with hardcoded Maven Central URL
Date Tue, 05 Dec 2017 11:15:31 GMT
Repository: ant-ivy
Updated Branches:
  refs/heads/master d80acb29c -> 2f4bf4db6


refactor tests with hardcoded Maven Central URL

Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/2f4bf4db
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/2f4bf4db
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/2f4bf4db

Branch: refs/heads/master
Commit: 2f4bf4db63516297d2c695932fb65fdbc360558f
Parents: d80acb2
Author: Gintas Grigelionis <gintas@apache.org>
Authored: Tue Dec 5 12:15:20 2017 +0100
Committer: Gintas Grigelionis <gintas@apache.org>
Committed: Tue Dec 5 12:15:20 2017 +0100

----------------------------------------------------------------------
 test/java/org/apache/ivy/osgi/obr/OBRParserTest.java     | 11 +++++++----
 .../updatesite/UpdateSiteAndIbiblioResolverTest.java     |  3 ++-
 .../apache/ivy/plugins/resolver/IBiblioResolverTest.java |  6 ++++--
 .../apache/ivy/util/url/HttpclientURLHandlerTest.java    |  6 +++---
 4 files changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/2f4bf4db/test/java/org/apache/ivy/osgi/obr/OBRParserTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/osgi/obr/OBRParserTest.java b/test/java/org/apache/ivy/osgi/obr/OBRParserTest.java
index 2f7486b..91fb4ab 100644
--- a/test/java/org/apache/ivy/osgi/obr/OBRParserTest.java
+++ b/test/java/org/apache/ivy/osgi/obr/OBRParserTest.java
@@ -17,8 +17,10 @@
  */
 package org.apache.ivy.osgi.obr;
 
+import static org.apache.ivy.plugins.resolver.IBiblioResolver.DEFAULT_M2_ROOT;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -63,10 +65,11 @@ public class OBRParserTest {
                 String url0 = md.getAllArtifacts()[0].getUrl().toExternalForm();
                 String type1 = md.getAllArtifacts()[1].getType();
                 String url1 = md.getAllArtifacts()[1].getUrl().toExternalForm();
-                String jarUrl = "https://repo1.maven.org/maven2/org/apache/felix/"
-                        + "org.apache.felix.bundlerepository/1.0.3/org.apache.felix.bundlerepository-1.0.3.jar";
-                String srcUrl = "http://oscar-osgi.sf.net/obr2/org.apache.felix.bundlerepository/"
-                        + "org.apache.felix.bundlerepository-1.0.3-src.jar";
+                assertTrue("Default Maven URL must end with '/'", DEFAULT_M2_ROOT.endsWith("/"));
+                String jarUrl = DEFAULT_M2_ROOT + "org/apache/felix/org.apache.felix."
+                        + "bundlerepository/1.0.3/org.apache.felix.bundlerepository-1.0.3.jar";
+                String srcUrl = "http://oscar-osgi.sf.net/obr2/org.apache.felix."
+                        + "bundlerepository/org.apache.felix.bundlerepository-1.0.3-src.jar";
                 if (type0.equals("jar")) {
                     assertEquals(jarUrl, url0);
                     assertEquals("source", type1);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/2f4bf4db/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteAndIbiblioResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteAndIbiblioResolverTest.java
b/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteAndIbiblioResolverTest.java
index b04d2b9..d7f212f 100644
--- a/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteAndIbiblioResolverTest.java
+++ b/test/java/org/apache/ivy/osgi/updatesite/UpdateSiteAndIbiblioResolverTest.java
@@ -35,6 +35,7 @@ import org.apache.ivy.plugins.resolver.IBiblioResolver;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.apache.ivy.plugins.resolver.IBiblioResolver.DEFAULT_M2_ROOT;
 import static org.junit.Assert.assertNotNull;
 
 public class UpdateSiteAndIbiblioResolverTest {
@@ -68,7 +69,7 @@ public class UpdateSiteAndIbiblioResolverTest {
 
         resolver2 = new IBiblioResolver();
         resolver2.setName("maven2");
-        settings.setVariable("ivy.ibiblio.default.artifact.root", "https://repo1.maven.org/maven2/");
+        settings.setVariable("ivy.ibiblio.default.artifact.root", DEFAULT_M2_ROOT);
         settings.setVariable("ivy.ibiblio.default.artifact.pattern",
             "[organisation]/[module]/[revision]/[artifact]-[revision].[ext]");
         resolver2.setSettings(settings);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/2f4bf4db/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java b/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
index 5549344..c8946d7 100644
--- a/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
+++ b/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
@@ -17,6 +17,7 @@
  */
 package org.apache.ivy.plugins.resolver;
 
+import static org.apache.ivy.plugins.resolver.IBiblioResolver.DEFAULT_M2_ROOT;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -119,8 +120,9 @@ public class IBiblioResolverTest extends AbstractDependencyResolverTest
{
         l = resolver.getArtifactPatterns();
         assertNotNull(l);
         assertEquals(1, l.size());
-        assertEquals(
-            "https://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]",
+        assertTrue("Default Maven URL must end with '/'", DEFAULT_M2_ROOT.endsWith("/"));
+        assertEquals(DEFAULT_M2_ROOT
+            + "[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]",
             l.get(0));
 
         resolver = (IBiblioResolver) settings.getResolver("ibiblioD");

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/2f4bf4db/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java b/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java
index e30b7b3..b15092e 100644
--- a/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java
+++ b/test/java/org/apache/ivy/util/url/HttpclientURLHandlerTest.java
@@ -36,6 +36,7 @@ import java.nio.file.Path;
 import java.util.Collections;
 import java.util.Random;
 
+import static org.apache.ivy.plugins.resolver.IBiblioResolver.DEFAULT_M2_ROOT;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -90,9 +91,8 @@ public class HttpclientURLHandlerTest {
     @Test
     public void testGetURLInfo() throws Exception {
         URLHandler handler = new HttpClientHandler();
-        URLInfo info = handler
-                .getURLInfo(new URL(
-                        "https://repo1.maven.org/maven2/commons-lang/commons-lang/[1.0,3.0[/commons-lang-[1.0,3.0[.pom"),
defaultTimeoutConstraint);
+        URLInfo info = handler.getURLInfo(new URL(DEFAULT_M2_ROOT
+                + "/commons-lang/commons-lang/[1.0,3.0[/commons-lang-[1.0,3.0[.pom"), defaultTimeoutConstraint);
 
         assertEquals(URLHandler.UNAVAILABLE, info);
     }


Mime
View raw message