Skip to content

Commit 5526dff

Browse files
authored
Disabling receiveNoWait for ActiveMQ test (#755)
1 parent 21f161f commit 5526dff

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/ActiveMqArtemisFacade.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ public Message receive(Destination destination, long timeout) {
151151
return context.createConsumer(destination).receive(timeout);
152152
}
153153

154+
@Override
155+
public boolean shouldTestReceiveNoWait() {
156+
return true;
157+
}
158+
154159
@Override
155160
public Message receiveNoWait(Destination destination) {
156161
return context.createConsumer(destination).receiveNoWait();

apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/ActiveMqFacade.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ public Message receive(Destination destination, long timeout) throws JMSExceptio
143143
return session.createConsumer(destination).receive(timeout);
144144
}
145145

146+
@Override
147+
public boolean shouldTestReceiveNoWait() {
148+
return false;
149+
}
150+
146151
@Override
147152
public Message receiveNoWait(Destination destination) throws JMSException {
148153
return session.createConsumer(destination).receiveNoWait();

apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/BrokerFacade.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,7 @@ interface BrokerFacade {
5858

5959
Message receive(Destination destination, long timeout) throws Exception;
6060

61+
boolean shouldTestReceiveNoWait();
62+
6163
Message receiveNoWait(Destination destination) throws Exception;
6264
}

apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/JmsInstrumentationIT.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ public void testQueueSendReceiveOnTracedThread() throws Exception {
118118

119119
@Test
120120
public void testQueueSendReceiveNoWaitOnTracedThread() throws Exception {
121+
if (!brokerFacade.shouldTestReceiveNoWait()) {
122+
return;
123+
}
121124
final Queue queue = createQueue();
122125
testQueueSendReceiveOnTracedThread(() -> brokerFacade.receiveNoWait(queue), queue, true);
123126
}
@@ -130,6 +133,9 @@ public void testQueueSendReceiveOnNonTracedThread() throws Exception {
130133

131134
@Test
132135
public void testQueueSendReceiveNoWaitOnNonTracedThread() throws Exception {
136+
if (!brokerFacade.shouldTestReceiveNoWait()) {
137+
return;
138+
}
133139
final Queue queue = createQueue();
134140
testQueueSendReceiveOnNonTracedThread(() -> brokerFacade.receiveNoWait(queue), queue, true);
135141
}

0 commit comments

Comments
 (0)