From 1f54f96fa557ca9137bacd289d1db226fd7c912d Mon Sep 17 00:00:00 2001 From: mayur-solace Date: Wed, 17 Jul 2024 14:58:51 -0400 Subject: [PATCH] Remove unwanted test dependency as requested in https://github.com/SolaceProducts/solace-spring-boot/issues/101 Use slf4j instead of apache logging --- .../solace-java-spring-boot-autoconfigure/pom.xml | 7 ------- .../jcsmp/DefaultSolaceOAuth2SessionEventHandler.java | 9 +++++---- .../jcsmp/DefaultSolaceSessionOAuth2TokenProvider.java | 8 ++++---- .../src/test/resources/commons-logging.properties | 1 - .../src/test/resources/simplelog.properties | 3 --- .../solace-jms-spring-boot-autoconfigure/pom.xml | 6 ------ .../autoconfigure/SolaceJmsAutoConfigurationTest.java | 4 ++-- 7 files changed, 11 insertions(+), 27 deletions(-) delete mode 100644 solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/test/resources/commons-logging.properties delete mode 100644 solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/test/resources/simplelog.properties diff --git a/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/pom.xml b/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/pom.xml index b9af0f1..4fa5c47 100644 --- a/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/pom.xml +++ b/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/pom.xml @@ -46,13 +46,6 @@ spring-boot-starter-test test - - com.github.stefanbirkner - system-rules - 1.19.0 - test - - org.springframework.boot spring-boot-starter-web diff --git a/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/main/java/com/solacesystems/jcsmp/DefaultSolaceOAuth2SessionEventHandler.java b/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/main/java/com/solacesystems/jcsmp/DefaultSolaceOAuth2SessionEventHandler.java index 5e52f7e..40ba2e8 100644 --- a/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/main/java/com/solacesystems/jcsmp/DefaultSolaceOAuth2SessionEventHandler.java +++ b/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/main/java/com/solacesystems/jcsmp/DefaultSolaceOAuth2SessionEventHandler.java @@ -4,8 +4,9 @@ import static com.solacesystems.jcsmp.JCSMPProperties.AUTHENTICATION_SCHEME_OAUTH2; import static com.solacesystems.jcsmp.SessionEvent.RECONNECTING; import java.util.Objects; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * Default implementation of SolaceOAuth2SessionEventHandler. This class handles the OAuth2 token @@ -13,7 +14,7 @@ */ public class DefaultSolaceOAuth2SessionEventHandler implements SolaceOAuth2SessionEventHandler { - private static final Log logger = LogFactory.getLog(DefaultSolaceOAuth2SessionEventHandler.class); + private static final Logger logger = LoggerFactory.getLogger(DefaultSolaceOAuth2SessionEventHandler.class); protected final SolaceSessionOAuth2TokenProvider solaceSessionOAuth2TokenProvider; protected final JCSMPProperties jcsmpProperties; @@ -60,7 +61,7 @@ private void refreshOAuth2AccessToken() { this.jcsmpSession.setProperty(JCSMPProperties.OAUTH2_ACCESS_TOKEN, newAccessToken); } catch (JCSMPException e) { if (logger.isDebugEnabled()) { - logger.debug("Exception while fetching/providing refreshed access token: " + e); + logger.debug("Exception while fetching/providing refreshed access token: ", e); } } } diff --git a/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/main/java/com/solacesystems/jcsmp/DefaultSolaceSessionOAuth2TokenProvider.java b/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/main/java/com/solacesystems/jcsmp/DefaultSolaceSessionOAuth2TokenProvider.java index 440e0ea..5ee5809 100644 --- a/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/main/java/com/solacesystems/jcsmp/DefaultSolaceSessionOAuth2TokenProvider.java +++ b/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/main/java/com/solacesystems/jcsmp/DefaultSolaceSessionOAuth2TokenProvider.java @@ -3,8 +3,8 @@ import static com.solacesystems.jcsmp.JCSMPProperties.USERNAME; import com.solace.spring.boot.autoconfigure.SolaceJavaProperties; import java.util.Objects; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.security.oauth2.client.AuthorizedClientServiceOAuth2AuthorizedClientManager; import org.springframework.security.oauth2.client.OAuth2AuthorizeRequest; import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; @@ -17,7 +17,7 @@ */ public class DefaultSolaceSessionOAuth2TokenProvider implements SolaceSessionOAuth2TokenProvider { - private static final Log logger = LogFactory.getLog( + private static final Logger logger = LoggerFactory.getLogger( DefaultSolaceSessionOAuth2TokenProvider.class); private final JCSMPProperties jcsmpProperties; @@ -68,7 +68,7 @@ public String getAccessToken() { return accessToken.getTokenValue(); } catch (Throwable t) { if (logger.isDebugEnabled()) { - logger.debug("Exception while fetching OAuth2 access token: " + t); + logger.debug("Exception while fetching OAuth2 access token.", t); } throw t; } diff --git a/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/test/resources/commons-logging.properties b/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/test/resources/commons-logging.properties deleted file mode 100644 index d7170f4..0000000 --- a/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/test/resources/commons-logging.properties +++ /dev/null @@ -1 +0,0 @@ -org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog \ No newline at end of file diff --git a/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/test/resources/simplelog.properties b/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/test/resources/simplelog.properties deleted file mode 100644 index 5dc01de..0000000 --- a/solace-spring-boot-autoconfigure/solace-java-spring-boot-autoconfigure/src/test/resources/simplelog.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.apache.commons.logging.simplelog.defaultlog=warn -org.apache.commons.logging.simplelog.showdatetime=true -org.apache.commons.logging.simplelog.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS \ No newline at end of file diff --git a/solace-spring-boot-autoconfigure/solace-jms-spring-boot-autoconfigure/pom.xml b/solace-spring-boot-autoconfigure/solace-jms-spring-boot-autoconfigure/pom.xml index 739cf6f..224ce6c 100644 --- a/solace-spring-boot-autoconfigure/solace-jms-spring-boot-autoconfigure/pom.xml +++ b/solace-spring-boot-autoconfigure/solace-jms-spring-boot-autoconfigure/pom.xml @@ -46,12 +46,6 @@ spring-boot-starter-test test - - com.github.stefanbirkner - system-rules - 1.19.0 - test - org.junit-pioneer junit-pioneer diff --git a/solace-spring-boot-autoconfigure/solace-jms-spring-boot-autoconfigure/src/test/java/com/solace/spring/boot/autoconfigure/SolaceJmsAutoConfigurationTest.java b/solace-spring-boot-autoconfigure/solace-jms-spring-boot-autoconfigure/src/test/java/com/solace/spring/boot/autoconfigure/SolaceJmsAutoConfigurationTest.java index 5e897c0..22b6c06 100644 --- a/solace-spring-boot-autoconfigure/solace-jms-spring-boot-autoconfigure/src/test/java/com/solace/spring/boot/autoconfigure/SolaceJmsAutoConfigurationTest.java +++ b/solace-spring-boot-autoconfigure/solace-jms-spring-boot-autoconfigure/src/test/java/com/solace/spring/boot/autoconfigure/SolaceJmsAutoConfigurationTest.java @@ -18,8 +18,8 @@ */ package com.solace.spring.boot.autoconfigure; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import com.solacesystems.jms.SolConnectionFactoryImpl; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test;