You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/08/07 08:49:10 UTC

[incubator-linkis] branch dev-1.2.0 updated: add test case for factory launch extension (#2617)

This is an automated email from the ASF dual-hosted git repository.

peacewong pushed a commit to branch dev-1.2.0
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.2.0 by this push:
     new b4ae904e7 add test case for factory launch extension (#2617)
b4ae904e7 is described below

commit b4ae904e7dbb81dc627097afaf6b4cc55c055d47
Author: QuintinTao <72...@users.noreply.github.com>
AuthorDate: Sun Aug 7 16:49:05 2022 +0800

    add test case for factory launch extension (#2617)
    
    * add test case for factory launch extension
    
    * add test case for factory launch extension
---
 linkis-engineconn-plugins/spark/pom.xml            | 38 ++++++++++++++++++++--
 .../spark/extension/TestExecutionHooks.scala       | 35 ++++++++++++++++++++
 .../spark/factory/TestSparkEngineConnFactory.scala | 37 +++++++++++++++++++++
 ...SparkSubmitProcessEngineConnLaunchBuilder.scala | 34 +++++++++++++++++++
 4 files changed, 142 insertions(+), 2 deletions(-)

diff --git a/linkis-engineconn-plugins/spark/pom.xml b/linkis-engineconn-plugins/spark/pom.xml
index 7a2589abf..f64d3d2f0 100644
--- a/linkis-engineconn-plugins/spark/pom.xml
+++ b/linkis-engineconn-plugins/spark/pom.xml
@@ -295,6 +295,15 @@
                     <artifactId>protobuf-java</artifactId>
                     <groupId>com.google.protobuf</groupId>
                 </exclusion>
+                <exclusion>
+                    <artifactId>commons-compiler</artifactId>
+                    <groupId>org.codehaus.janino</groupId>
+                </exclusion>
+
+                <exclusion>
+                    <artifactId>janino</artifactId>
+                    <groupId>org.codehaus.janino</groupId>
+                </exclusion>
             </exclusions>
         </dependency>
 
@@ -332,9 +341,21 @@
                     <groupId>com.sun.jersey</groupId>
                     <artifactId>jersey-client</artifactId>
                 </exclusion>
+                <exclusion>
+                    <artifactId>commons-compiler</artifactId>
+                    <groupId>org.codehaus.janino</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>janino</artifactId>
+                    <groupId>org.codehaus.janino</groupId>
+                </exclusion>
             </exclusions>
         </dependency>
-
+        <dependency>
+            <artifactId>hadoop-auth</artifactId>
+            <groupId>org.apache.hadoop</groupId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.apache.spark</groupId>
             <artifactId>spark-hive_${scala.binary.version}</artifactId>
@@ -349,9 +370,22 @@
                     <groupId>log4j</groupId>
                     <artifactId>apache-log4j-extras</artifactId>
                 </exclusion>
+                <exclusion>
+                    <artifactId>commons-compiler</artifactId>
+                    <groupId>org.codehaus.janino</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>janino</artifactId>
+                    <groupId>org.codehaus.janino</groupId>
+                </exclusion>
             </exclusions>
         </dependency>
-
+        <dependency>
+            <artifactId>janino</artifactId>
+            <groupId>org.codehaus.janino</groupId>
+            <version>3.0.9</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/linkis-engineconn-plugins/spark/src/test/scala/org/apache/linkis/engineplugin/spark/extension/TestExecutionHooks.scala b/linkis-engineconn-plugins/spark/src/test/scala/org/apache/linkis/engineplugin/spark/extension/TestExecutionHooks.scala
new file mode 100644
index 000000000..71518d516
--- /dev/null
+++ b/linkis-engineconn-plugins/spark/src/test/scala/org/apache/linkis/engineplugin/spark/extension/TestExecutionHooks.scala
@@ -0,0 +1,35 @@
+/*
+ * 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.extension
+
+import org.apache.linkis.engineplugin.spark.cs.{CSSparkPostExecutionHook, CSSparkPreExecutionHook}
+import org.junit.jupiter.api.{Assertions, Test}
+
+class TestExecutionHooks {
+  @Test
+  def testPreHooks: Unit = {
+    val hookPre = new  CSSparkPreExecutionHook
+    SparkPreExecutionHook.register(hookPre)
+    Assertions.assertNotNull(SparkPreExecutionHook.getSparkPreExecutionHooks())
+  }
+  @Test
+  def testPostHooks: Unit = {
+    val hookPre = new  CSSparkPostExecutionHook
+    SparkPostExecutionHook.register(hookPre)
+    Assertions.assertNotNull(SparkPostExecutionHook.getSparkPostExecutionHooks())
+  }
+}
diff --git a/linkis-engineconn-plugins/spark/src/test/scala/org/apache/linkis/engineplugin/spark/factory/TestSparkEngineConnFactory.scala b/linkis-engineconn-plugins/spark/src/test/scala/org/apache/linkis/engineplugin/spark/factory/TestSparkEngineConnFactory.scala
new file mode 100644
index 000000000..6748f7a5f
--- /dev/null
+++ b/linkis-engineconn-plugins/spark/src/test/scala/org/apache/linkis/engineplugin/spark/factory/TestSparkEngineConnFactory.scala
@@ -0,0 +1,37 @@
+/*
+ * 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.factory
+
+import org.apache.spark.SparkConf
+import org.junit.jupiter.api.{Assertions, BeforeEach, Test}
+
+class TestSparkEngineConnFactory {
+  private var engineFactory: SparkEngineConnFactory = _
+  @BeforeEach
+  def before(): Unit = {
+    engineFactory = new SparkEngineConnFactory
+  }
+  @Test
+  def testCreateContext: Unit = {
+    val sparkConf: SparkConf = new SparkConf(true)
+    sparkConf.setAppName("test").setMaster("local[1]")
+    val outputDir = engineFactory.createOutputDir(sparkConf)
+    Assertions.assertNotNull(outputDir)
+    val sparkSession = engineFactory.createSparkSession(outputDir, sparkConf)
+    Assertions.assertNotNull(sparkSession)
+  }
+}
diff --git a/linkis-engineconn-plugins/spark/src/test/scala/org/apache/linkis/engineplugin/spark/launch/TestSparkSubmitProcessEngineConnLaunchBuilder.scala b/linkis-engineconn-plugins/spark/src/test/scala/org/apache/linkis/engineplugin/spark/launch/TestSparkSubmitProcessEngineConnLaunchBuilder.scala
new file mode 100644
index 000000000..2e784d3a5
--- /dev/null
+++ b/linkis-engineconn-plugins/spark/src/test/scala/org/apache/linkis/engineplugin/spark/launch/TestSparkSubmitProcessEngineConnLaunchBuilder.scala
@@ -0,0 +1,34 @@
+/*
+ * 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.launch
+
+import org.apache.linkis.engineplugin.spark.launch.SparkSubmitProcessEngineConnLaunchBuilder.RelativePath
+import org.junit.jupiter.api.{Assertions, Test}
+
+
+class TestSparkSubmitProcessEngineConnLaunchBuilder {
+  @Test
+  def testCreateContext: Unit = {
+    val ddd = SparkSubmitProcessEngineConnLaunchBuilder.newBuilder()
+          .master("local[1]")
+          .deployMode("client")
+          .className("org.apache.linkis.engineplugin.spark.launch")
+      .driverClassPath("")
+      .archive(RelativePath(""))
+    Assertions.assertNotNull(ddd)
+  }
+}


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