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

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


The following commit(s) were added to refs/heads/dev-1.3.1 by this push:
     new 2fcf71e02 [presto]unit test (#3767)
2fcf71e02 is described below

commit 2fcf71e020731f501caa8fa6fc92e18cb0414082
Author: 成彬彬 <[email protected]>
AuthorDate: Tue Nov 22 10:03:34 2022 +0800

    [presto]unit test (#3767)
---
 .../presto/TestPrestoEngineConnPlugin.scala        | 30 ++++++++++++++++
 .../TestPrestoProcessEngineConnLaunchBuilder.scala | 34 ++++++++++++++++++
 .../presto/conf/TestPrestoConfiguration.scala      | 42 ++++++++++++++++++++++
 .../presto/exception/TestPrestoException.scala     | 36 +++++++++++++++++++
 .../factory/TestPrestoEngineConnFactory.scala      | 42 ++++++++++++++++++++++
 .../presto/utils/testPrestoSQLHook.scala           | 32 +++++++++++++++++
 6 files changed, 216 insertions(+)

diff --git 
a/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/TestPrestoEngineConnPlugin.scala
 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/TestPrestoEngineConnPlugin.scala
new file mode 100644
index 000000000..663f91126
--- /dev/null
+++ 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/TestPrestoEngineConnPlugin.scala
@@ -0,0 +1,30 @@
+/*
+ * 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.presto
+
+import org.junit.jupiter.api.{Assertions, Test}
+
+class TestPrestoEngineConnPlugin {
+
+  @Test
+  def testGetEngineResourceFactory: Unit = {
+    val prestoEngineConnPlugin = new PrestoEngineConnPlugin
+    Assertions.assertNotNull(prestoEngineConnPlugin.getEngineConnFactory)
+  }
+
+}
diff --git 
a/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/builder/TestPrestoProcessEngineConnLaunchBuilder.scala
 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/builder/TestPrestoProcessEngineConnLaunchBuilder.scala
new file mode 100644
index 000000000..c7aad5f6d
--- /dev/null
+++ 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/builder/TestPrestoProcessEngineConnLaunchBuilder.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.presto.builder
+
+import org.apache.linkis.manager.label.entity.engine.UserCreatorLabel
+
+import org.junit.jupiter.api.{Assertions, Test}
+
+class TestPrestoProcessEngineConnLaunchBuilder {
+
+  @Test
+  def testGetEngineStartUser {
+    val engineConnLaunchBuilder = new PrestoProcessEngineConnLaunchBuilder
+    val userCreatorLabel = new UserCreatorLabel
+    val value = engineConnLaunchBuilder.getEngineStartUser(userCreatorLabel)
+    Assertions.assertEquals(value, "hadoop")
+  }
+
+}
diff --git 
a/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/conf/TestPrestoConfiguration.scala
 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/conf/TestPrestoConfiguration.scala
new file mode 100644
index 000000000..9a07311f2
--- /dev/null
+++ 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/conf/TestPrestoConfiguration.scala
@@ -0,0 +1,42 @@
+/*
+ * 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.presto.conf
+
+import org.apache.linkis.common.conf.TimeType
+
+import org.junit.jupiter.api.{Assertions, Test}
+
+class TestPrestoConfiguration {
+
+  @Test
+  def testConfig: Unit = {
+    Assertions.assertEquals(100, 
PrestoConfiguration.ENGINE_CONCURRENT_LIMIT.getValue)
+    Assertions.assertEquals(60, 
PrestoConfiguration.PRESTO_HTTP_CONNECT_TIME_OUT.getValue)
+    Assertions.assertEquals(60, 
PrestoConfiguration.PRESTO_HTTP_READ_TIME_OUT.getValue)
+    Assertions.assertEquals(5000, 
PrestoConfiguration.ENGINE_DEFAULT_LIMIT.getValue)
+    Assertions.assertEquals("http://127.0.0.1:8080";, 
PrestoConfiguration.PRESTO_URL.getValue)
+    Assertions.assertEquals("", 
PrestoConfiguration.PRESTO_RESOURCE_CONFIG_PATH.getValue)
+    Assertions.assertEquals("default", 
PrestoConfiguration.PRESTO_USER_NAME.getValue)
+    Assertions.assertEquals("", PrestoConfiguration.PRESTO_PASSWORD.getValue)
+    Assertions.assertEquals("system", 
PrestoConfiguration.PRESTO_CATALOG.getValue)
+    Assertions.assertEquals("", PrestoConfiguration.PRESTO_SCHEMA.getValue)
+    Assertions.assertEquals("global", 
PrestoConfiguration.PRESTO_SOURCE.getValue)
+    Assertions.assertEquals("8GB", 
PrestoConfiguration.PRESTO_REQUEST_MEMORY.getValue)
+  }
+
+}
diff --git 
a/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/exception/TestPrestoException.scala
 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/exception/TestPrestoException.scala
new file mode 100644
index 000000000..a7ea5ea7c
--- /dev/null
+++ 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/exception/TestPrestoException.scala
@@ -0,0 +1,36 @@
+/*
+ * 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.presto.exception
+
+import org.junit.jupiter.api.{Assertions, Test}
+
+class TestPrestoException {
+
+  @Test
+  def testPrestoStateInvalidException: Unit = {
+    val exception = PrestoStateInvalidException
+    Assertions.assertNotNull(exception)
+  }
+
+  @Test
+  def testPythonSessionStartFailedException: Unit = {
+    val exception = PrestoClientException
+    Assertions.assertNotNull(exception)
+  }
+
+}
diff --git 
a/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/factory/TestPrestoEngineConnFactory.scala
 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/factory/TestPrestoEngineConnFactory.scala
new file mode 100644
index 000000000..bd9963b31
--- /dev/null
+++ 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/factory/TestPrestoEngineConnFactory.scala
@@ -0,0 +1,42 @@
+/*
+ * 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.presto.factory
+
+import org.apache.linkis.engineconn.common.creation.{
+  DefaultEngineCreationContext,
+  EngineCreationContext
+}
+
+import org.junit.jupiter.api.{Assertions, Test}
+
+class TestPrestoEngineConnFactory {
+
+  @Test
+  def testNewExecutor {
+    System.setProperty("prestoVersion", "presto")
+    val engineConnFactory: PrestoEngineConnFactory = new 
PrestoEngineConnFactory
+    val engineCreationContext: EngineCreationContext = new 
DefaultEngineCreationContext
+    val jMap = new java.util.HashMap[String, String]()
+    jMap.put("presto.version", "presto")
+    engineCreationContext.setOptions(jMap)
+    val engineConn = engineConnFactory.createEngineConn(engineCreationContext)
+    val executor = engineConnFactory.newExecutor(1, engineCreationContext, 
engineConn)
+    Assertions.assertNotNull(executor)
+  }
+
+}
diff --git 
a/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/utils/testPrestoSQLHook.scala
 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/utils/testPrestoSQLHook.scala
new file mode 100644
index 000000000..99681c69c
--- /dev/null
+++ 
b/linkis-engineconn-plugins/presto/src/test/scala/org/apache/linkis/engineplugin/presto/utils/testPrestoSQLHook.scala
@@ -0,0 +1,32 @@
+/*
+ * 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.presto.utils
+
+import org.junit.jupiter.api.{Assertions, Test}
+
+class testPrestoSQLHook {
+
+  @Test
+  def testPreExecuteHook {
+    val prestoSQLHook = PrestoSQLHook
+    val code = "`1104`"
+    val codes = prestoSQLHook.preExecuteHook(code)
+    Assertions.assertEquals(codes, "\"1104\"")
+  }
+
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to