ARTEMIS-4402: add some unit tests exercising the semi-generated log/message bundles to make generation problems more quickly noticable
This commit is contained in:
parent
6d4fad7a4c
commit
df410da7ae
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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)));
|
||||
}
|
||||
}
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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")));
|
||||
}
|
||||
}
|
|
@ -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>
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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")));
|
||||
}
|
||||
}
|
|
@ -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")));
|
||||
}
|
||||
}
|
|
@ -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"));
|
||||
}
|
||||
}
|
|
@ -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>
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
|
@ -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>
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
}
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue