From 66417b4b1751470297dec308d8eb53e20233d79d Mon Sep 17 00:00:00 2001 From: eyalkoren Date: Sun, 21 Jul 2019 09:43:18 +0300 Subject: [PATCH] Disabling receiveNoWait for ActiveMQ test --- .../co/elastic/apm/agent/jms/ActiveMqArtemisFacade.java | 5 +++++ .../test/java/co/elastic/apm/agent/jms/ActiveMqFacade.java | 5 +++++ .../test/java/co/elastic/apm/agent/jms/BrokerFacade.java | 2 ++ .../java/co/elastic/apm/agent/jms/JmsInstrumentationIT.java | 6 ++++++ 4 files changed, 18 insertions(+) diff --git a/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/ActiveMqArtemisFacade.java b/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/ActiveMqArtemisFacade.java index b3656a0841..d4f1c16544 100644 --- a/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/ActiveMqArtemisFacade.java +++ b/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/ActiveMqArtemisFacade.java @@ -151,6 +151,11 @@ public Message receive(Destination destination, long timeout) { return context.createConsumer(destination).receive(timeout); } + @Override + public boolean shouldTestReceiveNoWait() { + return true; + } + @Override public Message receiveNoWait(Destination destination) { return context.createConsumer(destination).receiveNoWait(); diff --git a/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/ActiveMqFacade.java b/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/ActiveMqFacade.java index f49eb36b30..4f0bb102be 100644 --- a/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/ActiveMqFacade.java +++ b/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/ActiveMqFacade.java @@ -143,6 +143,11 @@ public Message receive(Destination destination, long timeout) throws JMSExceptio return session.createConsumer(destination).receive(timeout); } + @Override + public boolean shouldTestReceiveNoWait() { + return false; + } + @Override public Message receiveNoWait(Destination destination) throws JMSException { return session.createConsumer(destination).receiveNoWait(); diff --git a/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/BrokerFacade.java b/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/BrokerFacade.java index e685186249..9a57f8b6c0 100644 --- a/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/BrokerFacade.java +++ b/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/BrokerFacade.java @@ -58,5 +58,7 @@ interface BrokerFacade { Message receive(Destination destination, long timeout) throws Exception; + boolean shouldTestReceiveNoWait(); + Message receiveNoWait(Destination destination) throws Exception; } diff --git a/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/JmsInstrumentationIT.java b/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/JmsInstrumentationIT.java index 6bbcb0e236..685903fd4d 100644 --- a/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/JmsInstrumentationIT.java +++ b/apm-agent-plugins/apm-jms-plugin/src/test/java/co/elastic/apm/agent/jms/JmsInstrumentationIT.java @@ -118,6 +118,9 @@ public void testQueueSendReceiveOnTracedThread() throws Exception { @Test public void testQueueSendReceiveNoWaitOnTracedThread() throws Exception { + if (!brokerFacade.shouldTestReceiveNoWait()) { + return; + } final Queue queue = createQueue(); testQueueSendReceiveOnTracedThread(() -> brokerFacade.receiveNoWait(queue), queue, true); } @@ -130,6 +133,9 @@ public void testQueueSendReceiveOnNonTracedThread() throws Exception { @Test public void testQueueSendReceiveNoWaitOnNonTracedThread() throws Exception { + if (!brokerFacade.shouldTestReceiveNoWait()) { + return; + } final Queue queue = createQueue(); testQueueSendReceiveOnNonTracedThread(() -> brokerFacade.receiveNoWait(queue), queue, true); }