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

clebertsuconic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/main by this push:
     new e448f69bfc ARTEMIS-5232 Small speedup on JMSTransactionTestSupport
e448f69bfc is described below

commit e448f69bfca824b266beca5bdfcc0b10a1cd212e
Author: Clebert Suconic <[email protected]>
AuthorDate: Fri Jan 10 15:41:30 2025 -0500

    ARTEMIS-5232 Small speedup on JMSTransactionTestSupport
---
 .../openwire/amq/JmsTransactionTestSupport.java     | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTransactionTestSupport.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTransactionTestSupport.java
index 14238d9c91..7734aa072d 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTransactionTestSupport.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTransactionTestSupport.java
@@ -372,12 +372,6 @@ public abstract class JmsTransactionTestSupport extends 
BasicOpenWireTest implem
    public void testReceiveTwoThenRollback() throws Exception {
       Message[] outbound = new Message[]{session.createTextMessage("First 
Message"), session.createTextMessage("Second Message")};
 
-      // lets consume any outstanding messages from prev test runs
-      beginTx();
-      while (consumer.receive(1000) != null) {
-      }
-      commitTx();
-
       //
       beginTx();
       producer.send(outbound[0]);
@@ -393,7 +387,7 @@ public abstract class JmsTransactionTestSupport extends 
BasicOpenWireTest implem
       assertNotNull(message);
       assertEquals(outbound[1], message);
 
-      message = (TextMessage) consumer.receive(1000);
+      message = (TextMessage) consumer.receiveNoWait();
       assertNull(message);
 
       rollbackTx();
@@ -456,9 +450,7 @@ public abstract class JmsTransactionTestSupport extends 
BasicOpenWireTest implem
     */
    @Test
    public void testReceiveTwoThenRollbackManyTimes() throws Exception {
-      for (int i = 0; i < 5; i++) {
-         testReceiveTwoThenRollback();
-      }
+      testReceiveTwoThenRollback();
    }
 
    /**
@@ -495,13 +487,6 @@ public abstract class JmsTransactionTestSupport extends 
BasicOpenWireTest implem
    public void testCloseConsumerBeforeCommit() throws Exception {
       TextMessage[] outbound = new 
TextMessage[]{session.createTextMessage("First Message"), 
session.createTextMessage("Second Message")};
 
-      // lets consume any outstanding messages from prev test runs
-      beginTx();
-      while (consumer.receiveNoWait() != null) {
-      }
-
-      commitTx();
-
       // sends the messages
       beginTx();
       producer.send(outbound[0]);
@@ -607,7 +592,7 @@ public abstract class JmsTransactionTestSupport extends 
BasicOpenWireTest implem
       assertEquals(ackMessages.size(), MESSAGE_COUNT);
       // should no longer re-receive
       consumer.setMessageListener(null);
-      assertNull(consumer.receive(500));
+      assertNull(consumer.receiveNoWait());
       reconnect();
    }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to