diff --git a/components/camel-xmpp/pom.xml b/components/camel-xmpp/pom.xml index d39f320952678..e1f4b96830ede 100644 --- a/components/camel-xmpp/pom.xml +++ b/components/camel-xmpp/pom.xml @@ -82,6 +82,13 @@ test + + org.slf4j + jul-to-slf4j + ${slf4j-version} + test + + org.apache.camel @@ -91,30 +98,4 @@ test - - - - full - - - !quickly - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - true - - true - - - - - - - diff --git a/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/XmppBaseContainerTest.java b/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/XmppBaseContainerTest.java index 339c192f565a7..42adbeec05f4d 100644 --- a/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/XmppBaseContainerTest.java +++ b/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/XmppBaseContainerTest.java @@ -17,14 +17,32 @@ package org.apache.camel.component.xmpp; +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.LogManager; + import org.apache.camel.spi.Registry; import org.apache.camel.support.SimpleRegistry; import org.apache.camel.test.infra.xmpp.services.XmppServerContainer; import org.apache.camel.test.junit5.CamelTestSupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public abstract class XmppBaseContainerTest extends CamelTestSupport { protected XmppServerContainer xmppServer = new XmppServerContainer(); + static { + try (InputStream is = XmppBaseContainerTest.class.getClassLoader().getResourceAsStream("logging.properties")) { + LogManager.getLogManager().readConfiguration(is); + } catch (IOException e) { + Logger logger = LoggerFactory.getLogger(XmppBaseContainerTest.class); + + logger.warn( + "Unable to setup JUL-to-slf4j logging bridge. The test execution should result in a log of bogus output. Error: {}", + e.getMessage(), e); + } + } + @Override protected Registry createCamelRegistry() throws Exception { Registry registry = new SimpleRegistry(); diff --git a/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/integration/XmppBaseIT.java b/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/integration/XmppBaseIT.java index 9cd81e4d3527e..ae59a76001ebc 100644 --- a/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/integration/XmppBaseIT.java +++ b/components/camel-xmpp/src/test/java/org/apache/camel/component/xmpp/integration/XmppBaseIT.java @@ -16,6 +16,10 @@ */ package org.apache.camel.component.xmpp.integration; +import java.io.IOException; +import java.io.InputStream; +import java.util.logging.LogManager; + import org.apache.camel.component.xmpp.XmppTestUtil; import org.apache.camel.spi.Registry; import org.apache.camel.support.SimpleRegistry; @@ -25,6 +29,8 @@ import org.junit.jupiter.api.condition.DisabledOnOs; import org.junit.jupiter.api.condition.OS; import org.junit.jupiter.api.extension.RegisterExtension; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; // This was originally disabled on the pom file with the reason given below. @DisabledOnOs(value = OS.AIX, disabledReason = "has problem with all the new reconnection stuff and whatnot") @@ -32,6 +38,18 @@ public class XmppBaseIT extends CamelTestSupport { @RegisterExtension static XmppService service = XmppServiceFactory.createService(); + static { + try (InputStream is = XmppBaseIT.class.getClassLoader().getResourceAsStream("logging.properties")) { + LogManager.getLogManager().readConfiguration(is); + } catch (IOException e) { + Logger logger = LoggerFactory.getLogger(XmppBaseIT.class); + + logger.warn( + "Unable to setup JUL-to-slf4j logging bridge. The test execution should result in a log of bogus output. Error: {}", + e.getMessage(), e); + } + } + @Override protected Registry createCamelRegistry() throws Exception { Registry registry = new SimpleRegistry(); diff --git a/components/camel-xmpp/src/test/resources/logging.properties b/components/camel-xmpp/src/test/resources/logging.properties new file mode 100644 index 0000000000000..24628f3ff2ffb --- /dev/null +++ b/components/camel-xmpp/src/test/resources/logging.properties @@ -0,0 +1,18 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +handlers = org.slf4j.bridge.SLF4JBridgeHandler +.level = FINEST