update tests to expect detach responses during link rejection, update 
implementation to send them


Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/599585b7
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/599585b7
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/599585b7

Branch: refs/heads/master
Commit: 599585b7ca6d0073189b33381662c06a12c79edf
Parents: f4174a2
Author: Robert Gemmell <[email protected]>
Authored: Wed Nov 12 14:37:38 2014 +0000
Committer: Robert Gemmell <[email protected]>
Committed: Wed Nov 12 10:16:21 2014 +0000

----------------------------------------------------------------------
 .../qpid/jms/provider/amqp/AmqpAbstractResource.java     | 11 +++++++++++
 .../qpid/jms/integration/SessionIntegrationTest.java     |  4 ++++
 2 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/599585b7/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java
 
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java
index 7da5e02..cd15122 100644
--- 
a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java
+++ 
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpAbstractResource.java
@@ -137,6 +137,11 @@ public abstract class AmqpAbstractResource<R extends 
JmsResource, E extends Endp
     @Override
     public void failed(Exception cause) {
         if (openRequest != null) {
+            if(endpoint != null) {
+                //TODO: if this is a producer/consumer link then we may only 
be detached,
+                //rather than fully closed, and should respond appropriately.
+                endpoint.close();
+            }
             openRequest.onFailure(cause);
             openRequest = null;
         }
@@ -155,6 +160,12 @@ public abstract class AmqpAbstractResource<R extends 
JmsResource, E extends Endp
                 error = new IOException("Remote has closed without error 
information");
             }
 
+            if(endpoint != null) {
+                //TODO: if this is a producer/consumer link then we may only 
be detached,
+                //rather than fully closed, and should respond appropriately.
+                endpoint.close();
+            }
+
             openRequest.onFailure(error);
             openRequest = null;
         }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/599585b7/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
index 06fe1fb..916a320 100644
--- 
a/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
+++ 
b/qpid-jms-client/src/test/java/org/apache/qpid/jms/integration/SessionIntegrationTest.java
@@ -214,6 +214,8 @@ public class SessionIntegrationTest extends QpidJmsTestCase 
{
             targetMatcher.withDurable(nullValue());//default = none/0
 
             testPeer.expectSenderAttach(targetMatcher, true, 
deferAttachFrameWrite);
+            //Expect the detach response to the test peer closing the producer 
link after refusal.
+            testPeer.expectDetach(true, false, false);
 
             try {
                 //Create a producer, expect it to throw exception due to the 
link-refusal
@@ -246,6 +248,8 @@ public class SessionIntegrationTest extends QpidJmsTestCase 
{
             targetMatcher.withDurable(nullValue());//default = none/0
 
             testPeer.expectSenderAttach(targetMatcher, true, false);
+            //Expect the detach response to the test peer closing the producer 
link after refusal.
+            testPeer.expectDetach(true, false, false);
 
             //Create an anonymous producer
             MessageProducer producer = session.createProducer(null);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to