This is an automated email from the ASF dual-hosted git repository.
robbie 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 df410da7ae ARTEMIS-4402: add some unit tests exercising the
semi-generated log/message bundles to make generation problems more quickly
noticable
df410da7ae is described below
commit df410da7aeedcb056d18b9dc625b4a41a2aee500
Author: Robbie Gemmell <[email protected]>
AuthorDate: Fri Aug 25 15:02:24 2023 +0100
ARTEMIS-4402: add some unit tests exercising the semi-generated log/message
bundles to make generation problems more quickly noticable
---
.../client/cdi/logger/CDILogBundleTest.java | 51 +++++++++++++
.../bootstrap/BootstrapLogBundleTest.java | 50 +++++++++++++
.../artemis/logs/CommonsLogBundlesTest.java | 86 ++++++++++++++++++++++
.../core/client/CoreClientLogBundlesTest.java | 63 ++++++++++++++++
artemis-jakarta-client/pom.xml | 6 ++
artemis-jakarta-ra/pom.xml | 11 +++
artemis-jakarta-server/pom.xml | 11 +++
.../jms/client/JmsClientLogBundlesTest.java | 62 ++++++++++++++++
artemis-jms-server/pom.xml | 11 +++
.../jms/bridge/JmsServerBridgeLogBundlesTest.java | 51 +++++++++++++
.../jms/server/JmsServerLogBundlesTest.java | 62 ++++++++++++++++
.../artemis/journal/JournalLogBundlesTest.java | 63 ++++++++++++++++
.../protocol/amqp/logger/AMQPLogBundlesTest.java | 62 ++++++++++++++++
artemis-protocols/artemis-mqtt-protocol/pom.xml | 16 ++++
.../core/protocol/mqtt/MQTTLogBundleTest.java | 50 +++++++++++++
artemis-protocols/artemis-stomp-protocol/pom.xml | 5 ++
.../core/protocol/stomp/StompLogBundlesTest.java | 61 +++++++++++++++
artemis-ra/pom.xml | 11 +++
.../activemq/artemis/ra/RALogBundlesTest.java | 64 ++++++++++++++++
.../activemq/artemis/osgi/OsgiLogBundleTest.java | 50 +++++++++++++
.../artemis/core/server/ServerLogBundlesTest.java | 81 ++++++++++++++++++++
.../impl/ServerPluginLoggerLogBundleTest.java | 51 +++++++++++++
.../extensions/ServiceExtensionLogBundlesTest.java | 64 ++++++++++++++++
.../apache/activemq/artemis/WebLogBundleTest.java | 50 +++++++++++++
24 files changed, 1092 insertions(+)
diff --git
a/artemis-cdi-client/src/test/java/org/apache/artemis/client/cdi/logger/CDILogBundleTest.java
b/artemis-cdi-client/src/test/java/org/apache/artemis/client/cdi/logger/CDILogBundleTest.java
new file mode 100644
index 0000000000..de95db0b22
--- /dev/null
+++
b/artemis-cdi-client/src/test/java/org/apache/artemis/client/cdi/logger/CDILogBundleTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.artemis.client.cdi.logger;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CDILogBundleTest {
+
+ private static final String LOGGER_NAME =
ActiveMQCDILogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.DEBUG);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQCDILogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(false)) {
+ ActiveMQCDILogger.LOGGER.notUsingDefaultConfiguration();
+
+ assertTrue(loggerHandler.findText("AMQ573000", "not using built in
configuration"));
+ }
+ }
+
+}
diff --git
a/artemis-cli/src/test/java/org/apache/activemq/artemis/integration/bootstrap/BootstrapLogBundleTest.java
b/artemis-cli/src/test/java/org/apache/activemq/artemis/integration/bootstrap/BootstrapLogBundleTest.java
new file mode 100644
index 0000000000..44c26c7da4
--- /dev/null
+++
b/artemis-cli/src/test/java/org/apache/activemq/artemis/integration/bootstrap/BootstrapLogBundleTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.integration.bootstrap;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class BootstrapLogBundleTest {
+
+ private static final String LOGGER_NAME =
ActiveMQBootstrapLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.DEBUG);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQBootstrapLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ ActiveMQBootstrapLogger.LOGGER.serverStarting("versionBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ101000", "versionBreadCrumb"));
+ }
+ }
+}
diff --git
a/artemis-commons/src/test/java/org/apache/activemq/artemis/logs/CommonsLogBundlesTest.java
b/artemis-commons/src/test/java/org/apache/activemq/artemis/logs/CommonsLogBundlesTest.java
new file mode 100644
index 0000000000..e55c9fa0b2
--- /dev/null
+++
b/artemis-commons/src/test/java/org/apache/activemq/artemis/logs/CommonsLogBundlesTest.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.logs;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CommonsLogBundlesTest {
+
+ private static final String AUDIT_LOGGERS = "org.apache.activemq.audit";
+ private static final String UTIL_LOGGER =
ActiveMQUtilLogger.class.getPackage().getName();
+ private static LogLevel origAuditLoggersLevel;
+ private static LogLevel origUtilLoggersLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origAuditLoggersLevel = AssertionLoggerHandler.setLevel(AUDIT_LOGGERS,
LogLevel.INFO);
+ origUtilLoggersLevel = AssertionLoggerHandler.setLevel(UTIL_LOGGER,
LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(AUDIT_LOGGERS, origAuditLoggersLevel);
+ AssertionLoggerHandler.setLevel(UTIL_LOGGER, origUtilLoggersLevel);
+ }
+
+ @Test
+ public void testActiveMQUtilLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ ActiveMQUtilLogger.LOGGER.addressWasntReacheable("addressBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ202002", "addressBreadCrumb"));
+ }
+ }
+
+ @Test
+ public void testActiveMQUtilBundle() throws Exception {
+ ActiveMQIllegalStateException e =
ActiveMQUtilBundle.BUNDLE.invalidProperty("breadcrumb");
+
+ String message = e.getMessage();
+ assertNotNull(message);
+ assertTrue("unexpected message: " + message,
message.startsWith("AMQ209000"));
+ assertTrue("unexpected message: " + message,
message.contains("breadcrumb"));
+ }
+
+ @Test
+ public void testAuditLoggers() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ AuditLogger.BASE_LOGGER.getRoutingTypes("userBreadCrumb",
"resourceBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ601000", "userBreadCrumb",
"resourceBreadCrumb"));
+ }
+
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ AuditLogger.RESOURCE_LOGGER.createAddressSuccess("userBreadCrumb",
"nameBreadCrumb", "routingBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ601701", "userBreadCrumb",
"nameBreadCrumb", "routingBreadCrumb"));
+ }
+
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ AuditLogger.MESSAGE_LOGGER.coreSendMessage("userBreadCrumb",
"messageBreadCrumb", "contextBreadCrumb", "txBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ601500", "userBreadCrumb",
"messageBreadCrumb", "contextBreadCrumb", "txBreadCrumb"));
+ }
+ }
+}
diff --git
a/artemis-core-client/src/test/java/org/apache/activemq/artemis/core/client/CoreClientLogBundlesTest.java
b/artemis-core-client/src/test/java/org/apache/activemq/artemis/core/client/CoreClientLogBundlesTest.java
new file mode 100644
index 0000000000..e7de2db3c4
--- /dev/null
+++
b/artemis-core-client/src/test/java/org/apache/activemq/artemis/core/client/CoreClientLogBundlesTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.core.client;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CoreClientLogBundlesTest {
+
+ private static final String LOGGER_NAME =
ActiveMQClientLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQClientLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ ActiveMQClientLogger.LOGGER.propertyNotInteger("nameBreadCrumb",
"typeBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ212043", "nameBreadCrumb",
"typeBreadCrumb"));
+ }
+ }
+
+ @Test
+ public void testActiveMQClientMessageBundle() throws Exception {
+ int headerSize = 42716926;
+ ActiveMQIllegalStateException e =
ActiveMQClientMessageBundle.BUNDLE.headerSizeTooBig(headerSize);
+
+ String message = e.getMessage();
+ assertNotNull(message);
+ assertTrue("unexpected message: " + message,
message.startsWith("AMQ219022"));
+ assertTrue("unexpected message: " + message,
message.contains(String.valueOf(headerSize)));
+ }
+}
diff --git a/artemis-jakarta-client/pom.xml b/artemis-jakarta-client/pom.xml
index d8b024d40f..dc2cf3a0bb 100644
--- a/artemis-jakarta-client/pom.xml
+++ b/artemis-jakarta-client/pom.xml
@@ -69,6 +69,12 @@
<artifactId>jakarta.jms-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-unit-test-support</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
diff --git a/artemis-jakarta-ra/pom.xml b/artemis-jakarta-ra/pom.xml
index 95de9b2b95..a16e0d2094 100644
--- a/artemis-jakarta-ra/pom.xml
+++ b/artemis-jakarta-ra/pom.xml
@@ -95,6 +95,17 @@
<artifactId>jgroups</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-unit-test-support</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/artemis-jakarta-server/pom.xml b/artemis-jakarta-server/pom.xml
index 5909b26119..8d65afbc91 100644
--- a/artemis-jakarta-server/pom.xml
+++ b/artemis-jakarta-server/pom.xml
@@ -89,6 +89,17 @@
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-unit-test-support</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git
a/artemis-jms-client/src/test/java/org/apache/activemq/artemis/jms/client/JmsClientLogBundlesTest.java
b/artemis-jms-client/src/test/java/org/apache/activemq/artemis/jms/client/JmsClientLogBundlesTest.java
new file mode 100644
index 0000000000..f24e51fb78
--- /dev/null
+++
b/artemis-jms-client/src/test/java/org/apache/activemq/artemis/jms/client/JmsClientLogBundlesTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.jms.client;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JmsClientLogBundlesTest {
+
+ private static final String LOGGER_NAME =
ActiveMQJMSClientLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQJMSClientLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+
ActiveMQJMSClientLogger.LOGGER.errorPreparingMessageForReceipt("messageBreadCrumb",
new RuntimeException("ExceptionBreadCrumb"));
+
+ assertTrue(loggerHandler.findText("AMQ134003", "messageBreadCrumb"));
+ assertTrue(loggerHandler.findTrace("ExceptionBreadCrumb"));
+ }
+ }
+
+ @Test
+ public void testActiveMQJMSClientBundle() throws Exception {
+ IllegalArgumentException e =
ActiveMQJMSClientBundle.BUNDLE.nullArgumentNotAllowed("typeBreadCrumb");
+
+ String message = e.getMessage();
+ assertNotNull(message);
+ assertTrue("unexpected message: " + message,
message.startsWith("AMQ139009"));
+ assertTrue("unexpected message: " + message,
message.contains(String.valueOf("typeBreadCrumb")));
+ }
+}
diff --git a/artemis-jms-server/pom.xml b/artemis-jms-server/pom.xml
index fc32519b72..bf69b14664 100644
--- a/artemis-jms-server/pom.xml
+++ b/artemis-jms-server/pom.xml
@@ -86,5 +86,16 @@
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-unit-test-support</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git
a/artemis-jms-server/src/test/java/org/apache/activemq/artemis/jms/bridge/JmsServerBridgeLogBundlesTest.java
b/artemis-jms-server/src/test/java/org/apache/activemq/artemis/jms/bridge/JmsServerBridgeLogBundlesTest.java
new file mode 100644
index 0000000000..c04c0abc05
--- /dev/null
+++
b/artemis-jms-server/src/test/java/org/apache/activemq/artemis/jms/bridge/JmsServerBridgeLogBundlesTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.jms.bridge;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JmsServerBridgeLogBundlesTest {
+
+ private static final String LOGGER_NAME =
ActiveMQJMSBridgeLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQJMSBridgeLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+
ActiveMQJMSBridgeLogger.LOGGER.bridgeConnected("bridgeNameBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ341002",
"bridgeNameBreadCrumb"));
+ }
+ }
+
+}
diff --git
a/artemis-jms-server/src/test/java/org/apache/activemq/artemis/jms/server/JmsServerLogBundlesTest.java
b/artemis-jms-server/src/test/java/org/apache/activemq/artemis/jms/server/JmsServerLogBundlesTest.java
new file mode 100644
index 0000000000..31c42a397a
--- /dev/null
+++
b/artemis-jms-server/src/test/java/org/apache/activemq/artemis/jms/server/JmsServerLogBundlesTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.jms.server;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.api.core.ActiveMQInternalErrorException;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JmsServerLogBundlesTest {
+
+ private static final String LOGGER_NAME =
ActiveMQJMSServerLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQJMSServerLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+
ActiveMQJMSServerLogger.LOGGER.failedToSendNotification("notificationBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ122018",
"notificationBreadCrumb"));
+ }
+ }
+
+ @Test
+ public void testActiveMQJMSServerBundle() throws Exception {
+ ActiveMQInternalErrorException e =
ActiveMQJMSServerBundle.BUNDLE.cfDoesntExist("factoryBreadCrumb");
+
+ String message = e.getMessage();
+ assertNotNull(message);
+ assertTrue("unexpected message: " + message,
message.startsWith("AMQ129000"));
+ assertTrue("unexpected message: " + message,
message.contains(String.valueOf("factoryBreadCrumb")));
+ }
+}
diff --git
a/artemis-journal/src/test/java/org/apache/activemq/artemis/journal/JournalLogBundlesTest.java
b/artemis-journal/src/test/java/org/apache/activemq/artemis/journal/JournalLogBundlesTest.java
new file mode 100644
index 0000000000..a33658c0cb
--- /dev/null
+++
b/artemis-journal/src/test/java/org/apache/activemq/artemis/journal/JournalLogBundlesTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.journal;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.api.core.ActiveMQIOErrorException;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class JournalLogBundlesTest {
+
+ private static final String LOGGER_NAME =
ActiveMQJournalLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQJournalLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+
ActiveMQJournalLogger.LOGGER.deletingOrphanedFile("fileNameBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ142019", "fileNameBreadCrumb"));
+ }
+ }
+
+ @Test
+ public void testActiveMQJournalBundle() throws Exception {
+ ActiveMQIOErrorException e =
ActiveMQJournalBundle.BUNDLE.ioRenameFileError("oldFileNameBreadCrumb",
"oldFileNameBreadCrumb");
+
+ String message = e.getMessage();
+ assertNotNull(message);
+ assertTrue("unexpected message: " + message,
message.startsWith("AMQ149000"));
+ assertTrue("unexpected message: " + message,
message.contains(String.valueOf("oldFileNameBreadCrumb")));
+ assertTrue("unexpected message: " + message,
message.contains(String.valueOf("oldFileNameBreadCrumb")));
+ }
+}
diff --git
a/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/logger/AMQPLogBundlesTest.java
b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/logger/AMQPLogBundlesTest.java
new file mode 100644
index 0000000000..03029bbd02
--- /dev/null
+++
b/artemis-protocols/artemis-amqp-protocol/src/test/java/org/apache/activemq/artemis/protocol/amqp/logger/AMQPLogBundlesTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.protocol.amqp.logger;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import
org.apache.activemq.artemis.protocol.amqp.exceptions.ActiveMQAMQPInternalErrorException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class AMQPLogBundlesTest {
+
+ private static final String LOGGER_NAME =
ActiveMQAMQPProtocolLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQAMQPProtocolLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+
ActiveMQAMQPProtocolLogger.LOGGER.incompatibleAddressFullMessagePolicy("oldAddressCrumb",
"oldPolicyCrumb", "newAddressCrumb", "newPolicyCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ111004", "oldAddressCrumb",
"oldPolicyCrumb", "newAddressCrumb", "newPolicyCrumb"));
+ }
+ }
+
+ @Test
+ public void ActiveMQAMQPProtocolMessageBundle() throws Exception {
+ ActiveMQAMQPInternalErrorException e =
ActiveMQAMQPProtocolMessageBundle.BUNDLE.errorCreatingConsumer("messageBreadCrumb");
+
+ String message = e.getMessage();
+ assertNotNull(message);
+ assertTrue("unexpected message: " + message,
message.startsWith("AMQ119005"));
+ assertTrue("unexpected message: " + message,
message.contains("messageBreadCrumb"));
+ }
+}
diff --git a/artemis-protocols/artemis-mqtt-protocol/pom.xml
b/artemis-protocols/artemis-mqtt-protocol/pom.xml
index 95e3c0b0dd..e4d711e0c9 100644
--- a/artemis-protocols/artemis-mqtt-protocol/pom.xml
+++ b/artemis-protocols/artemis-mqtt-protocol/pom.xml
@@ -95,6 +95,22 @@
<scope>test</scope>
<type>jar</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-unit-test-support</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git
a/artemis-protocols/artemis-mqtt-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTLogBundleTest.java
b/artemis-protocols/artemis-mqtt-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTLogBundleTest.java
new file mode 100644
index 0000000000..10e933dd7f
--- /dev/null
+++
b/artemis-protocols/artemis-mqtt-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTLogBundleTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.core.protocol.mqtt;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MQTTLogBundleTest {
+
+ private static final String LOGGER_NAME =
MQTTLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testMQTTLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ MQTTLogger.LOGGER.failedToCastProperty("propertyBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ834005", "propertyBreadCrumb"));
+ }
+ }
+}
diff --git a/artemis-protocols/artemis-stomp-protocol/pom.xml
b/artemis-protocols/artemis-stomp-protocol/pom.xml
index 0c2235f75f..4020eb5216 100644
--- a/artemis-protocols/artemis-stomp-protocol/pom.xml
+++ b/artemis-protocols/artemis-stomp-protocol/pom.xml
@@ -84,6 +84,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git
a/artemis-protocols/artemis-stomp-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/stomp/StompLogBundlesTest.java
b/artemis-protocols/artemis-stomp-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/stomp/StompLogBundlesTest.java
new file mode 100644
index 0000000000..6d0350ffa5
--- /dev/null
+++
b/artemis-protocols/artemis-stomp-protocol/src/test/java/org/apache/activemq/artemis/core/protocol/stomp/StompLogBundlesTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.core.protocol.stomp;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StompLogBundlesTest {
+
+ private static final String LOGGER_NAME =
ActiveMQStompProtocolLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQStompProtocolLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+
ActiveMQStompProtocolLogger.LOGGER.sentErrorToClient("addressBreadCrumb",
"messageBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ332069", "addressBreadCrumb",
"messageBreadCrumb"));
+ }
+ }
+
+ @Test
+ public void testActiveMQStompProtocolMessageBundle() throws Exception {
+ ActiveMQStompException e =
ActiveMQStompProtocolMessageBundle.BUNDLE.destinationNotExist("destinationBreadcrumb");
+
+ String message = e.getMessage();
+ assertNotNull(message);
+ assertTrue("unexpected message: " + message,
message.startsWith("AMQ339001"));
+ assertTrue("unexpected message: " + message,
message.contains("destinationBreadcrumb"));
+ }
+}
diff --git a/artemis-ra/pom.xml b/artemis-ra/pom.xml
index 9db8b7a74f..463487c527 100644
--- a/artemis-ra/pom.xml
+++ b/artemis-ra/pom.xml
@@ -90,6 +90,17 @@
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-unit-test-support</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git
a/artemis-ra/src/test/java/org/apache/activemq/artemis/ra/RALogBundlesTest.java
b/artemis-ra/src/test/java/org/apache/activemq/artemis/ra/RALogBundlesTest.java
new file mode 100644
index 0000000000..35b9bb770a
--- /dev/null
+++
b/artemis-ra/src/test/java/org/apache/activemq/artemis/ra/RALogBundlesTest.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.ra;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import javax.jms.JMSRuntimeException;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class RALogBundlesTest {
+
+ private static final String LOGGER_NAME = ActiveMQRALogger.class.getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQRALogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+
ActiveMQRALogger.LOGGER.awaitingTopicQueueCreation("subQueueNameBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ151000",
"subQueueNameBreadCrumb"));
+ }
+ }
+
+ @Test
+ public void testActiveMQRABundle() throws Exception {
+ int invalidAckMode = 315245;
+ JMSRuntimeException e =
ActiveMQRABundle.BUNDLE.invalidAcknowledgeMode(invalidAckMode);
+
+ String message = e.getMessage();
+ assertNotNull(message);
+ assertTrue("unexpected message: " + message,
message.startsWith("AMQ159006"));
+ assertTrue("unexpected message: " + message,
message.contains(String.valueOf(invalidAckMode)));
+ }
+}
diff --git
a/artemis-server-osgi/src/test/java/org/apache/activemq/artemis/osgi/OsgiLogBundleTest.java
b/artemis-server-osgi/src/test/java/org/apache/activemq/artemis/osgi/OsgiLogBundleTest.java
new file mode 100644
index 0000000000..6db373dc26
--- /dev/null
+++
b/artemis-server-osgi/src/test/java/org/apache/activemq/artemis/osgi/OsgiLogBundleTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.osgi;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class OsgiLogBundleTest {
+
+ private static final String LOGGER_NAME =
ActiveMQOsgiLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQOsgiLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ ActiveMQOsgiLogger.LOGGER.brokerConfigFound("nameBreadCrumb",
"protocolBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ581000", "nameBreadCrumb",
"protocolBreadCrumb"));
+ }
+ }
+}
diff --git
a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/ServerLogBundlesTest.java
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/ServerLogBundlesTest.java
new file mode 100644
index 0000000000..42f7283d2c
--- /dev/null
+++
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/ServerLogBundlesTest.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.core.server;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.api.core.ActiveMQIllegalStateException;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ServerLogBundlesTest {
+
+ private static final String SERVER_LOGGER =
ActiveMQServerLogger.class.getPackage().getName();
+ private static final String QUEUE_LOGGER = Queue.class.getName();
+ private static LogLevel origServerLoggerLevel;
+ private static LogLevel origQueueLoggerLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origServerLoggerLevel = AssertionLoggerHandler.setLevel(SERVER_LOGGER,
LogLevel.INFO);
+ origQueueLoggerLevel = AssertionLoggerHandler.setLevel(QUEUE_LOGGER,
LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(SERVER_LOGGER, origServerLoggerLevel);
+ AssertionLoggerHandler.setLevel(QUEUE_LOGGER, origQueueLoggerLevel);
+ }
+
+ @Test
+ public void testActiveMQServerLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ ActiveMQServerLogger.LOGGER.autoRemoveAddress("addressBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ224113", "addressBreadCrumb"));
+ }
+ }
+
+ @Test
+ public void testActiveMQMessageBundle() throws Exception {
+ ActiveMQIllegalStateException e =
ActiveMQMessageBundle.BUNDLE.bindingAlreadyExists("nameBreadCrumb",
"bindingBreadCrumb");
+
+ String message = e.getMessage();
+ assertNotNull(message);
+ assertTrue("unexpected message: " + message,
message.startsWith("AMQ229235"));
+ assertTrue("unexpected message: " + message,
message.contains("nameBreadCrumb"));
+ assertTrue("unexpected message: " + message,
message.contains("bindingBreadCrumb"));
+ }
+
+ @Test
+ public void testActiveMQQueueLogger() throws Exception {
+ int messageCount = 1003;
+ int messageBytes = 70004;
+ int maxMessages = 1000;
+ int maxMessagesBytes = 60001;
+
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ ActiveMQQueueLogger.LOGGER.warnPageFlowControl("addressBreadCrumb",
"queueBreadCrumb", messageCount, messageBytes, maxMessages, maxMessagesBytes);
+
+ assertTrue(loggerHandler.findText("AMQ224127", "addressBreadCrumb",
"queueBreadCrumb", String.valueOf(messageCount), String.valueOf(messageBytes),
String.valueOf(maxMessages), String.valueOf(maxMessagesBytes)));
+ }
+ }
+}
diff --git
a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/plugin/impl/ServerPluginLoggerLogBundleTest.java
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/plugin/impl/ServerPluginLoggerLogBundleTest.java
new file mode 100644
index 0000000000..a82c6e3d93
--- /dev/null
+++
b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/plugin/impl/ServerPluginLoggerLogBundleTest.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.core.server.plugin.impl;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ServerPluginLoggerLogBundleTest {
+
+ private static final String LOGGER_NAME =
LoggingActiveMQServerPluginLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testLoggingActiveMQServerPluginLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+
LoggingActiveMQServerPluginLogger.LOGGER.afterDeliverNoConsumer("messageIDBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ841011",
"messageIDBreadCrumb"));
+ }
+ }
+
+}
diff --git
a/artemis-service-extensions/src/test/java/org/apache/activemq/artemis/service/extensions/ServiceExtensionLogBundlesTest.java
b/artemis-service-extensions/src/test/java/org/apache/activemq/artemis/service/extensions/ServiceExtensionLogBundlesTest.java
new file mode 100644
index 0000000000..c273ca5c2c
--- /dev/null
+++
b/artemis-service-extensions/src/test/java/org/apache/activemq/artemis/service/extensions/ServiceExtensionLogBundlesTest.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.service.extensions;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import
org.apache.activemq.artemis.service.extensions.xa.recovery.ActiveMQXARecoveryLogger;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ServiceExtensionLogBundlesTest {
+
+ private static final String EXTENSIONS_LOGGER =
ActiveMQServiceExtensionLogger.class.getPackage().getName();
+ private static final String RECOVERY_LOGGER =
ActiveMQXARecoveryLogger.class.getPackage().getName();
+ private static LogLevel origExtensionsLoggerLevel;
+ private static LogLevel origRecoveryLoggerLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origExtensionsLoggerLevel =
AssertionLoggerHandler.setLevel(EXTENSIONS_LOGGER, LogLevel.INFO);
+ origRecoveryLoggerLevel =
AssertionLoggerHandler.setLevel(RECOVERY_LOGGER, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(EXTENSIONS_LOGGER,
origExtensionsLoggerLevel);
+ AssertionLoggerHandler.setLevel(RECOVERY_LOGGER,
origRecoveryLoggerLevel);
+ }
+
+ @Test
+ public void testActiveMQServiceExtensionLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ ActiveMQServiceExtensionLogger.LOGGER.transactionManagerNotFound();
+
+ assertTrue(loggerHandler.findText("AMQ352000"));
+ }
+ }
+
+ @Test
+ public void testActiveMQXARecoveryLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ ActiveMQXARecoveryLogger.LOGGER.noQueueOnTopic("queueBreadCrumb",
"addressBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ172007", "queueBreadCrumb",
"addressBreadCrumb"));
+ }
+ }
+}
diff --git
a/artemis-web/src/test/java/org/apache/activemq/artemis/WebLogBundleTest.java
b/artemis-web/src/test/java/org/apache/activemq/artemis/WebLogBundleTest.java
new file mode 100644
index 0000000000..62a615ae6d
--- /dev/null
+++
b/artemis-web/src/test/java/org/apache/activemq/artemis/WebLogBundleTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler.LogLevel;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class WebLogBundleTest {
+
+ private static final String LOGGER_NAME =
ActiveMQWebLogger.class.getPackage().getName();
+ private static LogLevel origLevel;
+
+ @BeforeClass
+ public static void setLogLevel() {
+ origLevel = AssertionLoggerHandler.setLevel(LOGGER_NAME, LogLevel.INFO);
+ }
+
+ @AfterClass
+ public static void restoreLogLevel() throws Exception {
+ AssertionLoggerHandler.setLevel(LOGGER_NAME, origLevel);
+ }
+
+ @Test
+ public void testActiveMQWebLogger() throws Exception {
+ try (AssertionLoggerHandler loggerHandler = new
AssertionLoggerHandler(true)) {
+ ActiveMQWebLogger.LOGGER.consoleAvailable("urlBreadCrumb");
+
+ assertTrue(loggerHandler.findText("AMQ241004", "urlBreadCrumb"));
+ }
+ }
+}