From 92699c0595db419de6822705a94a502fa264d995 Mon Sep 17 00:00:00 2001 From: emptyOVO Date: Thu, 10 Oct 2024 16:50:18 +0800 Subject: [PATCH] fix: ut bug --- .../function/encryption/TestMd5Function.java | 24 +++++++++++++++++++ .../function/encryption/TestSha2Function.java | 24 +++++++++++++++++++ .../function/encryption/TestShaFunction.java | 24 +++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestMd5Function.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestMd5Function.java index f066fe5fc9..158ffb37ff 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestMd5Function.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestMd5Function.java @@ -19,16 +19,40 @@ import org.apache.inlong.sdk.transform.decode.SourceDecoderFactory; import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; +import org.apache.inlong.sdk.transform.pojo.CsvSourceInfo; +import org.apache.inlong.sdk.transform.pojo.FieldInfo; +import org.apache.inlong.sdk.transform.pojo.KvSinkInfo; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; +import org.apache.inlong.sdk.transform.process.converter.BooleanConverter; import org.junit.Assert; import org.junit.Test; +import java.util.ArrayList; import java.util.List; public class TestMd5Function extends AbstractFunctionEncryptionTestBase { + private static final List srcFields = new ArrayList<>(); + private static final List dstFields = new ArrayList<>(); + private static final CsvSourceInfo csvSource; + private static final KvSinkInfo kvSink; + + static { + for (int i = 1; i <= 5; i++) { + FieldInfo field = new FieldInfo(); + field.setName("numeric" + i); + srcFields.add(field); + } + srcFields.add(new FieldInfo("booleanVal", new BooleanConverter())); + FieldInfo field = new FieldInfo(); + field.setName("result"); + dstFields.add(field); + csvSource = new CsvSourceInfo("UTF-8", '|', '\\', srcFields); + kvSink = new KvSinkInfo("UTF-8", dstFields); + } + @Test public void testMd5Function() throws Exception { String transformSql = "select md5(numeric1) from source"; diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestSha2Function.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestSha2Function.java index 5e06948a68..b57a29ac2a 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestSha2Function.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestSha2Function.java @@ -19,17 +19,41 @@ import org.apache.inlong.sdk.transform.decode.SourceDecoderFactory; import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; +import org.apache.inlong.sdk.transform.pojo.CsvSourceInfo; +import org.apache.inlong.sdk.transform.pojo.FieldInfo; +import org.apache.inlong.sdk.transform.pojo.KvSinkInfo; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; +import org.apache.inlong.sdk.transform.process.converter.BooleanConverter; import org.junit.Assert; import org.junit.Test; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class TestSha2Function extends AbstractFunctionEncryptionTestBase { + private static final List srcFields = new ArrayList<>(); + private static final List dstFields = new ArrayList<>(); + private static final CsvSourceInfo csvSource; + private static final KvSinkInfo kvSink; + + static { + for (int i = 1; i <= 5; i++) { + FieldInfo field = new FieldInfo(); + field.setName("numeric" + i); + srcFields.add(field); + } + srcFields.add(new FieldInfo("booleanVal", new BooleanConverter())); + FieldInfo field = new FieldInfo(); + field.setName("result"); + dstFields.add(field); + csvSource = new CsvSourceInfo("UTF-8", '|', '\\', srcFields); + kvSink = new KvSinkInfo("UTF-8", dstFields); + } + @Test public void testSha2Function() throws Exception { String transformSql = null, data = null; diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestShaFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestShaFunction.java index b433c18c42..aa42e831f4 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestShaFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestShaFunction.java @@ -19,17 +19,41 @@ import org.apache.inlong.sdk.transform.decode.SourceDecoderFactory; import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; +import org.apache.inlong.sdk.transform.pojo.CsvSourceInfo; +import org.apache.inlong.sdk.transform.pojo.FieldInfo; +import org.apache.inlong.sdk.transform.pojo.KvSinkInfo; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; +import org.apache.inlong.sdk.transform.process.converter.BooleanConverter; import org.junit.Assert; import org.junit.Test; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class TestShaFunction extends AbstractFunctionEncryptionTestBase { + private static final List srcFields = new ArrayList<>(); + private static final List dstFields = new ArrayList<>(); + private static final CsvSourceInfo csvSource; + private static final KvSinkInfo kvSink; + + static { + for (int i = 1; i <= 5; i++) { + FieldInfo field = new FieldInfo(); + field.setName("numeric" + i); + srcFields.add(field); + } + srcFields.add(new FieldInfo("booleanVal", new BooleanConverter())); + FieldInfo field = new FieldInfo(); + field.setName("result"); + dstFields.add(field); + csvSource = new CsvSourceInfo("UTF-8", '|', '\\', srcFields); + kvSink = new KvSinkInfo("UTF-8", dstFields); + } + @Test public void testShaFunction() throws Exception { String transformSql = null, data = null;