[qpid-broker-j] branch 7.1.x updated: QPID-8341: [Broker-J] Fix failing test

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[qpid-broker-j] branch 7.1.x updated: QPID-8341: [Broker-J] Fix failing test

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

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


The following commit(s) were added to refs/heads/7.1.x by this push:
     new c0d92b9  QPID-8341: [Broker-J] Fix failing test
c0d92b9 is described below

commit c0d92b971d7f4e27347fa167071b021b04b8ac78
Author: Alex Rudyy <[hidden email]>
AuthorDate: Tue Jul 16 00:25:58 2019 +0100

    QPID-8341: [Broker-J] Fix failing test
   
    (cherry picked from commit 66a56dee7f6ebcda8b6282ae1c73efd9454c7949)
---
 .../extensions/queue/RejectOverflowPolicyTest.java | 24 ++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/queue/RejectOverflowPolicyTest.java b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/queue/RejectOverflowPolicyTest.java
index 770f6d0..5c12387 100644
--- a/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/queue/RejectOverflowPolicyTest.java
+++ b/systests/qpid-systests-jms_1.1/src/test/java/org/apache/qpid/systests/jms_1_1/extensions/queue/RejectOverflowPolicyTest.java
@@ -61,21 +61,29 @@ public class RejectOverflowPolicyTest extends OverflowPolicyTestBase
         try
         {
             final Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            final MessageProducer producer = producerSession.createProducer(queue);
             final Message firstMessage = nextMessage(0, producerSession);
             final Message secondMessage = nextMessage(1, producerSession);
-
-            producer.send(firstMessage);
             try
             {
-                producer.send(secondMessage);
-                fail("Message send should fail due to reject policy");
+                final MessageProducer producer = producerSession.createProducer(queue);
+                producer.send(firstMessage);
+                try
+                {
+                    producer.send(secondMessage);
+                    fail("Message send should fail due to reject policy");
+                }
+                catch (JMSException e)
+                {
+                    // pass
+                }
             }
-            catch (JMSException e)
+            finally
             {
-                // pass
+                producerSession.close();
             }
 
+            final Session producerSession2 = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+            final MessageProducer producer2 = producerSession2.createProducer(queue);
             final Connection consumerConnection = getConnection();
             try
             {
@@ -89,7 +97,7 @@ public class RejectOverflowPolicyTest extends OverflowPolicyTestBase
 
                 consumerSession.commit();
 
-                producer.send(secondMessage);
+                producer2.send(secondMessage);
 
                 Message message2 = consumer.receive(getReceiveTimeout());
                 assertNotNull("Message is not received", message2);


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