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 2020/05/16 19:25:51 UTC
[qpid-jms-amqp-0-x] branch master updated (af4a099 -> c25b1fa)
This is an automated email from the ASF dual-hosted git repository.
orudyy pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-jms-amqp-0-x.git.
from af4a099 cut[NO-JIRA] Remove mention of qpid-common jar from docs, it was dropped in version 6.3.0
new 7f5e17c QPID-8440: [JMS AMQP 0-x] Add support for user user defined extensions to override client settings
new 49d9559 NO-JIRA: Upgrade test dependecies
new c3be45c NO-JIRA: Upgrade broker-j dependecy
new 6dfbd45 QPID-8443: Upgrade slf4j version
new f67a7e0 QPID-8444: Upgrade logback
new f37bf70 NO-JIRA: Upgrade jackson test dependecy
new c25b1fa QPID-8441: [JMS AMQP 0-x] Add connection options to override keystore and truststore types
The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../java/org/apache/qpid/client/AMQConnection.java | 14 +-
.../qpid/client/AMQConnectionDelegate_0_10.java | 6 +-
.../apache/qpid/client/AMQConnectionFactory.java | 7 +-
.../qpid/client/AbstractConnectionFactory.java | 74 +++++++
.../apache/qpid/client/BasicMessageProducer.java | 4 +
.../java/org/apache/qpid/client/BrokerDetails.java | 28 +++
.../apache/qpid/client/ConnectionExtension.java} | 40 ++--
.../qpid/client/ExtensibleConnectionURL.java | 229 +++++++++++++++++++++
.../qpid/client/PooledConnectionFactory.java | 9 +-
.../java/org/apache/qpid/transport/Connection.java | 1 -
.../client/message/AbstractJMSMessageTest.java | 13 +-
.../client/BrokerDetails/BrokerDetailsTest.java | 28 +++
.../src/docbkx/JMS-Client-JMS-Extensions.xml | 100 ++++++++-
pom.xml | 17 +-
systests/pom.xml | 8 +-
.../resources/broker-j-config-with-logging.json | 2 +-
.../systest/connection/ConnectionFactoryTest.java | 130 +++++++++---
17 files changed, 603 insertions(+), 107 deletions(-)
create mode 100644 client/src/main/java/org/apache/qpid/client/AbstractConnectionFactory.java
copy client/src/{test/java/org/apache/qpid/client/ConnectionListenerSupport.java => main/java/org/apache/qpid/client/ConnectionExtension.java} (54%)
create mode 100644 client/src/main/java/org/apache/qpid/client/ExtensibleConnectionURL.java
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[qpid-jms-amqp-0-x] 04/07: QPID-8443: Upgrade slf4j version
Posted by or...@apache.org.
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-jms-amqp-0-x.git
commit 6dfbd45970671ad9aed0c543269838528c3593f1
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Fri May 15 21:28:07 2020 +0100
QPID-8443: Upgrade slf4j version
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 0570f6a..41084eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,7 +87,7 @@
<logback-version>1.2.2</logback-version>
<guava-version>27.0-jre</guava-version>
<fasterxml-jackson-version>2.10.0</fasterxml-jackson-version>
- <slf4j-version>1.7.25</slf4j-version>
+ <slf4j-version>1.7.30</slf4j-version>
<!-- dependency version numbers -->
<geronimo-jms-1-1-version>1.1.1</geronimo-jms-1-1-version>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[qpid-jms-amqp-0-x] 02/07: NO-JIRA: Upgrade test dependecies
Posted by or...@apache.org.
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-jms-amqp-0-x.git
commit 49d9559342d568ed2c79a27615c83b49b3a3f8bb
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Fri May 15 21:07:33 2020 +0100
NO-JIRA: Upgrade test dependecies
---
.../apache/qpid/client/message/AbstractJMSMessageTest.java | 13 ++-----------
pom.xml | 11 +++--------
systests/pom.xml | 6 ------
3 files changed, 5 insertions(+), 25 deletions(-)
diff --git a/client/src/test/java/org/apache/qpid/client/message/AbstractJMSMessageTest.java b/client/src/test/java/org/apache/qpid/client/message/AbstractJMSMessageTest.java
index 6afd593..a4d7f37 100644
--- a/client/src/test/java/org/apache/qpid/client/message/AbstractJMSMessageTest.java
+++ b/client/src/test/java/org/apache/qpid/client/message/AbstractJMSMessageTest.java
@@ -33,8 +33,6 @@ import java.util.List;
import javax.jms.JMSException;
-import org.mockito.ArgumentMatcher;
-
import org.apache.qpid.QpidException;
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQSession;
@@ -51,7 +49,7 @@ public class AbstractJMSMessageTest extends QpidTestCase
public void testIncoming08ReplyTo() throws Exception
{
- when(_session.isQueueBound(isNull(String.class), eq("knownQueue"), isNull(String.class))).thenReturn(true);
+ when(_session.isQueueBound(isNull(), eq("knownQueue"), isNull())).thenReturn(true);
when(_session.isExchangeExist(isDestinationWithAddress("knownExchange"), anyBoolean())).thenReturn(true);
doReplyToTest("direct://amq.direct/knownQueue?routingkey='knownQueue'", "direct://amq.direct/knownQueue/knownQueue?routingkey='knownQueue'");
@@ -109,13 +107,6 @@ public class AbstractJMSMessageTest extends QpidTestCase
private AMQDestination isDestinationWithAddress(final String expectedAddress)
{
- return argThat( new ArgumentMatcher<AMQDestination>()
- {
- @Override
- public boolean matches(AMQDestination argument)
- {
- return argument.getAddressName().equals(expectedAddress);
- }
- });
+ return argThat(argument -> argument.getAddressName().equals(expectedAddress));
}
}
diff --git a/pom.xml b/pom.xml
index b86e060..0570f6a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -94,9 +94,9 @@
<!-- test dependency version numbers -->
- <junit-version>4.11</junit-version>
- <mockito-version>2.22.0</mockito-version>
- <hamcrest-version>1.3</hamcrest-version>
+ <junit-version>4.13</junit-version>
+ <mockito-version>3.2.4</mockito-version>
+ <hamcrest-version>2.2</hamcrest-version>
<httpclient-version>4.5.3</httpclient-version>
<maven-core-version>3.5.4</maven-core-version>
@@ -218,11 +218,6 @@
<version>${hamcrest-version}</version>
</dependency>
<dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-integration</artifactId>
- <version>${hamcrest-version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven-core-version}</version>
diff --git a/systests/pom.xml b/systests/pom.xml
index de02637..bc359fb 100644
--- a/systests/pom.xml
+++ b/systests/pom.xml
@@ -106,12 +106,6 @@
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-integration</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[qpid-jms-amqp-0-x] 07/07: QPID-8441: [JMS AMQP 0-x] Add connection
options to override keystore and truststore types
Posted by or...@apache.org.
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-jms-amqp-0-x.git
commit c25b1faa79997983de6652189086a7de7c10ad9a
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Fri May 15 23:56:22 2020 +0100
QPID-8441: [JMS AMQP 0-x] Add connection options to override keystore and truststore types
---
.../java/org/apache/qpid/client/BrokerDetails.java | 28 ++++++++++++++++++++++
.../client/BrokerDetails/BrokerDetailsTest.java | 28 ++++++++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/client/src/main/java/org/apache/qpid/client/BrokerDetails.java b/client/src/main/java/org/apache/qpid/client/BrokerDetails.java
index 0ce3fd3..c19f023 100644
--- a/client/src/main/java/org/apache/qpid/client/BrokerDetails.java
+++ b/client/src/main/java/org/apache/qpid/client/BrokerDetails.java
@@ -54,8 +54,10 @@ public class BrokerDetails implements Serializable
public static final String OPTIONS_SASL_SERVER_NAME = "sasl_server";
public static final String OPTIONS_TRUST_STORE = "trust_store";
public static final String OPTIONS_TRUST_STORE_PASSWORD = "trust_store_password";
+ public static final String OPTIONS_TRUST_STORE_TYPE = "trust_store_type";
public static final String OPTIONS_KEY_STORE = "key_store";
public static final String OPTIONS_KEY_STORE_PASSWORD = "key_store_password";
+ public static final String OPTIONS_KEY_STORE_TYPE = "key_store_type";
public static final String OPTIONS_SSL_VERIFY_HOSTNAME = "ssl_verify_hostname";
public static final String OPTIONS_SSL_CERT_ALIAS = "ssl_cert_alias";
public static final String OPTIONS_CLIENT_CERT_PRIV_KEY_PATH = "client_cert_priv_key_path";
@@ -65,9 +67,11 @@ public class BrokerDetails implements Serializable
public static final String OPTIONS_ENCRYPTION_TRUST_STORE = "encryption_trust_store";
public static final String OPTIONS_ENCRYPTION_TRUST_STORE_PASSWORD = "encryption_trust_store_password";
+ public static final String OPTIONS_ENCRYPTION_TRUST_STORE_TYPE = "encryption_trust_store_type";
public static final String OPTIONS_ENCRYPTION_REMOTE_TRUST_STORE = "encryption_remote_trust_store";
public static final String OPTIONS_ENCRYPTION_KEY_STORE = "encryption_key_store";
public static final String OPTIONS_ENCRYPTION_KEY_STORE_PASSWORD = "encryption_key_store_password";
+ public static final String OPTIONS_ENCRYPTION_KEY_STORE_TYPE = "encryption_key_store_type";
static final Set<String> PASSWORD_YIELDING_OPTIONS =
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
@@ -488,6 +492,12 @@ public class BrokerDetails implements Serializable
getProperty(BrokerDetails.OPTIONS_TRUST_STORE_PASSWORD));
}
+ if (getProperty(BrokerDetails.OPTIONS_TRUST_STORE_TYPE) != null)
+ {
+ conSettings.setTrustStoreType(
+ getProperty(BrokerDetails.OPTIONS_TRUST_STORE_TYPE));
+ }
+
if (getProperty(BrokerDetails.OPTIONS_KEY_STORE) != null)
{
conSettings.setKeyStorePath(
@@ -500,6 +510,12 @@ public class BrokerDetails implements Serializable
getProperty(BrokerDetails.OPTIONS_KEY_STORE_PASSWORD));
}
+ if (getProperty(BrokerDetails.OPTIONS_KEY_STORE_TYPE) != null)
+ {
+ conSettings.setKeyStoreType(
+ getProperty(BrokerDetails.OPTIONS_KEY_STORE_TYPE));
+ }
+
if (getProperty(BrokerDetails.OPTIONS_SSL_CERT_ALIAS) != null)
{
conSettings.setCertAlias(
@@ -550,6 +566,11 @@ public class BrokerDetails implements Serializable
getProperty(BrokerDetails.OPTIONS_ENCRYPTION_KEY_STORE_PASSWORD));
}
+ if (getProperty(BrokerDetails.OPTIONS_ENCRYPTION_KEY_STORE_TYPE) != null)
+ {
+ conSettings.setEncryptionKeyStoreType(
+ getProperty(BrokerDetails.OPTIONS_ENCRYPTION_KEY_STORE_TYPE));
+ }
if (getProperty(BrokerDetails.OPTIONS_ENCRYPTION_TRUST_STORE) != null)
{
@@ -564,6 +585,13 @@ public class BrokerDetails implements Serializable
}
+ if (getProperty(BrokerDetails.OPTIONS_ENCRYPTION_TRUST_STORE_TYPE) != null)
+ {
+ conSettings.setEncryptionTrustStoreType(
+ getProperty(BrokerDetails.OPTIONS_ENCRYPTION_TRUST_STORE_TYPE));
+ }
+
+
if (getProperty(BrokerDetails.OPTIONS_ENCRYPTION_REMOTE_TRUST_STORE) != null)
{
conSettings.setEncryptionRemoteTrustStoreName(
diff --git a/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java b/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java
index 3d7e63f..4dc94f2 100644
--- a/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java
+++ b/client/src/test/java/org/apache/qpid/test/unit/client/BrokerDetails/BrokerDetailsTest.java
@@ -271,4 +271,32 @@ public class BrokerDetailsTest extends QpidTestCase
ConnectionSettings connectionSettings = broker.buildConnectionSettings();
assertEquals("foo", connectionSettings.getEncryptionTrustStorePassword());
}
+
+ public void testEncryptionKeyStoreType() throws Exception
+ {
+ BrokerDetails broker = new BrokerDetails("tcp://localhost:5672?encryption_key_store_type='foo'");
+ ConnectionSettings connectionSettings = broker.buildConnectionSettings();
+ assertEquals("foo", connectionSettings.getEncryptionKeyStoreType());
+ }
+
+ public void testEncryptionTrustStoreType() throws Exception
+ {
+ BrokerDetails broker = new BrokerDetails("tcp://localhost:5672?encryption_trust_store_type='foo'");
+ ConnectionSettings connectionSettings = broker.buildConnectionSettings();
+ assertEquals("foo", connectionSettings.getEncryptionTrustStoreType());
+ }
+
+ public void testKeyStoreType() throws Exception
+ {
+ BrokerDetails details = new BrokerDetails("tcp://localhost:5672?key_store_type='foo'");
+ ConnectionSettings connectionSettings = details.buildConnectionSettings();
+ assertEquals("foo", connectionSettings.getKeyStoreType());
+ }
+
+ public void testTrustStoreType() throws Exception
+ {
+ BrokerDetails details = new BrokerDetails("tcp://localhost:5672?trust_store_type='foo'");
+ ConnectionSettings connectionSettings = details.buildConnectionSettings();
+ assertEquals("foo", connectionSettings.getTrustStoreType());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[qpid-jms-amqp-0-x] 05/07: QPID-8444: Upgrade logback
Posted by or...@apache.org.
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-jms-amqp-0-x.git
commit f67a7e0e4d0e4b3751fda3ad5f2739f3f12499dd
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Fri May 15 21:29:22 2020 +0100
QPID-8444: Upgrade logback
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 41084eb..4f4bedf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -84,7 +84,7 @@
<!-- Directory used for per test log file output -->
<test.output.dir>${basedir}${file.separator}target${file.separator}surefire-reports${file.separator}junit</test.output.dir>
- <logback-version>1.2.2</logback-version>
+ <logback-version>1.2.3</logback-version>
<guava-version>27.0-jre</guava-version>
<fasterxml-jackson-version>2.10.0</fasterxml-jackson-version>
<slf4j-version>1.7.30</slf4j-version>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[qpid-jms-amqp-0-x] 01/07: QPID-8440: [JMS AMQP 0-x] Add support
for user user defined extensions to override client settings
Posted by or...@apache.org.
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-jms-amqp-0-x.git
commit 7f5e17c4450a55ce65bdce1596b8cf3b1041e134
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Fri May 15 19:49:27 2020 +0100
QPID-8440: [JMS AMQP 0-x] Add support for user user defined extensions to override client settings
---
.../java/org/apache/qpid/client/AMQConnection.java | 14 +-
.../qpid/client/AMQConnectionDelegate_0_10.java | 6 +-
.../apache/qpid/client/AMQConnectionFactory.java | 7 +-
.../qpid/client/AbstractConnectionFactory.java | 74 +++++++
.../apache/qpid/client/BasicMessageProducer.java | 4 +
.../apache/qpid/client/ConnectionExtension.java | 51 +++++
.../qpid/client/ExtensibleConnectionURL.java | 229 +++++++++++++++++++++
.../qpid/client/PooledConnectionFactory.java | 9 +-
.../java/org/apache/qpid/transport/Connection.java | 1 -
.../src/docbkx/JMS-Client-JMS-Extensions.xml | 100 ++++++++-
.../systest/connection/ConnectionFactoryTest.java | 130 +++++++++---
11 files changed, 570 insertions(+), 55 deletions(-)
diff --git a/client/src/main/java/org/apache/qpid/client/AMQConnection.java b/client/src/main/java/org/apache/qpid/client/AMQConnection.java
index 4426fb6..7514ff8 100644
--- a/client/src/main/java/org/apache/qpid/client/AMQConnection.java
+++ b/client/src/main/java/org/apache/qpid/client/AMQConnection.java
@@ -151,12 +151,6 @@ public class AMQConnection extends Closeable implements CommonConnection, Refere
private String _clientName;
- /** The user name to use for authentication */
- private String _username;
-
- /** The password to use for authentication */
- private String _password;
-
/** The virtual path to connect to on the AMQ server */
private String _virtualHost;
@@ -482,8 +476,6 @@ public class AMQConnection extends Closeable implements CommonConnection, Refere
_connectionURL = connectionURL;
_clientName = connectionURL.getClientName();
- _username = connectionURL.getUsername();
- _password = connectionURL.getPassword();
setVirtualHost(connectionURL.getVirtualHost());
@@ -1356,17 +1348,17 @@ public class AMQConnection extends Closeable implements CommonConnection, Refere
public String getUsername()
{
- return _username;
+ return _connectionURL.getUsername();
}
public void setUsername(String id)
{
- _username = id;
+ _connectionURL.setUsername(id);
}
public String getPassword()
{
- return _password;
+ return _connectionURL.getPassword();
}
public String getVirtualHost()
diff --git a/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java b/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
index ba3e4ae..c2e8c34 100644
--- a/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
+++ b/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
@@ -240,7 +240,11 @@ public class AMQConnectionDelegate_0_10 implements AMQConnectionDelegate, Connec
_qpidConnection.connect(conSettings);
_conn.setConnected(true);
- _conn.setUsername(_qpidConnection.getUserID());
+
+ if (_qpidConnection.getUserID() != null)
+ {
+ _conn.setUsername(_qpidConnection.getUserID());
+ }
_conn.setMaximumChannelCount(_qpidConnection.getChannelMax());
_conn.getFailoverPolicy().attainedConnection();
_conn.logConnected(_qpidConnection.getLocalAddress(), _qpidConnection.getRemoteSocketAddress());
diff --git a/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java b/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java
index a843f8f..066535f 100644
--- a/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java
+++ b/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java
@@ -54,7 +54,8 @@ import java.util.Hashtable;
import java.util.UUID;
-public class AMQConnectionFactory implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory,
+public class AMQConnectionFactory extends AbstractConnectionFactory
+ implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory,
javax.naming.spi.ObjectFactory, Referenceable, XATopicConnectionFactory,
XAQueueConnectionFactory, XAConnectionFactory, Serializable
{
@@ -129,7 +130,7 @@ public class AMQConnectionFactory implements ConnectionFactory, QueueConnectionF
{
_connectionDetails.setClientName(getUniqueClientID());
}
- return new AMQConnection(_connectionDetails);
+ return newAMQConnectionInstance(_connectionDetails);
}
catch (Exception e)
{
@@ -161,7 +162,7 @@ public class AMQConnectionFactory implements ConnectionFactory, QueueConnectionF
{
connectionDetails.setClientName(getUniqueClientID());
}
- return new AMQConnection(connectionDetails);
+ return newAMQConnectionInstance(connectionDetails);
}
catch (Exception e)
{
diff --git a/client/src/main/java/org/apache/qpid/client/AbstractConnectionFactory.java b/client/src/main/java/org/apache/qpid/client/AbstractConnectionFactory.java
new file mode 100644
index 0000000..ea7549b
--- /dev/null
+++ b/client/src/main/java/org/apache/qpid/client/AbstractConnectionFactory.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.client;
+
+import java.net.URI;
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+import javax.jms.Connection;
+
+import org.apache.qpid.QpidException;
+import org.apache.qpid.jms.ConnectionURL;
+
+public abstract class AbstractConnectionFactory
+{
+ private final Map<ConnectionExtension, BiFunction<Connection, URI, Object>>
+ _extensions = new EnumMap<>(ConnectionExtension.class);
+
+
+ public void setExtension(String extensionName, BiFunction<Connection, URI, Object> extension)
+ {
+ final ConnectionExtension connectionExtension = ConnectionExtension.fromString(extensionName);
+ if (extension == null)
+ {
+ _extensions.remove(connectionExtension);
+ }
+ else
+ {
+ _extensions.put(connectionExtension, extension);
+ }
+ }
+
+ protected CommonConnection newConnectionInstance(final ConnectionURL connectionDetails) throws QpidException
+ {
+ return newAMQConnectionInstance(connectionDetails);
+ }
+
+ protected Map<ConnectionExtension, BiFunction<Connection, URI, Object>> getExtensions()
+ {
+ return new EnumMap<>(_extensions);
+ }
+
+ final AMQConnection newAMQConnectionInstance(final ConnectionURL connectionDetails) throws QpidException
+ {
+ final Map<ConnectionExtension, BiFunction<Connection, URI, Object>> extensions = getExtensions();
+ final ConnectionURL connectionURL =
+ extensions.isEmpty() ? connectionDetails : new ExtensibleConnectionURL(connectionDetails, extensions);
+ final AMQConnection connection = new AMQConnection(connectionURL);
+ if (connectionURL instanceof ExtensibleConnectionURL)
+ {
+ ((ExtensibleConnectionURL) connectionURL).setConnectionSupplier(() -> connection);
+ }
+ return connection;
+ }
+}
diff --git a/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java b/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
index 12fa91f..cba727b 100644
--- a/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
+++ b/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
@@ -193,6 +193,10 @@ public abstract class BasicMessageProducer extends Closeable implements org.apac
{
declareDestination(_destination);
}
+ if (_connection.isPopulateUserId())
+ {
+ _userID = _connection.getUsername();
+ }
}
abstract void declareDestination(AMQDestination destination) throws QpidException;
diff --git a/client/src/main/java/org/apache/qpid/client/ConnectionExtension.java b/client/src/main/java/org/apache/qpid/client/ConnectionExtension.java
new file mode 100644
index 0000000..364a24a
--- /dev/null
+++ b/client/src/main/java/org/apache/qpid/client/ConnectionExtension.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.client;
+
+public enum ConnectionExtension
+{
+ USERNAME_OVERRIDE("username"),
+ PASSWORD_OVERRIDE("password");
+
+ private final String _extensionName;
+
+ ConnectionExtension(final String extensionName)
+ {
+ _extensionName = extensionName;
+ }
+
+ public String getExtensionName()
+ {
+ return _extensionName;
+ }
+
+ public static ConnectionExtension fromString(String name)
+ {
+ for (ConnectionExtension extension : ConnectionExtension.values())
+ {
+ if (extension.getExtensionName().equalsIgnoreCase(name) || extension.name().equalsIgnoreCase(name))
+ {
+ return extension;
+ }
+ }
+ throw new IllegalArgumentException(String.format("Extension with name '%s' is not found", name));
+ }
+}
diff --git a/client/src/main/java/org/apache/qpid/client/ExtensibleConnectionURL.java b/client/src/main/java/org/apache/qpid/client/ExtensibleConnectionURL.java
new file mode 100644
index 0000000..1523bf6
--- /dev/null
+++ b/client/src/main/java/org/apache/qpid/client/ExtensibleConnectionURL.java
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.client;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.Map;
+import java.util.function.BiFunction;
+import java.util.function.Supplier;
+
+import javax.jms.Connection;
+
+import org.apache.qpid.QpidException;
+import org.apache.qpid.jms.ConnectionURL;
+
+public class ExtensibleConnectionURL implements ConnectionURL
+{
+ private final ConnectionURL _connectionURL;
+ private final Map<ConnectionExtension, BiFunction<Connection, URI, Object>> _extensions;
+ private final URI _connectionURI;
+ private volatile Supplier<AMQConnection> _connectionSupplier;
+
+ ExtensibleConnectionURL(final ConnectionURL connectionURL,
+ final Map<ConnectionExtension, BiFunction<Connection, URI, Object>> extensions)
+ throws QpidException
+ {
+ this(connectionURL, extensions, () -> null);
+ }
+
+ ExtensibleConnectionURL(final ConnectionURL connectionURL,
+ final Map<ConnectionExtension, BiFunction<Connection, URI, Object>> extensions,
+ final Supplier<AMQConnection> connectionSupplier) throws QpidException
+ {
+ _connectionURL = connectionURL;
+ _extensions = extensions;
+ _connectionSupplier = connectionSupplier;
+
+ try
+ {
+ _connectionURI = new URI(_connectionURL.getURL());
+ }
+ catch (URISyntaxException e)
+ {
+ throw new QpidException("Unexpected connection URL", e);
+ }
+ }
+
+ @Override
+ public String getURL()
+ {
+ return _connectionURL.getURL();
+ }
+
+ @Override
+ public String getFailoverMethod()
+ {
+ return _connectionURL.getFailoverMethod();
+ }
+
+ @Override
+ public String getFailoverOption(final String key)
+ {
+ return _connectionURL.getFailoverOption(key);
+ }
+
+ @Override
+ public int getBrokerCount()
+ {
+ return _connectionURL.getBrokerCount();
+ }
+
+ @Override
+ public BrokerDetails getBrokerDetails(final int index)
+ {
+ return _connectionURL.getBrokerDetails(index);
+ }
+
+ @Override
+ public void addBrokerDetails(final BrokerDetails broker)
+ {
+ _connectionURL.addBrokerDetails(broker);
+ }
+
+ @Override
+ public void setBrokerDetails(final List<BrokerDetails> brokers)
+ {
+ _connectionURL.setBrokerDetails(brokers);
+ }
+
+ @Override
+ public List<BrokerDetails> getAllBrokerDetails()
+ {
+ return _connectionURL.getAllBrokerDetails();
+ }
+
+ @Override
+ public String getClientName()
+ {
+ return _connectionURL.getClientName();
+ }
+
+ @Override
+ public void setClientName(final String clientName)
+ {
+ _connectionURL.setClientName(clientName);
+ }
+
+ @Override
+ public String getUsername()
+ {
+ if (_extensions.containsKey(ConnectionExtension.USERNAME_OVERRIDE))
+ {
+ final BiFunction<Connection, URI, Object> extension =
+ _extensions.get(ConnectionExtension.USERNAME_OVERRIDE);
+ final Object userName = extension.apply(_connectionSupplier.get(), _connectionURI);
+ return userName == null ? null : String.valueOf(userName);
+ }
+ else
+ {
+ return _connectionURL.getUsername();
+ }
+ }
+
+ @Override
+ public void setUsername(final String username)
+ {
+ _connectionURL.setUsername(username);
+ }
+
+ @Override
+ public String getPassword()
+ {
+ if (_extensions.containsKey(ConnectionExtension.PASSWORD_OVERRIDE))
+ {
+ final BiFunction<Connection, URI, Object> extension =
+ _extensions.get(ConnectionExtension.PASSWORD_OVERRIDE);
+ final Object password = extension.apply(_connectionSupplier.get(), _connectionURI);
+ return password == null ? null : String.valueOf(password);
+ }
+ else
+ {
+ return _connectionURL.getPassword();
+ }
+ }
+
+ @Override
+ public void setPassword(final String password)
+ {
+ _connectionURL.setPassword(password);
+ }
+
+ @Override
+ public String getVirtualHost()
+ {
+ return _connectionURL.getVirtualHost();
+ }
+
+ @Override
+ public void setVirtualHost(final String virtualHost)
+ {
+ _connectionURL.setVirtualHost(virtualHost);
+ }
+
+ @Override
+ public String getOption(final String key)
+ {
+ return _connectionURL.getOption(key);
+ }
+
+ @Override
+ public void setOption(final String key, final String value)
+ {
+ _connectionURL.setOption(key, value);
+ }
+
+ @Override
+ public String getDefaultQueueExchangeName()
+ {
+ return _connectionURL.getDefaultQueueExchangeName();
+ }
+
+ @Override
+ public String getDefaultTopicExchangeName()
+ {
+ return _connectionURL.getDefaultTopicExchangeName();
+ }
+
+ @Override
+ public String getTemporaryQueueExchangeName()
+ {
+ return _connectionURL.getTemporaryQueueExchangeName();
+ }
+
+ @Override
+ public String getTemporaryTopicExchangeName()
+ {
+ return _connectionURL.getTemporaryTopicExchangeName();
+ }
+
+ @Override
+ public String toString()
+ {
+ return _connectionURL.toString();
+ }
+
+ void setConnectionSupplier(final Supplier<AMQConnection> connectionSupplier)
+ {
+ _connectionSupplier = connectionSupplier;
+ }
+}
diff --git a/client/src/main/java/org/apache/qpid/client/PooledConnectionFactory.java b/client/src/main/java/org/apache/qpid/client/PooledConnectionFactory.java
index 0f41ab0..abf6fba 100644
--- a/client/src/main/java/org/apache/qpid/client/PooledConnectionFactory.java
+++ b/client/src/main/java/org/apache/qpid/client/PooledConnectionFactory.java
@@ -64,8 +64,8 @@ import org.apache.qpid.client.util.JMSExceptionHelper;
import org.apache.qpid.jms.*;
import org.apache.qpid.url.URLSyntaxException;
-public class PooledConnectionFactory implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory,
- Referenceable
+public class PooledConnectionFactory extends AbstractConnectionFactory
+ implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory, Referenceable
{
public static final String JNDI_ADDRESS_MAX_POOL_SIZE = "maxPoolSize";
@@ -262,11 +262,6 @@ public class PooledConnectionFactory implements ConnectionFactory, QueueConnecti
}
}
- protected CommonConnection newConnectionInstance(final ConnectionURL connectionDetails) throws QpidException
- {
- return new AMQConnection(connectionDetails);
- }
-
private ConnectionURL getConnectionURLOrError() throws IllegalStateException
{
final ConnectionURL connectionDetails = _connectionDetails.get();
diff --git a/client/src/main/java/org/apache/qpid/transport/Connection.java b/client/src/main/java/org/apache/qpid/transport/Connection.java
index 13289f1..f270665 100644
--- a/client/src/main/java/org/apache/qpid/transport/Connection.java
+++ b/client/src/main/java/org/apache/qpid/transport/Connection.java
@@ -223,7 +223,6 @@ public class Connection extends ConnectionInvoker
conSettings = settings;
_redirecting.set(false);
state = OPENING;
- userID = settings.getUsername();
connectionLost.set(false);
securityLayer = SecurityLayerFactory.newInstance(getConnectionSettings());
diff --git a/doc/jms-client-0-8/src/docbkx/JMS-Client-JMS-Extensions.xml b/doc/jms-client-0-8/src/docbkx/JMS-Client-JMS-Extensions.xml
index e2a7732..431eb8a 100644
--- a/doc/jms-client-0-8/src/docbkx/JMS-Client-JMS-Extensions.xml
+++ b/doc/jms-client-0-8/src/docbkx/JMS-Client-JMS-Extensions.xml
@@ -22,7 +22,7 @@
<appendix xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="JMS-Client-0-8-Appendix-JMS-Extensions">
<title>JMS Extensions</title>
- <para>This section illustrates using Qpid specific extentions to JMS for the managament of queues,
+ <para>This section illustrates using Qpid specific extensions to JMS for the management of connections, queues,
exchanges and bindings.</para>
<!-- TODO perhaps mention ConnectionListener?-->
<important>
@@ -30,6 +30,104 @@
subject to change and will not be supported in this form for AMQP 1.0. Instead, the reader is
directed towards the Managment interfaces of the Broker.</para>
</important>
+ <section xml:id="JMS-Client-0-8-Appendix-JMS-Extensions-Connection">
+ <title>Connection extensions</title>
+ <para>Connection extensions allows overriding connection configurations like username or password
+ in response to some environment changes like account rotation or authentication token expiration.</para>
+ <para>
+ The extensions take the form of a BiFunction<Connection, URI, Object> passed into the
+ ConnectionFactory using the AMQConnectionFactory#setExtension(String, BiFunction).
+ </para>
+ <para>A table below lists supported extensions.</para>
+ <table pgwide="1">
+ <title>Connection Extensions</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Extension Name</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>username</entry>
+ <entry><para>Allows to hook a custom code for provisioning of user name which would be used in authentication
+ with a remote host.</para></entry>
+ </row>
+ <row>
+ <entry>password</entry>
+ <entry><para>Allows to hook a custom code for provisioning of user password which would be used in
+ authentication with a remote host.</para></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>The following example illustrates how expirate OAUTH2 authentication token can be recreated</para>
+ <example>
+ <title>Inject password extension</title>
+ <programlisting>
+final String connectionURL = "..."; <co xml:id="ext-token-url" linkends="callout-ext-token-url"/>
+final TokenGenerator tokenGenerator = new TokenGenerator(...); <co xml:id="ext-token-generator" linkends="callout-ext-token-generator"/>
+
+final BiFunction<Connection, URI, Object> tokenExtension = new BiFunction<Connection, URI, Object>() <co xml:id="ext-token-extension" linkends="callout-ext-token-extension"/>
+{
+ private volatile String token;
+ private long currentTokenExpirationTime;
+
+ @Override
+ public Object apply(final Connection connection, final URI uri)
+ {
+ long currentTime = System.currentTimeMillis();
+ if (currentTime > currentTokenExpirationTime) <co xml:id="ext-token-expiration-check" linkends="callout-ext-token-expiration-check"/>
+ {
+ this.token = tokenGenerator.generateAccessToken(); <co xml:id="ext-token-generation" linkends="callout-ext-token-generation"/>
+ this.currentTokenExpirationTime = tokenGenerator.getTokenExpirationTime(token); <co xml:id="ext-token-exp-time" linkends="callout-ext-token-exp-time"/>
+ }
+ return this.token;
+ }
+};
+final AMQConnectionFactory factory = new AMQConnectionFactory(connectionURL); <co xml:id="ext-token-connection-factory" linkends="callout-ext-token-connection-factory"/>
+factory.setExtension(ConnectionExtension.PASSWORD_OVERRIDE.name(), tokenExtension); <co xml:id="ext-token-override" linkends="callout-ext-token-override"/>
+
+final Connection connection = factory.createConnection(); <co xml:id="ext-token-connection" linkends="callout-ext-token-connection"/>
+ </programlisting>
+ </example><calloutlist>
+ <callout xml:id="callout-ext-token-url" arearefs="ext-token-url">
+ <para>Connection URL</para>
+ </callout>
+ <callout xml:id="callout-ext-token-generator" arearefs="ext-token-generator">
+ <para>Helper object to generate access token for a specific OAUTH2 implementation </para>
+ </callout>
+ <callout xml:id="callout-ext-token-extension" arearefs="ext-token-extension">
+ <para>Password extension for token renewal</para>
+ </callout>
+ <callout xml:id="callout-ext-token-expiration-check" arearefs="ext-token-expiration-check">
+ <para>Check token expiration</para>
+ </callout>
+ <callout xml:id="callout-ext-token-generation" arearefs="ext-token-generation">
+ <para>Get new token</para>
+ </callout>
+ <callout xml:id="callout-ext-token-exp-time" arearefs="ext-token-exp-time">
+ <para>Preserve token expiration time</para>
+ </callout>
+ <callout xml:id="callout-ext-token-connection-factory" arearefs="ext-token-connection-factory">
+ <para>Create connection factory</para>
+ </callout>
+ <callout xml:id="callout-ext-token-override" arearefs="ext-token-override">
+ <para>Register password extension for token regeneration</para>
+ </callout>
+ <callout xml:id="callout-ext-token-connection" arearefs="ext-token-connection">
+ <para>Open connection</para>
+ </callout>
+ </calloutlist>
+ <para>In the snippet above an implementation of BiFunction<Connection, URI, Object> is created at (3) for
+ access token provisioning. The function implementation checks the token expiration at (4) and regenerate
+ the token at (5) using a helper object (2) implementing calls to OAUTH2 specific API.
+ The token expiration time is preserved at (6) for the following reconnects attempts.
+ An instance of AMQConnectionFactory is created at (7) for a given connection URL (1).
+ A password extension is registered at (8). JMS connection is open at (9). The example uses a hypothetical
+ class TokenGenerator invoking underlying OAUTH2 API to generate/renew access token and get token expiration time.</para>
+ </section>
<section xml:id="JMS-Client-0-8-Appendix-JMS-Extensions-Queue">
<title>Queue Management</title>
<para>These extensions allow queues to be created or removed.</para>
diff --git a/systests/src/test/java/org/apache/qpid/systest/connection/ConnectionFactoryTest.java b/systests/src/test/java/org/apache/qpid/systest/connection/ConnectionFactoryTest.java
index c9eb034..e5db8ee 100644
--- a/systests/src/test/java/org/apache/qpid/systest/connection/ConnectionFactoryTest.java
+++ b/systests/src/test/java/org/apache/qpid/systest/connection/ConnectionFactoryTest.java
@@ -21,47 +21,54 @@
package org.apache.qpid.systest.connection;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
import java.net.InetSocketAddress;
-import javax.jms.Connection;
+import javax.jms.JMSException;
import org.junit.Before;
import org.junit.Test;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQConnectionFactory;
+import org.apache.qpid.client.ConnectionExtension;
import org.apache.qpid.systest.core.BrokerAdmin;
import org.apache.qpid.systest.core.JmsTestBase;
public class ConnectionFactoryTest extends JmsTestBase
{
- private static final String CONNECTION_URL = "amqp://guest:guest@clientID/?brokerlist='tcp://%s:%d'";
- private String _url;
+ private static final String CONNECTION_URL = "amqp://%s:%s@clientID/?brokerlist='tcp://%s:%d'";
+ private String _urlWithCredentials;
+ private String _urlWithoutCredentials;
+ private String _userName;
+ private String _password;
@Before
public void setUp()
{
- final InetSocketAddress brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
- _url = String.format(CONNECTION_URL,
- brokerAddress.getHostString(),
- brokerAddress.getPort());
+ final BrokerAdmin brokerAdmin = getBrokerAdmin();
+ final InetSocketAddress brokerAddress = brokerAdmin.getBrokerAddress(BrokerAdmin.PortType.AMQP);
+ _userName = brokerAdmin.getValidUsername();
+ _password = brokerAdmin.getValidPassword();
+ final String host = brokerAddress.getHostString();
+ final int port = brokerAddress.getPort();
+ _urlWithCredentials = String.format(CONNECTION_URL, _userName, _password, host, port);
+ _urlWithoutCredentials = String.format(CONNECTION_URL, "", "", host, port);
}
- /**
- * The username & password specified should not override the default
- * specified in the URL.
- */
+
@Test
- public void testCreateConnectionWithUsernamePassword() throws Exception
+ public void testCreateConnectionWithUsernamePasswordSetOnConnectionURL() throws Exception
{
- AMQConnectionFactory factory = new AMQConnectionFactory(_url);
+ AMQConnectionFactory factory = new AMQConnectionFactory(_urlWithCredentials);
AMQConnection con = null;
try
{
con = factory.createConnection();
- assertEquals("Usernames used is different from the one in URL","guest",con.getConnectionURL().getUsername());
- assertEquals("Password used is different from the one in URL","guest",con.getConnectionURL().getPassword());
+ assertEquals("Usernames used is different from the one in URL", _userName, con.getUsername());
+ assertEquals("Password used is different from the one in URL", _password, con.getPassword());
}
finally
{
@@ -70,17 +77,18 @@ public class ConnectionFactoryTest extends JmsTestBase
con.close();
}
}
+ }
+ @Test
+ public void testCreateConnectionWithUsernamePasswordPassedIntoCreateConnection() throws Exception
+ {
+ AMQConnectionFactory factory = new AMQConnectionFactory(_urlWithCredentials);
AMQConnection con2 = null;
try
{
- con2 = factory.createConnection("user", "pass");
- assertEquals("Usernames used is different from the one in URL","user",con2.getConnectionURL().getUsername());
- assertEquals("Password used is different from the one in URL","pass",con2.getConnectionURL().getPassword());
- }
- catch(Exception e)
- {
- // ignore
+ con2 = factory.createConnection("admin", "admin");
+ assertEquals("Usernames used is different from the one in URL", "admin", con2.getUsername());
+ assertEquals("Password used is different from the one in URL", "admin", con2.getPassword());
}
finally
{
@@ -89,13 +97,20 @@ public class ConnectionFactoryTest extends JmsTestBase
con2.close();
}
}
+ }
+
+ @Test
+ public void testCreateConnectionWithUsernamePasswordPassedIntoCreateConnectionWhenConnectionUrlWithoutCredentials()
+ throws Exception
+ {
+ AMQConnectionFactory factory = new AMQConnectionFactory(_urlWithoutCredentials);
AMQConnection con3 = null;
try
{
- con3 = factory.createConnection();
- assertEquals("Usernames used is different from the one in URL","guest",con3.getConnectionURL().getUsername());
- assertEquals("Password used is different from the one in URL","guest",con3.getConnectionURL().getPassword());
+ con3 = factory.createConnection(_userName, _password);
+ assertEquals("Usernames used is different from the one in URL", _userName, con3.getUsername());
+ assertEquals("Password used is different from the one in URL", _password, con3.getPassword());
}
finally
{
@@ -106,20 +121,73 @@ public class ConnectionFactoryTest extends JmsTestBase
}
}
- /**
- * Verifies that a connection can be made using an instance of AMQConnectionFactory created with the
- * default constructor and provided with the connection url via setter.
- */
@Test
public void testCreatingConnectionWithInstanceMadeUsingDefaultConstructor() throws Exception
{
AMQConnectionFactory factory = new AMQConnectionFactory();
- factory.setConnectionURLString(_url);
+ factory.setConnectionURLString(_urlWithCredentials);
- Connection con = null;
+ AMQConnection con = null;
try
{
con = factory.createConnection();
+ assertNotNull(con);
+ assertEquals(_userName, con.getUsername());
+ assertEquals(_password, con.getPassword());
+ }
+ finally
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ }
+
+ @Test
+ public void testCreatingConnectionUsingUserNameAndPasswordExtensions() throws Exception
+ {
+ AMQConnectionFactory factory = new AMQConnectionFactory();
+ factory.setConnectionURLString(_urlWithoutCredentials);
+ factory.setExtension(ConnectionExtension.PASSWORD_OVERRIDE.getExtensionName(), (connection, uri) -> _password);
+ factory.setExtension(ConnectionExtension.USERNAME_OVERRIDE.getExtensionName(), (connection, uri) -> _userName);
+
+ AMQConnection con = null;
+ try
+ {
+ con = factory.createConnection();
+ assertNotNull(con);
+ assertEquals(_userName, con.getUsername());
+ assertEquals(_password, con.getPassword());
+ }
+ finally
+ {
+ if (con != null)
+ {
+ con.close();
+ }
+ }
+ }
+
+ @Test
+ public void testCreatingConnectionUsingUserNameAndPasswordExtensionsWhenRuntimeExceptionIsThrown() throws Exception
+ {
+ AMQConnectionFactory factory = new AMQConnectionFactory();
+ factory.setConnectionURLString(_urlWithoutCredentials);
+ factory.setExtension(ConnectionExtension.PASSWORD_OVERRIDE.getExtensionName(), (connection, uri) -> {
+ throw new RuntimeException("Test");
+ });
+ factory.setExtension(ConnectionExtension.USERNAME_OVERRIDE.getExtensionName(), (connection, uri) -> _userName);
+
+ AMQConnection con = null;
+ try
+ {
+ con = factory.createConnection();
+ fail("Exception is expected");
+ }
+ catch (JMSException e)
+ {
+ // pass
}
finally
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[qpid-jms-amqp-0-x] 06/07: NO-JIRA: Upgrade jackson test dependecy
Posted by or...@apache.org.
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-jms-amqp-0-x.git
commit f37bf70451a1960074e174adb58e6078cbe7a7e3
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Fri May 15 21:30:53 2020 +0100
NO-JIRA: Upgrade jackson test dependecy
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 4f4bedf..c0c9060 100644
--- a/pom.xml
+++ b/pom.xml
@@ -86,7 +86,7 @@
<logback-version>1.2.3</logback-version>
<guava-version>27.0-jre</guava-version>
- <fasterxml-jackson-version>2.10.0</fasterxml-jackson-version>
+ <fasterxml-jackson-version>2.10.4</fasterxml-jackson-version>
<slf4j-version>1.7.30</slf4j-version>
<!-- dependency version numbers -->
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[qpid-jms-amqp-0-x] 03/07: NO-JIRA: Upgrade broker-j dependecy
Posted by or...@apache.org.
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-jms-amqp-0-x.git
commit c3be45c16752ace3b9bb8dcea4ddad13d71feeca
Author: Alex Rudyy <or...@apache.org>
AuthorDate: Fri May 15 21:26:05 2020 +0100
NO-JIRA: Upgrade broker-j dependecy
---
systests/pom.xml | 2 +-
systests/src/main/resources/broker-j-config-with-logging.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/systests/pom.xml b/systests/pom.xml
index bc359fb..2440be6 100644
--- a/systests/pom.xml
+++ b/systests/pom.xml
@@ -159,7 +159,7 @@
<properties>
<qpid.amqp.version>0-10</qpid.amqp.version>
<surefire.working.directory>${project.build.directory}${file.separator}surefire-reports${file.separator}${qpid.amqp.version}</surefire.working.directory>
- <qpid-broker-j-version>7.1.2</qpid-broker-j-version>
+ <qpid-broker-j-version>8.0.0</qpid-broker-j-version>
<qpid.systest.broker_admin>org.apache.qpid.systest.core.brokerj.SpawnQpidBrokerAdmin</qpid.systest.broker_admin>
<qpid.systest.java8.executable>java</qpid.systest.java8.executable>
<qpid.systest.virtualhost.blueprint>{"type":"BDB","globalAddressDomains":"[]"}</qpid.systest.virtualhost.blueprint>
diff --git a/systests/src/main/resources/broker-j-config-with-logging.json b/systests/src/main/resources/broker-j-config-with-logging.json
index e28b428..56cd4ee 100644
--- a/systests/src/main/resources/broker-j-config-with-logging.json
+++ b/systests/src/main/resources/broker-j-config-with-logging.json
@@ -20,7 +20,7 @@
*/
{
"name" : "${broker.name}",
- "modelVersion" : "7.0",
+ "modelVersion" : "8.0",
"authenticationproviders" : [ {
"name" : "plain",
"type" : "Plain",
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org