qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject [qpid-broker-j] 05/06: NO-JIRA: [Tests] Remove deprecated method setSslPort from ConnectionBuilder
Date Mon, 08 Jul 2019 14:31:41 GMT
This is an automated email from the ASF dual-hosted git repository.

orudyy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git

commit e22ff60044895d4e65b97376c442984872272ef9
Author: Alex Rudyy <orudyy@apache.org>
AuthorDate: Mon Jul 8 15:24:16 2019 +0100

    NO-JIRA: [Tests] Remove deprecated method setSslPort from ConnectionBuilder
---
 .../apache/qpid/systests/ConnectionBuilder.java    |  3 --
 .../systests/QpidJmsClient0xConnectionBuilder.java | 12 ++------
 .../systests/QpidJmsClientConnectionBuilder.java   | 26 +++++-------------
 .../extensions/management/AmqpManagementTest.java  |  2 +-
 .../extensions/sasl/AuthenticationTest.java        | 18 ++++++------
 .../systests/jms_1_1/extensions/tls/TlsTest.java   | 32 +++++++++++-----------
 6 files changed, 35 insertions(+), 58 deletions(-)

diff --git a/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/ConnectionBuilder.java
b/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/ConnectionBuilder.java
index fe64610..04cd4e1 100644
--- a/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/ConnectionBuilder.java
+++ b/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/ConnectionBuilder.java
@@ -35,9 +35,6 @@ public interface ConnectionBuilder
     ConnectionBuilder setHost(String host);
     ConnectionBuilder setPort(int port);
 
-    @Deprecated
-    ConnectionBuilder setSslPort(int port);
-
     ConnectionBuilder setPrefetch(int prefetch);
     ConnectionBuilder setClientId(String clientId);
     ConnectionBuilder setUsername(String username);
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 7935cb3..3219582 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
@@ -52,7 +52,6 @@ public class QpidJmsClient0xConnectionBuilder implements ConnectionBuilder
     private int _connectdelay;
     private String _host = "localhost";
     private int _port;
-    private int _sslPort;
     private String _keyStoreLocation;
     private String _keyStorePassword;
     private String _trustStoreLocation;
@@ -72,7 +71,7 @@ public class QpidJmsClient0xConnectionBuilder implements ConnectionBuilder
     public ConnectionBuilder setPort(final int port)
     {
         _port = port;
-        return setSslPort(port);
+        return this;
     }
 
     @Override
@@ -83,13 +82,6 @@ public class QpidJmsClient0xConnectionBuilder implements ConnectionBuilder
     }
 
     @Override
