cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ko...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 351ccf3
Date Tue, 11 Feb 2014 20:32:43 GMT
Updated Branches:
  refs/heads/master 6c770958f -> 351ccf375


Added test for UriUtils.getUpdateUri

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/59364ee9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/59364ee9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/59364ee9

Branch: refs/heads/master
Commit: 59364ee9a418606550a0f9d6b42390ca5adf8e26
Parents: 6c77095
Author: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Authored: Tue Feb 11 18:45:38 2014 +0100
Committer: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Committed: Tue Feb 11 20:43:49 2014 +0100

----------------------------------------------------------------------
 utils/test/com/cloud/utils/UriUtilsTest.java | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/59364ee9/utils/test/com/cloud/utils/UriUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/UriUtilsTest.java b/utils/test/com/cloud/utils/UriUtilsTest.java
index 8474bd0..04fa3e5 100644
--- a/utils/test/com/cloud/utils/UriUtilsTest.java
+++ b/utils/test/com/cloud/utils/UriUtilsTest.java
@@ -30,4 +30,24 @@ public class UriUtilsTest {
         Assert.assertEquals("http://localhost/foo/bar",
                 UriUtils.encodeURIComponent("http://localhost/foo/bar"));
     }
+
+    @Test
+    public void getUpdateUri() {
+        // no password param, no request for encryption
+        Assert.assertEquals("http://localhost/foo/bar?param=true", UriUtils
+                .getUpdateUri("http://localhost/foo/bar?param=true", false));
+        // there is password param but still no request for encryption, should
+        // be unchanged
+        Assert.assertEquals("http://localhost/foo/bar?password=1234", UriUtils
+                .getUpdateUri("http://localhost/foo/bar?password=1234", false));
+        // if there is password param and encryption is requested then it may or
+        // may not be changed depending on how the EncrytionUtils is setup, but
+        // at least it needs to start with the same url
+        Assert.assertTrue(UriUtils.getUpdateUri(
+                "http://localhost/foo/bar?password=1234", true).startsWith(
+                "http://localhost/foo/bar"));
+
+        //XXX: Interesting cases not covered:
+        // * port is ignored and left out from the return value
+    }
 }


Mime
View raw message