From 1f853910b3b5297e3aedcfa0670c6dac4b58398b Mon Sep 17 00:00:00 2001 From: He Wang Date: Thu, 13 Jan 2022 20:20:20 +0800 Subject: [PATCH] cleanup unnecessary dependencies (#24) --- common/pom.xml | 8 --- logproxy-client/pom.xml | 32 ++--------- .../client/config/ObReaderConfig.java | 4 +- .../client/connection/ClientStream.java | 3 +- .../clogproxy/client/LogProxyClientTest.java | 16 +++--- pom.xml | 53 ++----------------- 6 files changed, 23 insertions(+), 93 deletions(-) diff --git a/common/pom.xml b/common/pom.xml index 6713367..2dc43b6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -31,18 +31,10 @@ See the Mulan PSL v2 for more details. org.apache.commons commons-lang3 - - org.apache.commons - commons-collections4 - commons-codec commons-codec - - com.google.guava - guava - diff --git a/logproxy-client/pom.xml b/logproxy-client/pom.xml index 105e7c9..1ea6dc1 100644 --- a/logproxy-client/pom.xml +++ b/logproxy-client/pom.xml @@ -26,44 +26,22 @@ See the Mulan PSL v2 for more details. The Client for OceanBase Log Proxy. + com.oceanbase.logclient common ${project.version} - - - org.slf4j - slf4j-api - - - org.slf4j - log4j-over-slf4j - - - org.slf4j - jcl-over-slf4j - - - org.slf4j - jul-to-slf4j - - - + - ch.qos.logback - logback-core + junit + junit + test ch.qos.logback logback-classic - - - - - junit - junit test diff --git a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java index ee60bd7..a740732 100644 --- a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java +++ b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java @@ -11,12 +11,12 @@ See the Mulan PSL v2 for more details. */ package com.oceanbase.clogproxy.client.config; -import com.google.common.collect.Maps; import com.oceanbase.clogproxy.client.util.Validator; import com.oceanbase.clogproxy.common.config.SharedConf; import com.oceanbase.clogproxy.common.packet.LogType; import com.oceanbase.clogproxy.common.util.CryptoUtil; import com.oceanbase.clogproxy.common.util.Hex; +import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,7 +45,7 @@ public class ObReaderConfig extends AbstractConnectionConfig { /** Constructor with empty arguments. */ public ObReaderConfig() { - super(Maps.newHashMap()); + super(new HashMap<>()); } /** diff --git a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientStream.java b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientStream.java index c16d5d5..992d02e 100644 --- a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientStream.java +++ b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/connection/ClientStream.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -133,7 +132,7 @@ public class ClientStream { /** Start the process thread. */ public void start() { // if status listener exist, enable monitor - context.params.setEnableMonitor(CollectionUtils.isNotEmpty(statusListeners)); + context.params.setEnableMonitor(!statusListeners.isEmpty()); if (started.compareAndSet(false, true)) { thread = diff --git a/logproxy-client/src/test/java/com/oceanbase/clogproxy/client/LogProxyClientTest.java b/logproxy-client/src/test/java/com/oceanbase/clogproxy/client/LogProxyClientTest.java index a219fdd..f3965c3 100644 --- a/logproxy-client/src/test/java/com/oceanbase/clogproxy/client/LogProxyClientTest.java +++ b/logproxy-client/src/test/java/com/oceanbase/clogproxy/client/LogProxyClientTest.java @@ -20,10 +20,14 @@ import io.netty.handler.ssl.SslContextBuilder; import javax.net.ssl.SSLException; import org.junit.Ignore; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Ignore public class LogProxyClientTest { + private static final Logger logger = LoggerFactory.getLogger(LogProxyClientTest.class); + @Test public void testLogProxyClient() { ObReaderConfig config = new ObReaderConfig(); @@ -39,14 +43,14 @@ public class LogProxyClientTest { new RecordListener() { @Override - public void notify(LogMessage record) { - System.out.println(record); + public void notify(LogMessage message) { + logger.info("LogMessage received: {}", message.toString()); } @Override public void onException(LogProxyClientException e) { if (e.needStop()) { - System.out.println(e.getMessage()); + logger.error(e.getMessage()); client.stop(); } } @@ -70,14 +74,14 @@ public class LogProxyClientTest { new RecordListener() { @Override - public void notify(LogMessage record) { - System.out.println(record); + public void notify(LogMessage message) { + logger.info("LogMessage received: {}", message.toString()); } @Override public void onException(LogProxyClientException e) { if (e.needStop()) { - System.out.println(e.getMessage()); + logger.error(e.getMessage()); client.stop(); } } diff --git a/pom.xml b/pom.xml index b599208..5a4d4bf 100644 --- a/pom.xml +++ b/pom.xml @@ -70,9 +70,7 @@ See the Mulan PSL v2 for more details. ${java.version} 3.12.0 - 4.4 1.15 - 31.0.1-jre 4.1.68.Final 3.18.2 1.8.0 @@ -94,21 +92,11 @@ See the Mulan PSL v2 for more details. commons-lang3 ${commons-lang.version} - - org.apache.commons - commons-collections4 - ${commons-collection.version} - commons-codec commons-codec ${commons-codec.version} - - com.google.guava - guava - ${guava.version} - @@ -135,49 +123,18 @@ See the Mulan PSL v2 for more details. slf4j-api ${slf4j.version} - - org.slf4j - log4j-over-slf4j - ${slf4j.version} - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - - - org.slf4j - jul-to-slf4j - ${slf4j.version} - - + - ch.qos.logback - logback-core - ${logback.version} + junit + junit + ${junit.version} + test ch.qos.logback logback-classic ${logback.version} - - - slf4j-api - org.slf4j - - - slf4j-log4j12 - org.slf4j - - - - - - - junit - junit - ${junit.version} test -- GitLab