You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2002/12/10 05:32:47 UTC
cvs commit: jakarta-turbine-maven/src/test/java/org/apache/maven/util HttpUtilsTest.java
jvanzyl 2002/12/09 20:32:47
Modified: src/test/java/org/apache/maven/util HttpUtilsTest.java
Log:
o Adding test a simple url parsing which will pick out a username
and password of the form:
http://username:password@repository.mycompany.com
Revision Changes Path
1.2 +21 -0 jakarta-turbine-maven/src/test/java/org/apache/maven/util/HttpUtilsTest.java
Index: HttpUtilsTest.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/test/java/org/apache/maven/util/HttpUtilsTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HttpUtilsTest.java 26 Nov 2002 23:36:22 -0000 1.1
+++ HttpUtilsTest.java 10 Dec 2002 04:32:47 -0000 1.2
@@ -64,6 +64,27 @@
// JUnitDoclet end method getFile
}
+ /**
+ * Test the function that will parse an url which contains
+ * a username and password into its constituent parts.
+ */
+ public void testParseUrl() throws Exception
+ {
+ String url = "http://username:password@repository.mycompany.com";
+ String[] up = HttpUtils.parseUrl( url );
+
+ assertEquals( "username", up[0] );
+ assertEquals( "password", up[1] );
+ assertEquals( "http://repository.mycompany.com", up[2] );
+
+ url = "http://repository.mycompany.com";
+ up = HttpUtils.parseUrl( url );
+
+ assertNull( up[0] );
+ assertNull( up[1] );
+ assertEquals( "http://repository.mycompany.com", up[2] );
+ }
+
/**
* JUnitDoclet moves marker to this method, if there is not match