You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2017/09/04 08:25:14 UTC

qpid-broker-j git commit: NO-JIRA: [System Tests] Encode spaces in the keystore/trustore paths from connection URLs

Repository: qpid-broker-j
Updated Branches:
  refs/heads/master bcea1208e -> 7d2263560


NO-JIRA: [System Tests] Encode spaces in the keystore/trustore paths from connection URLs


Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/7d226356
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/7d226356
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/7d226356

Branch: refs/heads/master
Commit: 7d22635605fe924407785b38d5f85ef87e6efc46
Parents: bcea120
Author: Alex Rudyy <or...@apache.org>
Authored: Mon Sep 4 09:24:53 2017 +0100
Committer: Alex Rudyy <or...@apache.org>
Committed: Mon Sep 4 09:24:53 2017 +0100

----------------------------------------------------------------------
 .../org/apache/qpid/client/ssl/SSLTest.java     | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/7d226356/systests/src/test/java/org/apache/qpid/client/ssl/SSLTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/client/ssl/SSLTest.java b/systests/src/test/java/org/apache/qpid/client/ssl/SSLTest.java
index d1a7444..5839d3c 100644
--- a/systests/src/test/java/org/apache/qpid/client/ssl/SSLTest.java
+++ b/systests/src/test/java/org/apache/qpid/client/ssl/SSLTest.java
@@ -31,6 +31,9 @@ import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.security.Key;
 import java.security.cert.Certificate;
 import java.util.Arrays;
@@ -148,8 +151,7 @@ public class SSLTest extends QpidBrokerTestCase
                          "&trusted_certs_path='%s'" +
                          "'";
 
-            url = String.format(url, getDefaultBroker().getAmqpTlsPort(),
-                                trustCertFile.getCanonicalPath());
+            url = String.format(url, getDefaultBroker().getAmqpTlsPort(), encode(trustCertFile.getCanonicalPath()));
 
             con = getConnection(url);
             assertNotNull("connection should be successful", con);
@@ -597,8 +599,12 @@ public class SSLTest extends QpidBrokerTestCase
                          "&trust_store='%s'&ssl_verify_hostname='false'&trust_store_password='%s'" +
                          "&client_cert_path='%s'&client_cert_priv_key_path='%s''";
 
-            url = String.format(url, getDefaultBroker().getAmqpTlsPort(), TRUSTSTORE, TRUSTSTORE_PASSWORD,
-                                certAndKeyFiles[1].getCanonicalPath(), certAndKeyFiles[0].getCanonicalPath());
+            url = String.format(url,
+                                getDefaultBroker().getAmqpTlsPort(),
+                                TRUSTSTORE,
+                                TRUSTSTORE_PASSWORD,
+                                encode(certAndKeyFiles[1].getCanonicalPath()),
+                                encode(certAndKeyFiles[0].getCanonicalPath()));
 
             Connection con = getConnection(url);
             assertNotNull("connection should be successful", con);
@@ -755,5 +761,9 @@ public class SSLTest extends QpidBrokerTestCase
         return certificateFile;
     }
 
-
+    private String encode(final String canonicalPath) throws UnsupportedEncodingException
+    {
+        return URLEncoder.encode(URLEncoder.encode(canonicalPath, StandardCharsets.UTF_8.name()).replace("+", "%20"),
+                                 StandardCharsets.UTF_8.name());
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org