You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by do...@apache.org on 2022/04/14 04:50:19 UTC

[incubator-inlong] branch master updated: [INLONG-3652][Agent] Improve TestBinlogOffsetManager unit test (#3689)

This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 80654051d [INLONG-3652][Agent] Improve TestBinlogOffsetManager unit test (#3689)
80654051d is described below

commit 80654051d047713fc9f112a9b71c505d0d4d9fca
Author: xueyingzhang <86...@users.noreply.github.com>
AuthorDate: Thu Apr 14 12:50:14 2022 +0800

    [INLONG-3652][Agent] Improve TestBinlogOffsetManager unit test (#3689)
---
 .../agent/plugin/sources/TestBinlogOffsetManager.java     | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/inlong-agent/agent-plugins/src/test/java/org/apache/inlong/agent/plugin/sources/TestBinlogOffsetManager.java b/inlong-agent/agent-plugins/src/test/java/org/apache/inlong/agent/plugin/sources/TestBinlogOffsetManager.java
index 4d6ec4d1c..45d94632e 100644
--- a/inlong-agent/agent-plugins/src/test/java/org/apache/inlong/agent/plugin/sources/TestBinlogOffsetManager.java
+++ b/inlong-agent/agent-plugins/src/test/java/org/apache/inlong/agent/plugin/sources/TestBinlogOffsetManager.java
@@ -17,7 +17,6 @@
 
 package org.apache.inlong.agent.plugin.sources;
 
-import java.nio.file.Path;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.inlong.agent.plugin.AgentBaseTestsHelper;
 import org.apache.inlong.agent.plugin.sources.snapshot.BinlogSnapshotBase;
@@ -25,19 +24,21 @@ import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
 
 public class TestBinlogOffsetManager {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(TestBinlogOffsetManager.class);
-    private static Path testDir;
     private static AgentBaseTestsHelper helper;
+    private static final String fileName = "test.txt";
+    private static Path filePath;
 
     @BeforeClass
     public static void setup() {
         helper = new AgentBaseTestsHelper(TestBinlogOffsetManager.class.getName()).setupAgentHome();
-        testDir = helper.getTestRootDir();
+        Path testDir = helper.getTestRootDir();
+        filePath = Paths.get(testDir.toString(), fileName);
     }
 
     @AfterClass
@@ -47,7 +48,7 @@ public class TestBinlogOffsetManager {
 
     @Test
     public void testOffset() {
-        BinlogSnapshotBase snapshotManager = new BinlogSnapshotBase(testDir.toString());
+        BinlogSnapshotBase snapshotManager = new BinlogSnapshotBase(filePath.toString());
         byte[] snapshotBytes = new byte[]{-65, -14, -23};
         final Base64 base64 = new Base64();
         String encodeSnapshot = base64.encodeAsString(snapshotBytes);