You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2017/11/20 10:36:54 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/6.1.x a1cb443cd -> bc81238bf


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

Cherry picked from master with 7d22635605fe924407785b38d5f85ef87e6efc46


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/bc81238b
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/bc81238b
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/bc81238b

Branch: refs/heads/6.1.x
Commit: bc81238bf92a25970d6b83ec77c9b65caa14ee30
Parents: a1cb443
Author: Alex Rudyy <or...@apache.org>
Authored: Mon Sep 4 09:24:53 2017 +0100
Committer: Keith Wall <kw...@apache.org>
Committed: Mon Nov 20 10:36:35 2017 +0000

----------------------------------------------------------------------
 .../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/bc81238b/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 efea492..f0bd388 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;
@@ -121,8 +124,7 @@ public class SSLTest extends QpidBrokerTestCase
                          "'";
             File trustCertFile = extractCertFileFromTestTrustStore();
 
-            url = String.format(url, getDefaultBroker().getAmqpTlsPort(),
-                                trustCertFile.getCanonicalPath());
+            url = String.format(url, getDefaultBroker().getAmqpTlsPort(), encode(trustCertFile.getCanonicalPath()));
 
             Connection con = getConnection(new AMQConnectionURL(url));
             assertNotNull("connection should be successful", con);
@@ -514,8 +516,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()));
 
             final AMQConnectionURL connectionURL = new AMQConnectionURL(url);
             Connection con = getConnection(connectionURL);
@@ -673,5 +679,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