You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by "dockerzhang (via GitHub)" <gi...@apache.org> on 2023/04/10 11:11:49 UTC

[GitHub] [inlong] dockerzhang commented on a diff in pull request #7580: [INLONG-7249][Sort] JDBC accurate dirty data archive and metric calculation

dockerzhang commented on code in PR #7580:
URL: https://github.com/apache/inlong/pull/7580#discussion_r1161640685


##########
inlong-sort/sort-connectors/base/src/test/java/org/apache/inlong/sort/base/dirty/RegexReplaceTest.java:
##########
@@ -21,19 +21,16 @@
 import org.junit.Assert;
 import org.junit.Test;
 
-import java.io.IOException;
-
 @Slf4j
 public class RegexReplaceTest {
 
     @Test
-    public void testRegexReplacement() throws IOException {
-        String[] identifier = new String[2];
-        identifier[0] = "yizhouyang";
-        identifier[1] = "table2";
-        String pattern = "${database}-${table}-${DIRTY_MESSAGE}";
-        String answer = DirtySinkHelper.regexReplace(pattern, DirtyType.BATCH_LOAD_ERROR, "mock message", identifier[0],
-                identifier[1], null);
-        Assert.assertEquals("yizhouyang-table2-mock message", answer);
+    public void testRegexReplacement() {
+        String database = "yizhouyang";

Review Comment:
   It's better to use another name for the test.



##########
inlong-sort/sort-connectors/base/src/test/java/org/apache/inlong/sort/base/dirty/RegexReplaceTest.java:
##########
@@ -21,19 +21,16 @@
 import org.junit.Assert;
 import org.junit.Test;
 
-import java.io.IOException;
-
 @Slf4j
 public class RegexReplaceTest {
 
     @Test
-    public void testRegexReplacement() throws IOException {
-        String[] identifier = new String[2];
-        identifier[0] = "yizhouyang";
-        identifier[1] = "table2";
-        String pattern = "${database}-${table}-${DIRTY_MESSAGE}";
-        String answer = DirtySinkHelper.regexReplace(pattern, DirtyType.BATCH_LOAD_ERROR, "mock message", identifier[0],
-                identifier[1], null);
-        Assert.assertEquals("yizhouyang-table2-mock message", answer);
+    public void testRegexReplacement() {
+        String database = "yizhouyang";
+        String table = "table2";
+        String pattern = "${source.table}-${source.database}-${DIRTY_MESSAGE}";
+        String answer = DirtySinkHelper.regexReplace(pattern, DirtyType.BATCH_LOAD_ERROR, "mock message", database,
+                table, null);
+        Assert.assertEquals("table2-yizhouyang-mock message", answer);

Review Comment:
   ditto



-- 
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: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org