cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject [28/50] [abbrv] git commit: updated refs/heads/feature/vpc-ipv6 to 6140db5
Date Mon, 08 Jun 2015 09:45:49 GMT
Fixes LB certificate tests failure when the full path has a special character like whitespace
or many others.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #336


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

Branch: refs/heads/feature/vpc-ipv6
Commit: 00884b3b0bad1d09d68258663a8f93653dfeb718
Parents: 3d4d152
Author: Rafael da Fonseca <rsafonseca@gmail.com>
Authored: Sat May 30 20:31:55 2015 +0200
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Thu Jun 4 00:11:09 2015 +0200

----------------------------------------------------------------------
 .../cloudstack/network/lb/CertServiceTest.java  | 52 ++++++++++----------
 1 file changed, 27 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/00884b3b/server/test/org/apache/cloudstack/network/lb/CertServiceTest.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/network/lb/CertServiceTest.java b/server/test/org/apache/cloudstack/network/lb/CertServiceTest.java
index 2c34bff..915f77d 100644
--- a/server/test/org/apache/cloudstack/network/lb/CertServiceTest.java
+++ b/server/test/org/apache/cloudstack/network/lb/CertServiceTest.java
@@ -30,6 +30,7 @@ import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
+import java.net.URLDecoder;
 
 import org.apache.cloudstack.api.command.user.loadbalancer.DeleteSslCertCmd;
 import com.cloud.user.User;
