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 2018/01/23 10:39:18 UTC

qpid-broker-j git commit: QPID-6933: [System Tests] Fix MessageEncryptionTest

Repository: qpid-broker-j
Updated Branches:
  refs/heads/master c793b7276 -> 28130e5ef


QPID-6933: [System Tests] Fix MessageEncryptionTest


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

Branch: refs/heads/master
Commit: 28130e5eff80be4c171faac92df54a47cf9569f0
Parents: c793b72
Author: Alex Rudyy <or...@apache.org>
Authored: Tue Jan 23 10:37:59 2018 +0000
Committer: Alex Rudyy <or...@apache.org>
Committed: Tue Jan 23 10:38:15 2018 +0000

----------------------------------------------------------------------
 .../QpidJmsClient0xConnectionBuilder.java       | 26 ++++++++++++++------
 .../encryption/MessageEncryptionTest.java       | 11 +++------
 2 files changed, 22 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/28130e5e/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/QpidJmsClient0xConnectionBuilder.java
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/QpidJmsClient0xConnectionBuilder.java b/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/QpidJmsClient0xConnectionBuilder.java
index 2771f32..a4bf082 100644
--- a/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/QpidJmsClient0xConnectionBuilder.java
+++ b/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/QpidJmsClient0xConnectionBuilder.java
@@ -23,7 +23,6 @@ package org.apache.qpid.systests;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
 import java.util.TreeMap;
@@ -255,7 +254,7 @@ public class QpidJmsClient0xConnectionBuilder implements ConnectionBuilder
     @Override
     public ConnectionBuilder setEncryptionTrustStore(final String encryptionTrustStoreLocation)
     {
-        _options.put("encryption_trust_store", encryptionTrustStoreLocation);
+        _options.put("encryption_trust_store", encodeConnectionOption(encryptionTrustStoreLocation));
         return this;
     }
 
@@ -269,7 +268,7 @@ public class QpidJmsClient0xConnectionBuilder implements ConnectionBuilder
     @Override
     public ConnectionBuilder setEncryptionKeyStore(final String encryptionKeyStoreLocation)
     {
-        _options.put("encryption_key_store", encryptionKeyStoreLocation);
+        _options.put("encryption_key_store", encodeConnectionOption(encryptionKeyStoreLocation));
         return this;
     }
 
@@ -328,7 +327,7 @@ public class QpidJmsClient0xConnectionBuilder implements ConnectionBuilder
             cUrlBuilder.append(_sslPort).append("?ssl='true'");
             if (_keyStoreLocation != null)
             {
-                cUrlBuilder.append("&key_store='").append(encodePathOption(_keyStoreLocation)).append('\'');
+                cUrlBuilder.append("&key_store='").append(encodeBrokerOption(_keyStoreLocation)).append('\'');
             }
             if (_keyStorePassword != null)
             {
@@ -336,7 +335,7 @@ public class QpidJmsClient0xConnectionBuilder implements ConnectionBuilder
             }
             if (_trustStoreLocation != null)
             {
-                cUrlBuilder.append("&trust_store='").append(encodePathOption(_trustStoreLocation)).append('\'');
+                cUrlBuilder.append("&trust_store='").append(encodeBrokerOption(_trustStoreLocation)).append('\'');
             }
             if (_trustStorePassword != null)
             {
@@ -411,12 +410,23 @@ public class QpidJmsClient0xConnectionBuilder implements ConnectionBuilder
         }
     }
 
-    private String encodePathOption(final String canonicalPath)
+    private String encodeBrokerOption(final String canonicalPath)
     {
         try
         {
-            return URLEncoder.encode(URLEncoder.encode(canonicalPath, StandardCharsets.UTF_8.name()).replace("+", "%20"),
-                                     StandardCharsets.UTF_8.name());
+            return URLEncoder.encode(encodeConnectionOption(canonicalPath), StandardCharsets.UTF_8.name());
+        }
+        catch (UnsupportedEncodingException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private String encodeConnectionOption(final String canonicalPath)
+    {
+        try
+        {
+            return URLEncoder.encode(canonicalPath, StandardCharsets.UTF_8.name()).replace("+", "%20");
         }
         catch (UnsupportedEncodingException e)
         {

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/28130e5e/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/encryption/MessageEncryptionTest.java
----------------------------------------------------------------------
diff --git a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/encryption/MessageEncryptionTest.java b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/encryption/MessageEncryptionTest.java
index ca4a8dd..d2ad3be 100644
--- a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/encryption/MessageEncryptionTest.java
+++ b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/encryption/MessageEncryptionTest.java
@@ -67,10 +67,7 @@ public class MessageEncryptionTest extends JmsTestBase
             "ADDR: %s ;  {x-send-encrypted : true, x-encrypted-recipients : " + ENCRYPTED_RECIPIENTS + "}";
     private static final String QUEUE_BURL_WITH_SEND_ENCRYPTED =
             "BURL:direct:///%s/%s?sendencrypted='true'&encryptedrecipients=" + ENCRYPTED_RECIPIENTS;
-    private static final String BROKER_PEERSTORE = TEST_PROFILE_RESOURCE_BASE
-                                                   + "${file.separator}test-profiles${file.separator}"
-                                                   + "test_resources${file.separator}ssl${file.separator}"
-                                                   + "java_broker_peerstore.jks";
+    private static final String BROKER_PEERSTORE = TEST_PROFILE_RESOURCE_BASE + TestSSLConstants.BROKER_PEERSTORE;
 
     @Before
     public void setUp() throws Exception
@@ -88,7 +85,7 @@ public class MessageEncryptionTest extends JmsTestBase
     {
         Queue queue = createQueue(getTestName());
         Connection producerConnection =
-                getConnectionBuilder().setEncryptionTrustStore(TestSSLConstants.BROKER_PEERSTORE)
+                getConnectionBuilder().setEncryptionTrustStore(BROKER_PEERSTORE)
                                       .setEncryptionTrustStorePassword(BROKER_PEERSTORE_PASSWORD)
                                       .build();
         try
@@ -139,7 +136,7 @@ public class MessageEncryptionTest extends JmsTestBase
         String queueName = getTestName();
         Queue queue = createQueue(queueName);
         Connection producerConnection =
-                getConnectionBuilder().setEncryptionTrustStore(TestSSLConstants.BROKER_PEERSTORE)
+                getConnectionBuilder().setEncryptionTrustStore(BROKER_PEERSTORE)
                                       .setEncryptionTrustStorePassword(BROKER_PEERSTORE_PASSWORD)
                                       .build();
         try
@@ -188,7 +185,7 @@ public class MessageEncryptionTest extends JmsTestBase
         String queueName = getTestName();
         Queue queue = createQueue(queueName);
         Connection producerConnection =
-                getConnectionBuilder().setEncryptionTrustStore(TestSSLConstants.BROKER_PEERSTORE)
+                getConnectionBuilder().setEncryptionTrustStore(BROKER_PEERSTORE)
                                       .setEncryptionTrustStorePassword(BROKER_PEERSTORE_PASSWORD)
                                       .build();
         try


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