Skip to content

Commit

Permalink
ARTEMIS-5232 Small speedup on JMSTransactionTestSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
clebertsuconic committed Jan 10, 2025
1 parent ecf4928 commit e448f69
Showing 1 changed file with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,6 @@ public void testReceiveRollback() throws Exception {
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]);
Expand All @@ -393,7 +387,7 @@ public void testReceiveTwoThenRollback() throws Exception {
assertNotNull(message);
assertEquals(outbound[1], message);

message = (TextMessage) consumer.receive(1000);
message = (TextMessage) consumer.receiveNoWait();
assertNull(message);

rollbackTx();
Expand Down Expand Up @@ -456,9 +450,7 @@ public void testSendReceiveWithPrefetchOne() throws Exception {
*/
@Test
public void testReceiveTwoThenRollbackManyTimes() throws Exception {
for (int i = 0; i < 5; i++) {
testReceiveTwoThenRollback();
}
testReceiveTwoThenRollback();
}

/**
Expand Down Expand Up @@ -495,13 +487,6 @@ public void testReceiveRollbackWithPrefetchOfOne() throws Exception {
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]);
Expand Down Expand Up @@ -607,7 +592,7 @@ public void testMessageListener() throws Exception {
assertEquals(ackMessages.size(), MESSAGE_COUNT);
// should no longer re-receive
consumer.setMessageListener(null);
assertNull(consumer.receive(500));
assertNull(consumer.receiveNoWait());
reconnect();
}

Expand Down

0 comments on commit e448f69

Please sign in to comment.