-    public ConnectionBuilder setSslPort(final int port)
-    {
-        _sslPort = port;
-        return this;
-    }
-
-    @Override
     public ConnectionBuilder setPrefetch(final int prefetch)
     {
         _options.put("maxprefetch", prefetch);
@@ -329,7 +321,7 @@ public class QpidJmsClient0xConnectionBuilder implements ConnectionBuilder
         cUrlBuilder.append("?");
 
         final List<Integer> copy = new ArrayList<>(_failoverPorts.size() + 1);
-        copy.add(_enableTls ? _sslPort : _port);
+        copy.add(_port);
 
         if (_enableFailover)
         {
diff --git a/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/QpidJmsClientConnectionBuilder.java
b/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/QpidJmsClientConnectionBuilder.java
index c47e81e..dc39edb 100644
--- a/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/QpidJmsClientConnectionBuilder.java
+++ b/systests/qpid-systests-jms-core/src/main/java/org/apache/qpid/systests/QpidJmsClientConnectionBuilder.java
@@ -46,7 +46,6 @@ public class QpidJmsClientConnectionBuilder implements ConnectionBuilder
     private static final AtomicInteger CLIENTID_COUNTER = new AtomicInteger();
     private String _host;
     private int _port;
-    private int _sslPort;
     private Map<String, Object> _options;
     private boolean _enableTls;
     private boolean _enableFailover;
@@ -73,7 +72,7 @@ public class QpidJmsClientConnectionBuilder implements ConnectionBuilder
     public ConnectionBuilder setPort(final int port)
     {
         _port = port;
-        return setSslPort(port);
+        return this;
     }
 
     @Override
@@ -84,13 +83,6 @@ public class QpidJmsClientConnectionBuilder implements ConnectionBuilder
     }
 
     @Override
-    public ConnectionBuilder setSslPort(final int port)
-    {
-        _sslPort = port;
-        return this;
-    }
-
-    @Override
     public ConnectionBuilder setPrefetch(final int prefetch)
     {
         _options.put("jms.prefetchPolicy.all", prefetch);
@@ -341,7 +333,7 @@ public class QpidJmsClientConnectionBuilder implements ConnectionBuilder
             final String transportQuery = transportQueryBuilder.toString();
 
             final List<Integer> copy = new ArrayList<>(_failoverPorts.size()
+ 1);
-            copy.add(_enableTls ? _sslPort : _port);
+            copy.add(_port);
             copy.addAll(_failoverPorts);
 
             final String failover = copy.stream()
@@ -350,17 +342,13 @@ public class QpidJmsClientConnectionBuilder implements ConnectionBuilder
             connectionUrlBuilder.append(failover);
             appendOptions(options, connectionUrlBuilder);
         }
-        else if (!_enableTls)
+        connectionUrlBuilder.append(_transport);
+        if (_enableTls)
         {
-            connectionUrlBuilder.append(_transport).append("://").append(_host).append(":").append(_port);
-
-            appendOptions(options, connectionUrlBuilder);
-        }
-        else
-        {
-            connectionUrlBuilder.append(_transport).append("s").append("://").append(_host).append(":").append(_sslPort);
-            appendOptions(options, connectionUrlBuilder);
+            connectionUrlBuilder.append("s");
         }
+        connectionUrlBuilder.append("://").append(_host).append(":").append(_port);
+        appendOptions(options, connectionUrlBuilder);
         return connectionUrlBuilder.toString();
     }
 
diff --git a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/management/AmqpManagementTest.java
b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/management/AmqpManagementTest.java
index 4704829..d6aa747 100644
--- a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/management/AmqpManagementTest.java
+++ b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/management/AmqpManagementTest.java
@@ -692,7 +692,7 @@ public class AmqpManagementTest extends JmsTestBase
                                             getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP).getPort());
 
         Connection connection = getConnectionBuilder().setTls(true)
-                                                      .setSslPort(tlsPort)
+                                                      .setPort(tlsPort)
                                                       .setTrustStoreLocation(TRUSTSTORE)
                                                       .setTrustStorePassword(TRUSTSTORE_PASSWORD)
                                                       .build();
