From 053cfbc1024d694fad1d9675c10e28276b9e74ab Mon Sep 17 00:00:00 2001 From: brusdev Date: Mon, 1 Jun 2020 22:03:43 +0200 Subject: [PATCH] NO-JIRA Fix invalid log path in BMRules --- .../artemis/tests/extras/byteman/LatencyTest.java | 8 +++++++- .../tests/extras/byteman/OrphanedConsumerTest.java | 10 ++++++++-- .../tests/extras/byteman/StartStopDeadlockTest.java | 6 +++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LatencyTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LatencyTest.java index d855990015..570907193a 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LatencyTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LatencyTest.java @@ -24,11 +24,17 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMUnitRunner; +import org.jboss.logging.Logger; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(BMUnitRunner.class) public class LatencyTest extends ActiveMQTestBase { + private static final Logger log = Logger.getLogger(LatencyTest.class); + + private static void debugLog(String message) { + log.debug(message); + } /* * simple test to make sure connect still works with some network latency built into netty @@ -40,7 +46,7 @@ public class LatencyTest extends ActiveMQTestBase { targetClass = "org.jboss.netty.bootstrap.ClientBootstrap", targetMethod = "connect", targetLocation = "ENTRY", - action = "log.debug(\"netty connecting\")"), @BMRule( + action = "org.apache.activemq.artemis.tests.extras.byteman.LatencyTest.debugLog(\"netty connecting\")"), @BMRule( name = "sleep OioWorker.run", targetClass = "org.jboss.netty.channel.socket.oio.OioWorker", targetMethod = "run", diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java index 01b6589e6b..733a86205d 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/OrphanedConsumerTest.java @@ -30,6 +30,7 @@ import org.apache.activemq.artemis.tests.util.ActiveMQTestBase; import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRules; import org.jboss.byteman.contrib.bmunit.BMUnitRunner; +import org.jboss.logging.Logger; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -37,6 +38,11 @@ import org.junit.runner.RunWith; @RunWith(BMUnitRunner.class) public class OrphanedConsumerTest extends ActiveMQTestBase { + private static final Logger log = Logger.getLogger(OrphanedConsumerTest.class); + + private static void debugLog(String message) { + log.debug(message); + } private static boolean conditionActive = true; @@ -109,7 +115,7 @@ public class OrphanedConsumerTest extends ActiveMQTestBase { targetMethod = "close", targetLocation = "AT EXIT", condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", - action = "log.debug(\"throwing stuff\");throw new InterruptedException()"), @BMRule( + action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.debugLog(\"throwing stuff\");throw new InterruptedException()"), @BMRule( name = "closeEnter", targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl", targetMethod = "close", @@ -136,7 +142,7 @@ public class OrphanedConsumerTest extends ActiveMQTestBase { targetMethod = "close", targetLocation = "AT EXIT", condition = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.isConditionActive()", - action = "log.debug(\"throwing stuff\");throw new InterruptedException()"), @BMRule( + action = "org.apache.activemq.artemis.tests.extras.byteman.OrphanedConsumerTest.debugLog(\"throwing stuff\");throw new InterruptedException()"), @BMRule( name = "closeEnter", targetClass = "org.apache.activemq.artemis.core.server.impl.ServerConsumerImpl", targetMethod = "close", diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java index 995e7abf96..8bb83f66fe 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/StartStopDeadlockTest.java @@ -42,6 +42,10 @@ import org.junit.runner.RunWith; public class StartStopDeadlockTest extends ActiveMQTestBase { private static final Logger log = Logger.getLogger(StartStopDeadlockTest.class); + private static void debugLog(String message) { + log.debug(message); + } + /* * simple test to make sure connect still works with some network latency built into netty * */ @@ -54,7 +58,7 @@ public class StartStopDeadlockTest extends ActiveMQTestBase { targetMethod = "initialisePart2", targetLocation = "ENTRY", condition = "incrementCounter(\"server-Init\") == 2", - action = "log.debug(\"server backup init\"), waitFor(\"start-init\")"), @BMRule( + action = "org.apache.activemq.artemis.tests.extras.byteman.StartStopDeadlockTest.debugLog(\"server backup init\"), waitFor(\"start-init\")"), @BMRule( name = "JMSServer.stop wait-init", targetClass = "org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl", targetMethod = "stop",