You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@linkis.apache.org by "ChengJie1053 (via GitHub)" <gi...@apache.org> on 2023/05/17 06:23:58 UTC

[GitHub] [linkis] ChengJie1053 commented on a diff in pull request #4534: spark etl support redis and jedis2.9.2 upgrade 3.9.0

ChengJie1053 commented on code in PR #4534:
URL: https://github.com/apache/linkis/pull/4534#discussion_r1195998517


##########
linkis-engineconn-plugins/spark/src/test/scala/org/apache/linkis/engineplugin/spark/datacalc/TestRedisCalc.scala:
##########
@@ -0,0 +1,193 @@
+/*
+ * 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.linkis.engineplugin.spark.datacalc
+
+import org.apache.linkis.engineplugin.spark.datacalc.model.DataCalcGroupData
+
+import org.junit.jupiter.api.{Assertions, Test};
+
+class TestRedisCalc {
+
+  @Test
+  def testRedisWrite: Unit = {
+    val data = DataCalcGroupData.getData(redisWriteConfigJson)
+
+    Assertions.assertTrue(data != null)
+
+    val (sources, transforms, sinks) = DataCalcExecution.getPlugins(data)
+    Assertions.assertTrue(sources != null)
+    Assertions.assertTrue(transforms != null)
+    Assertions.assertTrue(sinks != null)
+
+  }
+
+  @Test
+  def testRedisReaderTable: Unit = {
+    val data = DataCalcGroupData.getData(redisTableConfigJson)
+
+    Assertions.assertTrue(data != null)
+
+    val (sources, transforms, sinks) = DataCalcExecution.getPlugins(data)
+    Assertions.assertTrue(sources != null)
+    Assertions.assertTrue(transforms != null)
+    Assertions.assertTrue(sinks != null)
+
+  }
+
+  @Test
+  def testRedisReaderKeysPattern: Unit = {
+    val data = DataCalcGroupData.getData(redisKeysPatternConfigJson)
+
+    Assertions.assertTrue(data != null)
+
+    val (sources, transforms, sinks) = DataCalcExecution.getPlugins(data)
+    Assertions.assertTrue(sources != null)
+    Assertions.assertTrue(transforms != null)
+    Assertions.assertTrue(sinks != null)
+
+  }
+
+  val redisWriteConfigJson =
+    """
+      |{
+      |    "sources": [
+      |        {
+      |            "name": "file",
+      |            "type": "source",
+      |            "config": {
+      |                "resultTable": "T1654611700631",
+      |                "path": "file:///Users/chengjie/cjtest/newfile.csv",

Review Comment:
   Ok, thanks for reviewing the code



-- 
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: notifications-unsubscribe@linkis.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@linkis.apache.org
For additional commands, e-mail: notifications-help@linkis.apache.org