@@ -55,6 +56,7 @@ import com.cloud.user.UserVO;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.TransactionLegacy;
+import java.nio.charset.Charset;
 
 public class CertServiceTest {
 
@@ -97,9 +99,9 @@ public class CertServiceTest {
 
         TransactionLegacy txn = TransactionLegacy.open("runUploadSslCertWithCAChain");
 
-        String certFile = getClass().getResource("/certs/rsa_ca_signed.crt").getFile();
-        String keyFile = getClass().getResource("/certs/rsa_ca_signed.key").getFile();
-        String chainFile = getClass().getResource("/certs/root_chain.crt").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name());
+        String chainFile = URLDecoder.decode(getClass().getResource("/certs/root_chain.crt").getFile(),Charset.defaultCharset().name());
 
         String cert = readFileToString(new File(certFile));
         String key = readFileToString(new File(keyFile));
@@ -149,8 +151,8 @@ public class CertServiceTest {
 
         TransactionLegacy txn = TransactionLegacy.open("runUploadSslCertSelfSignedWithPassword");
 
-        String certFile = getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile();
-        String keyFile = getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile(),Charset.defaultCharset().name());
         String password = "test";
 
         String cert = readFileToString(new File(certFile));
@@ -200,8 +202,8 @@ public class CertServiceTest {
 
         TransactionLegacy txn = TransactionLegacy.open("runUploadSslCertSelfSignedNoPassword");
 
-        String certFile = getClass().getResource("/certs/rsa_self_signed.crt").getFile();
-        String keyFile = getClass().getResource("/certs/rsa_self_signed.key").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
 
         String cert = readFileToString(new File(certFile));
         String key = readFileToString(new File(keyFile));
@@ -243,9 +245,9 @@ public class CertServiceTest {
     public void runUploadSslCertBadChain() throws IOException, IllegalAccessException, NoSuchFieldException
{
         Assume.assumeTrue(isOpenJdk() || isJCEInstalled());
 
-        String certFile = getClass().getResource("/certs/rsa_ca_signed.crt").getFile();
-        String keyFile = getClass().getResource("/certs/rsa_ca_signed.key").getFile();
-        String chainFile = getClass().getResource("/certs/rsa_self_signed.crt").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name());
+        String chainFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
 
         String cert = readFileToString(new File(certFile));
         String key = readFileToString(new File(keyFile));
@@ -295,9 +297,9 @@ public class CertServiceTest {
 
         Assume.assumeTrue(isOpenJdk() || isJCEInstalled());
 
-        String certFile = getClass().getResource("/certs/rsa_ca_signed.crt").getFile();
-        String keyFile = getClass().getResource("/certs/rsa_ca_signed.key").getFile();
-        String chainFile = getClass().getResource("/certs/non_root.crt").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_ca_signed.key").getFile(),Charset.defaultCharset().name());
+        String chainFile = URLDecoder.decode(getClass().getResource("/certs/non_root.crt").getFile(),Charset.defaultCharset().name());
 
         String cert = readFileToString(new File(certFile));
         String key = readFileToString(new File(keyFile));
@@ -346,8 +348,8 @@ public class CertServiceTest {
     @Test
     public void runUploadSslCertBadPassword() throws IOException, IllegalAccessException,
NoSuchFieldException {
 
-        String certFile = getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile();
-        String keyFile = getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed_with_pwd.key").getFile(),Charset.defaultCharset().name());
         String password = "bad_password";
 
         String cert = readFileToString(new File(certFile));
@@ -395,8 +397,8 @@ public class CertServiceTest {
     @Test
     public void runUploadSslCertBadkeyPair() throws IOException, IllegalAccessException,
NoSuchFieldException {
         // Reading appropritate files
-        String certFile = getClass().getResource("/certs/rsa_self_signed.crt").getFile();
-        String keyFile = getClass().getResource("/certs/non_root.key").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/non_root.key").getFile(),Charset.defaultCharset().name());
 
         String cert = readFileToString(new File(certFile));
         String key = readFileToString(new File(keyFile));
@@ -438,8 +440,8 @@ public class CertServiceTest {
     public void runUploadSslCertBadkeyAlgo() throws IOException, IllegalAccessException,
NoSuchFieldException {
 
         // Reading appropritate files
-        String certFile = getClass().getResource("/certs/rsa_self_signed.crt").getFile();
-        String keyFile = getClass().getResource("/certs/dsa_self_signed.key").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/dsa_self_signed.key").getFile(),Charset.defaultCharset().name());
 
         String cert = readFileToString(new File(certFile));
         String key = readFileToString(new File(keyFile));
@@ -482,8 +484,8 @@ public class CertServiceTest {
     public void runUploadSslCertExpiredCert() throws IOException, IllegalAccessException,
NoSuchFieldException {
 
         // Reading appropritate files
-        String certFile = getClass().getResource("/certs/expired_cert.crt").getFile();
-        String keyFile = getClass().getResource("/certs/rsa_self_signed.key").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/expired_cert.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
 
         String cert = readFileToString(new File(certFile));
         String key = readFileToString(new File(keyFile));
@@ -525,8 +527,8 @@ public class CertServiceTest {
     @Test
     public void runUploadSslCertNotX509() throws IOException, IllegalAccessException, NoSuchFieldException
{
         // Reading appropritate files
-        String certFile = getClass().getResource("/certs/non_x509_pem.crt").getFile();
-        String keyFile = getClass().getResource("/certs/rsa_self_signed.key").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/non_x509_pem.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
 
         String cert = readFileToString(new File(certFile));
         String key = readFileToString(new File(keyFile));
@@ -569,8 +571,8 @@ public class CertServiceTest {
     public void runUploadSslCertBadFormat() throws IOException, IllegalAccessException, NoSuchFieldException
{
 
         // Reading appropritate files
-        String certFile = getClass().getResource("/certs/bad_format_cert.crt").getFile();
-        String keyFile = getClass().getResource("/certs/rsa_self_signed.key").getFile();
+        String certFile = URLDecoder.decode(getClass().getResource("/certs/bad_format_cert.crt").getFile(),Charset.defaultCharset().name());
+        String keyFile = URLDecoder.decode(getClass().getResource("/certs/rsa_self_signed.key").getFile(),Charset.defaultCharset().name());
 
         String cert = readFileToString(new File(certFile));
         String key = readFileToString(new File(keyFile));


Mime
View raw message