You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2014/12/07 15:11:07 UTC

maven-wagon git commit: added IPv4 unit-tests

Repository: maven-wagon
Updated Branches:
  refs/heads/master 2f3543fa9 -> bcaf7300d


added IPv4 unit-tests

Project: http://git-wip-us.apache.org/repos/asf/maven-wagon/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-wagon/commit/bcaf7300
Tree: http://git-wip-us.apache.org/repos/asf/maven-wagon/tree/bcaf7300
Diff: http://git-wip-us.apache.org/repos/asf/maven-wagon/diff/bcaf7300

Branch: refs/heads/master
Commit: bcaf7300dae2328c9cc47f4c877d61f73b1b1d19
Parents: 2f3543f
Author: Hervé Boutemy <hb...@apache.org>
Authored: Sun Dec 7 15:10:58 2014 +0100
Committer: Hervé Boutemy <hb...@apache.org>
Committed: Sun Dec 7 15:10:58 2014 +0100

----------------------------------------------------------------------
 .../org/apache/maven/wagon/PathUtilsTest.java   | 35 ++++++++++++++++++++
 1 file changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-wagon/blob/bcaf7300/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java
----------------------------------------------------------------------
diff --git a/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java b/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java
index 0ce662d..48c5bd4 100644
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java
+++ b/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java
@@ -253,6 +253,41 @@ public class PathUtilsTest
         assertEquals( "/", PathUtils.basedir( "http://localhost/" ) );
     }
 
+    public void testIpV4()
+    {
+        assertUrl( "http://127.0.0.1",
+                   "http", null, null, "127.0.0.1", -1, "/" );
+        assertUrl( "http://127.0.0.1:8080",
+                   "http", null, null, "127.0.0.1", 8080, "/" );
+        assertUrl( "http://127.0.0.1/oo/rest/users",
+                   "http", null, null, "127.0.0.1", -1, "/oo/rest/users" );
+        assertUrl( "http://127.0.0.1:8080/oo/rest/users",
+                   "http", null, null, "127.0.0.1", 8080, "/oo/rest/users" );
+
+        assertUrl( "http://user:password@127.0.0.1",
+                   "http", "user", "password", "127.0.0.1", -1, "/" );
+        assertUrl( "http://user:password@127.0.0.1:8080",
+                   "http", "user", "password", "127.0.0.1", 8080, "/" );
+        assertUrl( "http://user:password@127.0.0.1/oo/rest/users",
+                   "http", "user", "password", "127.0.0.1", -1, "/oo/rest/users" );
+        assertUrl( "http://user:password@127.0.0.1:8080/oo/rest/users",
+                   "http", "user", "password", "127.0.0.1", 8080, "/oo/rest/users" );
+
+        assertUrl( "scm:svn:http://user:password@127.0.0.1:8080/oo/rest/users",
+                   "scm", "user", "password", "127.0.0.1", 8080, "/oo/rest/users" );
+    }
+
+    private void assertUrl( String url, String protocol, String user, String password, String host, int port,
+                            String basedir )
+    {
+        assertEquals( protocol, PathUtils.protocol( url ) );
+        assertEquals( user, PathUtils.user( url ) );
+        assertEquals( password, PathUtils.password( url ) );
+        assertEquals( host, PathUtils.host( url ) );
+        assertEquals( port, PathUtils.port( url ) );
+        assertEquals( basedir, PathUtils.basedir( url ) );
+    }
+
     public void testToRelative()
     {
         assertEquals( "dir", PathUtils.toRelative( new File( "/home/user" ).getAbsoluteFile(),