Greedyu commented on code in PR #4113:
URL: https://github.com/apache/incubator-inlong/pull/4113#discussion_r875443073


##########
inlong-agent/agent-plugins/src/test/java/org/apache/inlong/agent/plugin/sources/TestBinlogReader.java:
##########
@@ -18,43 +18,74 @@
 package org.apache.inlong.agent.plugin.sources;
 
 import com.google.gson.Gson;
+import org.apache.inlong.agent.conf.JobProfile;
+import org.apache.inlong.agent.constant.SnapshotModeConstants;
+import org.apache.inlong.agent.plugin.sources.reader.BinlogReader;
 import org.apache.inlong.agent.pojo.DebeziumFormat;
 import org.junit.Assert;
 import org.junit.Test;
 
+import static 
org.apache.inlong.agent.constant.CommonConstants.PROXY_INLONG_GROUP_ID;
+import static 
org.apache.inlong.agent.constant.CommonConstants.PROXY_INLONG_STREAM_ID;
+
 public class TestBinlogReader {
 
     private static Gson gson = new Gson();
 
     @Test
     public void testDebeziumFormat() {
         String debeziumJson = "{\n"
-            + "    \"before\": null,\n"
-            + "    \"after\": {\n"
-            + "      \"id\": 1004,\n"
-            + "      \"first_name\": \"Anne\",\n"
-            + "      \"last_name\": \"Kretchmar\",\n"
-            + "      \"email\": \"[email protected]\"\n"
-            + "    },\n"
-            + "    \"source\": {\n"
-            + "      \"version\": \"1.8.1.Final\",\n"
-            + "      \"name\": \"dbserver1\",\n"
-            + "      \"server_id\": 0,\n"
-            + "      \"ts_sec\": 0,\n"
-            + "      \"gtid\": null,\n"
-            + "      \"file\": \"mysql-bin.000003\",\n"
-            + "      \"pos\": 154,\n"
-            + "      \"row\": 0,\n"
-            + "      \"snapshot\": true,\n"
-            + "      \"thread\": null,\n"
-            + "      \"db\": \"inventory\",\n"
-            + "      \"table\": \"customers\"\n"
-            + "    },\n"
-            + "    \"op\": \"r\",\n"
-            + "    \"ts_ms\": 1486500577691\n"
-            + "  }";
+                + "    \"before\": null,\n"
+                + "    \"after\": {\n"
+                + "      \"id\": 1004,\n"
+                + "      \"first_name\": \"Anne\",\n"
+                + "      \"last_name\": \"Kretchmar\",\n"
+                + "      \"email\": \"[email protected]\"\n"
+                + "    },\n"
+                + "    \"source\": {\n"
+                + "      \"version\": \"1.8.1.Final\",\n"
+                + "      \"name\": \"dbserver1\",\n"
+                + "      \"server_id\": 0,\n"
+                + "      \"ts_sec\": 0,\n"
+                + "      \"gtid\": null,\n"
+                + "      \"file\": \"mysql-bin.000003\",\n"
+                + "      \"pos\": 154,\n"
+                + "      \"row\": 0,\n"
+                + "      \"snapshot\": true,\n"
+                + "      \"thread\": null,\n"
+                + "      \"db\": \"inventory\",\n"
+                + "      \"table\": \"customers\"\n"
+                + "    },\n"
+                + "    \"op\": \"r\",\n"
+                + "    \"ts_ms\": 1486500577691\n"
+                + "  }";
         DebeziumFormat debeziumFormat = gson
-            .fromJson(debeziumJson, DebeziumFormat.class);
+                .fromJson(debeziumJson, DebeziumFormat.class);
         Assert.assertEquals("customers", 
debeziumFormat.getSource().getTable());
     }
+
+    // @Test
+    public void binlogStartSpacialTest() throws Exception {
+        JobProfile jobProfile = new JobProfile();
+        jobProfile.set(BinlogReader.JOB_DATABASE_USER, "root");
+        jobProfile.set(BinlogReader.JOB_DATABASE_PASSWORD, "123456");
+        jobProfile.set(BinlogReader.JOB_DATABASE_HOSTNAME, "");
+        jobProfile.set(BinlogReader.JOB_DATABASE_PORT, "3307");
+        jobProfile.set(BinlogReader.JOB_DATABASE_WHITELIST, "etl");
+        jobProfile.set(BinlogReader.JOB_DATABASE_OFFSET_SPECIFIC_OFFSET_FILE, 
"mysql-bin.000001");
+        jobProfile.set(BinlogReader.JOB_DATABASE_OFFSET_SPECIFIC_OFFSET_POS, 
"5641");
+        // jobProfile.set(BinlogReader.JOB_DATABASE_SNAPSHOT_MODE, 
SnapshotModeConstants.INITIAL);
+        // jobProfile.set(BinlogReader.JOB_DATABASE_SNAPSHOT_MODE, 
SnapshotModeConstants.EARLIEST_OFFSET);

Review Comment:
   resolve



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to