You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2021/05/03 19:59:01 UTC

[qpid-protonj2] branch main updated: Initialize the proton connection container id from the client always

This is an automated email from the ASF dual-hosted git repository.

tabish pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-protonj2.git


The following commit(s) were added to refs/heads/main by this push:
     new 068c6e8  Initialize the proton connection container id from the client always
068c6e8 is described below

commit 068c6e8419955d21f58b05836611f79d84b63c62
Author: Timothy Bish <ta...@gmail.com>
AuthorDate: Mon May 3 15:58:43 2021 -0400

    Initialize the proton connection container id from the client always
    
    Ensure that a non-empty generated container Id is set to all remotes
    when a client level value has been set by the user.
---
 .../java/org/apache/qpid/protonj2/client/impl/ClientConnection.java  | 2 ++
 .../java/org/apache/qpid/protonj2/client/impl/ConnectionTest.java    | 4 ++--
 .../java/org/apache/qpid/protonj2/client/impl/ReconnectTest.java     | 5 +++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientConnection.java b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientConnection.java
index ef1aaa9..de46c50 100644
--- a/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientConnection.java
+++ b/protonj2-client/src/main/java/org/apache/qpid/protonj2/client/impl/ClientConnection.java
@@ -873,6 +873,8 @@ public class ClientConnection implements Connection {
 
         if (client.containerId() != null) {
             protonConnection.setContainerId(client.containerId());
+        } else {
+            protonConnection.setContainerId(connectionId);
         }
 
         protonConnection.setLinkedResource(this);
diff --git a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ConnectionTest.java b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ConnectionTest.java
index f8f8228..69adf5a 100644
--- a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ConnectionTest.java
+++ b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ConnectionTest.java
@@ -103,12 +103,12 @@ public class ConnectionTest extends ImperativeClientTestCase {
              ProtonTestServer secondPeer = new ProtonTestServer(testServerOptions())) {
 
             firstPeer.expectSASLAnonymousConnect();
-            firstPeer.expectOpen().respond();
+            firstPeer.expectOpen().withContainerId(Matchers.any(String.class)).respond();
             firstPeer.expectClose().respond();
             firstPeer.start();
 
             secondPeer.expectSASLAnonymousConnect();
-            secondPeer.expectOpen().respond();
+            secondPeer.expectOpen().withContainerId(Matchers.any(String.class)).respond();
             secondPeer.expectClose().respond();
             secondPeer.start();
 
diff --git a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReconnectTest.java b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReconnectTest.java
index afaa026..a478874 100644
--- a/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReconnectTest.java
+++ b/protonj2-client/src/test/java/org/apache/qpid/protonj2/client/impl/ReconnectTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.qpid.protonj2.client.impl;
 
+import static org.hamcrest.Matchers.any;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
@@ -55,12 +56,12 @@ public class ReconnectTest extends ImperativeClientTestCase {
              ProtonTestServer finalPeer = new ProtonTestServer()) {
 
             firstPeer.expectSASLAnonymousConnect();
-            firstPeer.expectOpen().respond();
+            firstPeer.expectOpen().withContainerId(any(String.class)).respond();
             firstPeer.dropAfterLastHandler(5);
             firstPeer.start();
 
             finalPeer.expectSASLAnonymousConnect();
-            finalPeer.expectOpen().respond();
+            finalPeer.expectOpen().withContainerId(any(String.class)).respond();
             finalPeer.start();
 
             final URI primaryURI = firstPeer.getServerURI();

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