diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/AbstractFunctionCollectionTestBase.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/AbstractFunctionCollectionTestBase.java new file mode 100644 index 0000000000..0fac7dcdec --- /dev/null +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/AbstractFunctionCollectionTestBase.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.sdk.transform.process.function.collection; + +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 java.util.ArrayList; +import java.util.List; + +/** + * AbstractFunctionStringTestBase + * description: define static parameters for StringFunction tests + */ +public abstract class AbstractFunctionCollectionTestBase { + + protected static final List srcFields = new ArrayList<>(); + protected static final List dstFields = new ArrayList<>(); + protected static final CsvSourceInfo csvSource; + protected static final KvSinkInfo kvSink; + + static { + for (int i = 1; i < 4; i++) { + FieldInfo field = new FieldInfo(); + field.setName("string" + i); + srcFields.add(field); + } + for (int i = 1; i < 4; i++) { + FieldInfo field = new FieldInfo(); + field.setName("numeric" + i); + srcFields.add(field); + } + FieldInfo field = new FieldInfo(); + field.setName("result"); + dstFields.add(field); + csvSource = new CsvSourceInfo("UTF-8", '|', '\\', srcFields); + kvSink = new KvSinkInfo("UTF-8", dstFields); + } +} \ No newline at end of file diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestArrayFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestArrayFunction.java index 2b87d2c944..33ebae9cb8 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestArrayFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestArrayFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestArrayFunction extends AbstractFunctionStringTestBase { +public class TestArrayFunction extends AbstractFunctionCollectionTestBase { @Test public void testArrayFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestFindInSetFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestFindInSetFunction.java index d5c571d50d..463fa52550 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestFindInSetFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestFindInSetFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestFindInSetFunction extends AbstractFunctionStringTestBase { +public class TestFindInSetFunction extends AbstractFunctionCollectionTestBase { @Test public void testFindInSetFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapEntriesFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapEntriesFunction.java index f9dcb99084..447be1e01a 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapEntriesFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapEntriesFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestMapEntriesFunction extends AbstractFunctionStringTestBase { +public class TestMapEntriesFunction extends AbstractFunctionCollectionTestBase { @Test public void testMapEntriesFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapFromArraysFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapFromArraysFunction.java index 2be6661a07..9d68aea8bc 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapFromArraysFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapFromArraysFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestMapFromArraysFunction extends AbstractFunctionStringTestBase { +public class TestMapFromArraysFunction extends AbstractFunctionCollectionTestBase { @Test public void testMapFromArraysFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapFunction.java index fb98f80e60..29c375c5bb 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestMapFunction extends AbstractFunctionStringTestBase { +public class TestMapFunction extends AbstractFunctionCollectionTestBase { @Test public void testMapFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapKeysFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapKeysFunction.java index 8440b0fa0b..6c547018af 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapKeysFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapKeysFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestMapKeysFunction extends AbstractFunctionStringTestBase { +public class TestMapKeysFunction extends AbstractFunctionCollectionTestBase { @Test public void testMapKeysFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapUnionFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapUnionFunction.java index f6901ebfb5..e5198531ea 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapUnionFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapUnionFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestMapUnionFunction extends AbstractFunctionStringTestBase { +public class TestMapUnionFunction extends AbstractFunctionCollectionTestBase { @Test public void testMapUnionFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapValuesFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapValuesFunction.java index 1de29801af..5968399084 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapValuesFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/collection/TestMapValuesFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestMapValuesFunction extends AbstractFunctionStringTestBase { +public class TestMapValuesFunction extends AbstractFunctionCollectionTestBase { @Test public void testMapValuesFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/AbstractFunctionCompressionTestBase.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/AbstractFunctionCompressionTestBase.java new file mode 100644 index 0000000000..9b39231b53 --- /dev/null +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/AbstractFunctionCompressionTestBase.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.sdk.transform.process.function.compression; + +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 java.util.ArrayList; +import java.util.List; + +/** + * AbstractFunctionStringTestBase + * description: define static parameters for StringFunction tests + */ +public abstract class AbstractFunctionCompressionTestBase { + + protected static final List srcFields = new ArrayList<>(); + protected static final List dstFields = new ArrayList<>(); + protected static final CsvSourceInfo csvSource; + protected static final KvSinkInfo kvSink; + + static { + for (int i = 1; i < 4; i++) { + FieldInfo field = new FieldInfo(); + field.setName("string" + i); + srcFields.add(field); + } + for (int i = 1; i < 4; i++) { + FieldInfo field = new FieldInfo(); + field.setName("numeric" + i); + srcFields.add(field); + } + FieldInfo field = new FieldInfo(); + field.setName("result"); + dstFields.add(field); + csvSource = new CsvSourceInfo("UTF-8", '|', '\\', srcFields); + kvSink = new KvSinkInfo("UTF-8", dstFields); + } +} \ No newline at end of file diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/TestCompressFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/TestCompressFunction.java index cf4f907b83..a14011df7c 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/TestCompressFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/TestCompressFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestCompressFunction extends AbstractFunctionStringTestBase { +public class TestCompressFunction extends AbstractFunctionCompressionTestBase { @Test public void testCompressFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/TestUnCompressFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/TestUnCompressFunction.java index 061e411eb3..1226593487 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/TestUnCompressFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/compression/TestUnCompressFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestUnCompressFunction extends AbstractFunctionStringTestBase { +public class TestUnCompressFunction extends AbstractFunctionCompressionTestBase { @Test public void testUnCompressFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/AbstractFunctionFlowControlTestBase.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/AbstractFunctionConditionTestBase.java similarity index 96% rename from inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/AbstractFunctionFlowControlTestBase.java rename to inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/AbstractFunctionConditionTestBase.java index b24b3c9b22..c9b297a0fc 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/AbstractFunctionFlowControlTestBase.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/AbstractFunctionConditionTestBase.java @@ -24,7 +24,7 @@ import java.util.ArrayList; import java.util.List; -public abstract class AbstractFunctionFlowControlTestBase { +public abstract class AbstractFunctionConditionTestBase { protected static final List srcFields = new ArrayList<>(); protected static final List dstFields = new ArrayList<>(); diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIfFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIfFunction.java index 327542f864..ded03538a9 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIfFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIfFunction.java @@ -34,7 +34,7 @@ import java.util.ArrayList; import java.util.List; -public class TestIfFunction extends AbstractFunctionFlowControlTestBase { +public class TestIfFunction extends AbstractFunctionConditionTestBase { private static final List srcFields = new ArrayList<>(); private static final List dstFields = new ArrayList<>(); diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIfNullFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIfNullFunction.java index bc18cd5ba9..2afed87d43 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIfNullFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIfNullFunction.java @@ -28,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestIfNullFunction extends AbstractFunctionFlowControlTestBase { +public class TestIfNullFunction extends AbstractFunctionConditionTestBase { @Test public void testIfNullFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIsNullFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIsNullFunction.java index 4ede71057d..f4ece1f0bf 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIsNullFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestIsNullFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.arithmetic.AbstractFunctionArithmeticTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestIsNullFunction extends AbstractFunctionArithmeticTestBase { +public class TestIsNullFunction extends AbstractFunctionConditionTestBase { @Test public void testIsNullFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestNullIfFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestNullIfFunction.java index d408077bcb..ccef398851 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestNullIfFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/condition/TestNullIfFunction.java @@ -28,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestNullIfFunction extends AbstractFunctionFlowControlTestBase { +public class TestNullIfFunction extends AbstractFunctionConditionTestBase { @Test public void testNullIfFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/AbstractFunctionEncryptionTestBase.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/AbstractFunctionEncryptionTestBase.java new file mode 100644 index 0000000000..11106d4f97 --- /dev/null +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/AbstractFunctionEncryptionTestBase.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.sdk.transform.process.function.encryption; + +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 java.util.ArrayList; +import java.util.List; + +/** + * AbstractFunctionStringTestBase + * description: define static parameters for StringFunction tests + */ +public abstract class AbstractFunctionEncryptionTestBase { + + protected static final List srcFields = new ArrayList<>(); + protected static final List dstFields = new ArrayList<>(); + protected static final CsvSourceInfo csvSource; + protected static final KvSinkInfo kvSink; + + static { + for (int i = 1; i < 4; i++) { + FieldInfo field = new FieldInfo(); + field.setName("string" + i); + srcFields.add(field); + } + for (int i = 1; i < 4; i++) { + FieldInfo field = new FieldInfo(); + field.setName("numeric" + i); + srcFields.add(field); + } + FieldInfo field = new FieldInfo(); + field.setName("result"); + dstFields.add(field); + csvSource = new CsvSourceInfo("UTF-8", '|', '\\', srcFields); + kvSink = new KvSinkInfo("UTF-8", dstFields); + } +} \ No newline at end of file diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestDecodeFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestDecodeFunction.java index b2eaf78081..34a63632da 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestDecodeFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestDecodeFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestDecodeFunction extends AbstractFunctionStringTestBase { +public class TestDecodeFunction extends AbstractFunctionEncryptionTestBase { @Test public void testDecodeFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestEncodeFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestEncodeFunction.java index 493e987d4d..00659f8fdf 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestEncodeFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestEncodeFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestEncodeFunction extends AbstractFunctionStringTestBase { +public class TestEncodeFunction extends AbstractFunctionEncryptionTestBase { @Test public void testEncodeFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestFromBase64Function.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestFromBase64Function.java index bc0d9b18f3..d348e74693 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestFromBase64Function.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestFromBase64Function.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestFromBase64Function extends AbstractFunctionStringTestBase { +public class TestFromBase64Function extends AbstractFunctionEncryptionTestBase { @Test public void testFromBase64Function() throws Exception { 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 66aaad7bac..f066fe5fc9 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 @@ -21,14 +21,13 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.arithmetic.AbstractFunctionArithmeticTestBase; import org.junit.Assert; import org.junit.Test; import java.util.List; -public class TestMd5Function extends AbstractFunctionArithmeticTestBase { +public class TestMd5Function extends AbstractFunctionEncryptionTestBase { @Test public void testMd5Function() throws Exception { 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 bda61b738a..5e06948a68 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 @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.arithmetic.AbstractFunctionArithmeticTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestSha2Function extends AbstractFunctionArithmeticTestBase { +public class TestSha2Function extends AbstractFunctionEncryptionTestBase { @Test public void testSha2Function() throws Exception { 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 3ef5bfa684..b433c18c42 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 @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.arithmetic.AbstractFunctionArithmeticTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestShaFunction extends AbstractFunctionArithmeticTestBase { +public class TestShaFunction extends AbstractFunctionEncryptionTestBase { @Test public void testShaFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestToBase64Function.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestToBase64Function.java index b8a4b4fd95..74f079a0c0 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestToBase64Function.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/encryption/TestToBase64Function.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestToBase64Function extends AbstractFunctionStringTestBase { +public class TestToBase64Function extends AbstractFunctionEncryptionTestBase { @Test public void testToBase64Function() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/AbstractFunctionJsonTestBase.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/AbstractFunctionJsonTestBase.java new file mode 100644 index 0000000000..8d801dcb7e --- /dev/null +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/AbstractFunctionJsonTestBase.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.sdk.transform.process.function.json; + +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 java.util.ArrayList; +import java.util.List; +/** + * AbstractFunctionStringTestBase + * description: define static parameters for StringFunction tests + */ +public abstract class AbstractFunctionJsonTestBase { + + protected static final List srcFields = new ArrayList<>(); + protected static final List dstFields = new ArrayList<>(); + protected static final CsvSourceInfo csvSource; + protected static final KvSinkInfo kvSink; + + static { + for (int i = 1; i < 4; i++) { + FieldInfo field = new FieldInfo(); + field.setName("string" + i); + srcFields.add(field); + } + for (int i = 1; i < 4; i++) { + FieldInfo field = new FieldInfo(); + field.setName("numeric" + i); + srcFields.add(field); + } + FieldInfo field = new FieldInfo(); + field.setName("result"); + dstFields.add(field); + csvSource = new CsvSourceInfo("UTF-8", '|', '\\', srcFields); + kvSink = new KvSinkInfo("UTF-8", dstFields); + } +} \ No newline at end of file diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonArrayAppendFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonArrayAppendFunction.java index 98dae8936c..fc5c43e423 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonArrayAppendFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonArrayAppendFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestJsonArrayAppendFunction extends AbstractFunctionStringTestBase { +public class TestJsonArrayAppendFunction extends AbstractFunctionJsonTestBase { @Test public void testJsonArrayAppendFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonArraysFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonArraysFunction.java index b016d40776..1331999efe 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonArraysFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonArraysFunction.java @@ -24,7 +24,6 @@ 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.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -33,7 +32,7 @@ import java.util.HashMap; import java.util.List; -public class TestJsonArraysFunction extends AbstractFunctionStringTestBase { +public class TestJsonArraysFunction extends AbstractFunctionJsonTestBase { private static final List srcFields = new ArrayList<>(); private static final List dstFields = new ArrayList<>(); diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonExistsFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonExistsFunction.java index e6864f4600..857a650961 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonExistsFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonExistsFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestJsonExistsFunction extends AbstractFunctionStringTestBase { +public class TestJsonExistsFunction extends AbstractFunctionJsonTestBase { @Test public void testJsonExistsFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonQueryFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonQueryFunction.java index 3e1695ce8c..3b6ceb5fc2 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonQueryFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonQueryFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestJsonQueryFunction extends AbstractFunctionStringTestBase { +public class TestJsonQueryFunction extends AbstractFunctionJsonTestBase { @Test public void testJsonQueryFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonQuoteFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonQuoteFunction.java index 2aa4390f07..2391cb4be5 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonQuoteFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonQuoteFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestJsonQuoteFunction extends AbstractFunctionStringTestBase { +public class TestJsonQuoteFunction extends AbstractFunctionJsonTestBase { @Test public void testJsonQuoteFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonUnQuoteFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonUnQuoteFunction.java index 631bacb788..6b8db8784a 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonUnQuoteFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonUnQuoteFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestJsonUnQuoteFunction extends AbstractFunctionStringTestBase { +public class TestJsonUnQuoteFunction extends AbstractFunctionJsonTestBase { @Test public void testJsonUnQuoteFunction() throws Exception { diff --git a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonValueFunction.java b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonValueFunction.java index 8608f776a0..89642c7cbb 100644 --- a/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonValueFunction.java +++ b/inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/function/json/TestJsonValueFunction.java @@ -21,7 +21,6 @@ import org.apache.inlong.sdk.transform.encode.SinkEncoderFactory; import org.apache.inlong.sdk.transform.pojo.TransformConfig; import org.apache.inlong.sdk.transform.process.TransformProcessor; -import org.apache.inlong.sdk.transform.process.function.string.AbstractFunctionStringTestBase; import org.junit.Assert; import org.junit.Test; @@ -29,7 +28,7 @@ import java.util.HashMap; import java.util.List; -public class TestJsonValueFunction extends AbstractFunctionStringTestBase { +public class TestJsonValueFunction extends AbstractFunctionJsonTestBase { @Test public void testJsonValueFunction() throws Exception {