diff --git a/common/pom.xml b/common/pom.xml index 671336742e713e246064d0260308590d47b7b200..2dc43b6fcc23745a1ab8f62317b3c7dfbdc941dc 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 105e7c946ee9c77d66f29d5ac8733c7a49de0374..1ea6dc1f37048b871d7629bdaee76ea272b4b822 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 ee60bd7c5f23a0a2a93938616bc715c1f3910ceb..a74073271924398cbb1d67d0a4313082949de4e6 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 c16d5d5d59a15d4694dc966569ac71dcffd2edb4..992d02e7e72cc5c884ed3ff7ba62ab47e0776383 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 a219fdd2de0e6f5a078071dcd6a1d694d9dc0ef6..f3965c36e14d7e715421596a97651b62bd138492 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 b599208cdcfdb331e5f520876290052793d4073d..5a4d4bffd1135c4d042a0197e56d05a904d2f990 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