diff --git a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/sasl/AuthenticationTest.java
b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/sasl/AuthenticationTest.java
index 9661a6d..e5f033f 100644
--- a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/sasl/AuthenticationTest.java
+++ b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/sasl/AuthenticationTest.java
@@ -157,7 +157,7 @@ public class AuthenticationTest extends JmsTestBase
     {
         int port = createExternalProviderAndTlsPort();
 
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setTls(true)
                                                       .setSaslMechanisms(ExternalAuthenticationManagerImpl.MECHANISM_NAME)
                                                       .setKeyStoreLocation(KEYSTORE)
@@ -185,7 +185,7 @@ public class AuthenticationTest extends JmsTestBase
 
         try
         {
-            getConnectionBuilder().setSslPort(port)
+            getConnectionBuilder().setPort(port)
                                   .setTls(true)
                                   .setSaslMechanisms(ExternalAuthenticationManagerImpl.MECHANISM_NAME)
                                   .setKeyStoreLocation(KEYSTORE)
@@ -215,7 +215,7 @@ public class AuthenticationTest extends JmsTestBase
 
         try
         {
-            getConnectionBuilder().setSslPort(port)
+            getConnectionBuilder().setPort(port)
                                   .setTls(true)
                                   .setSaslMechanisms(ExternalAuthenticationManagerImpl.MECHANISM_NAME)
                                   .setKeyStoreLocation(TEST_PROFILE_RESOURCE_BASE + EXPIRED_KEYSTORE)
@@ -240,7 +240,7 @@ public class AuthenticationTest extends JmsTestBase
         trustStoreAttributes.put(FileTrustStore.PEERS_ONLY, true);
         int port = createExternalProviderAndTlsPort(trustStoreAttributes);
 
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setTls(true)
                                                       .setSaslMechanisms(ExternalAuthenticationManagerImpl.MECHANISM_NAME)
                                                       .setKeyStoreLocation(KEYSTORE)
@@ -262,7 +262,7 @@ public class AuthenticationTest extends JmsTestBase
         try
         {
 
-            getConnectionBuilder().setSslPort(port)
+            getConnectionBuilder().setPort(port)
                                   .setTls(true)
                                   .setSaslMechanisms(ExternalAuthenticationManagerImpl.MECHANISM_NAME)
                                   .setKeyStoreLocation(KEYSTORE)
@@ -311,7 +311,7 @@ public class AuthenticationTest extends JmsTestBase
         trustStoreAttributes.put(FileTrustStore.PEERS_ONLY, true);
         int port = createExternalProviderAndTlsPort(trustStoreAttributes, trustStoreName,
false);
 
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setTls(true)
                                                       .setSaslMechanisms(ExternalAuthenticationManagerImpl.MECHANISM_NAME)
                                                       .setKeyStoreLocation(KEYSTORE)
@@ -330,7 +330,7 @@ public class AuthenticationTest extends JmsTestBase
         }
 
         //use the app2 cert, which is NOT in the peerstore (but is signed by the same CA
as app1)
-        Connection connection2 = getConnectionBuilder().setSslPort(port)
+        Connection connection2 = getConnectionBuilder().setPort(port)
                               .setTls(true)
                               .setSaslMechanisms(ExternalAuthenticationManagerImpl.MECHANISM_NAME)
                               .setKeyStoreLocation(KEYSTORE)
@@ -359,7 +359,7 @@ public class AuthenticationTest extends JmsTestBase
 
         String clientId = getTestName();
         int port = createExternalProviderAndTlsPort(trustStoreAttributes, null, true);
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setTls(true)
                                                       .setSaslMechanisms(ExternalAuthenticationManagerImpl.MECHANISM_NAME)
                                                       .setKeyStoreLocation(KEYSTORE)
@@ -392,7 +392,7 @@ public class AuthenticationTest extends JmsTestBase
 
         String clientId = getTestName();
         int port = createExternalProviderAndTlsPort(trustStoreAttributes, null, false);
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setTls(true)
                                                       .setSaslMechanisms(ExternalAuthenticationManagerImpl.MECHANISM_NAME)
                                                       .setKeyStoreLocation(KEYSTORE)
diff --git a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/tls/TlsTest.java
b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/tls/TlsTest.java
index 71d5e3c..01d69f3 100644
--- a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/tls/TlsTest.java
+++ b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/tls/TlsTest.java
@@ -124,7 +124,7 @@ public class TlsTest extends JmsTestBase
         int port = configureTlsPort(getTestPortName(), true, false, false);
 
         InetSocketAddress brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setHost(brokerAddress.getHostName())
                                                       .setTls(true)
                                                       .setKeyStoreLocation(KEYSTORE)
@@ -153,7 +153,7 @@ public class TlsTest extends JmsTestBase
         File trustCertFile = extractCertFileFromTestTrustStore();
 
         InetSocketAddress brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setHost(brokerAddress.getHostName())
                                                       .setTls(true)
                                                       .setOptions(Collections.singletonMap("trusted_certs_path",
@@ -178,7 +178,7 @@ public class TlsTest extends JmsTestBase
         try
         {
             InetSocketAddress brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
-            getConnectionBuilder().setSslPort(brokerAddress.getPort())
+            getConnectionBuilder().setPort(brokerAddress.getPort())
                                   .setHost(brokerAddress.getHostName())
                                   .setTls(true)
                                   .build();
@@ -205,7 +205,7 @@ public class TlsTest extends JmsTestBase
 
         try
         {
-            getConnectionBuilder().setSslPort(port)
+            getConnectionBuilder().setPort(port)
                                   .setHost("127.0.0.1")
                                   .setTls(true)
                                   .setKeyStoreLocation(KEYSTORE)
@@ -220,7 +220,7 @@ public class TlsTest extends JmsTestBase
             // PASS
         }
 
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setHost("127.0.0.1")
                                                       .setTls(true)
                                                       .setKeyStoreLocation(KEYSTORE)
@@ -247,7 +247,7 @@ public class TlsTest extends JmsTestBase
         setSslStoreSystemProperties();
         try
         {
-            Connection connection = getConnectionBuilder().setSslPort(port)
+            Connection connection = getConnectionBuilder().setPort(port)
                                                           .setTls(true)
                                                           .build();
             try
@@ -274,7 +274,7 @@ public class TlsTest extends JmsTestBase
         try
         {
             Connection connection = getConnectionBuilder().setClientId(getTestName())
-                                                          .setSslPort(port)
+                                                          .setPort(port)
                                                           .setTls(true)
                                                           .setKeyAlias(TestSSLConstants.CERT_ALIAS_APP1)
                                                           .build();
@@ -287,7 +287,7 @@ public class TlsTest extends JmsTestBase
                 connection.close();
             }
 
-            Connection connection2 = getConnectionBuilder().setSslPort(port)
+            Connection connection2 = getConnectionBuilder().setPort(port)
                                                            .setTls(true)
                                                            .setKeyAlias(TestSSLConstants.CERT_ALIAS_APP2)
                                                            .build();
@@ -317,7 +317,7 @@ public class TlsTest extends JmsTestBase
         setSslStoreSystemProperties();
         try
         {
-            getConnectionBuilder().setSslPort(port)
+            getConnectionBuilder().setPort(port)
                                   .setHost("127.0.0.1")
                                   .setTls(true)
                                   .setVerifyHostName(true)
@@ -343,7 +343,7 @@ public class TlsTest extends JmsTestBase
         setSslStoreSystemProperties();
         try
         {
-            Connection connection = getConnectionBuilder().setSslPort(port)
+            Connection connection = getConnectionBuilder().setPort(port)
                                                           .setHost("localhost")
                                                           .setTls(true)
                                                           .build();
@@ -369,7 +369,7 @@ public class TlsTest extends JmsTestBase
         int port = configureTlsPort(getTestPortName(), false, true, false);
 
         InetSocketAddress brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setHost(brokerAddress.getHostName())
                                                       .setTls(true)
                                                       .setTrustStoreLocation(TRUSTSTORE)
@@ -395,7 +395,7 @@ public class TlsTest extends JmsTestBase
 
         try
         {
-            getConnectionBuilder().setSslPort(port)
+            getConnectionBuilder().setPort(port)
                                   .setHost(getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP).getHostName())
                                   .setTls(true)
                                   .setTrustStoreLocation(TRUSTSTORE)
@@ -416,7 +416,7 @@ public class TlsTest extends JmsTestBase
         int port = configureTlsPort(getTestPortName(), false, true, false);
 
         InetSocketAddress brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setHost(brokerAddress.getHostName())
                                                       .setTls(true)
                                                       .setTrustStoreLocation(TRUSTSTORE)
@@ -441,7 +441,7 @@ public class TlsTest extends JmsTestBase
 
         try
         {
-            getConnectionBuilder().setSslPort(port)
+            getConnectionBuilder().setPort(port)
                                   .setHost(getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP).getHostName())
                                   .setTls(true)
                                   .setTrustStoreLocation(TRUSTSTORE)
@@ -463,7 +463,7 @@ public class TlsTest extends JmsTestBase
         int port = configureTlsPort(getTestPortName(), false, true, true);
 
         InetSocketAddress brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setHost(brokerAddress.getHostName())
                                                       .setTls(true)
                                                       .setKeyStoreLocation(KEYSTORE)
@@ -513,7 +513,7 @@ public class TlsTest extends JmsTestBase
         options.put("client_cert_path", encodePathOption(certAndKeyFiles[1].getCanonicalPath()));
         options.put("client_cert_priv_key_path", encodePathOption(certAndKeyFiles[0].getCanonicalPath()));
         InetSocketAddress brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
-        Connection connection = getConnectionBuilder().setSslPort(port)
+        Connection connection = getConnectionBuilder().setPort(port)
                                                       .setHost(brokerAddress.getHostName())
                                                       .setTls(true)
                                                       .setTrustStoreLocation(TRUSTSTORE)


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


Mime
View raw message