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/09/23 10:13:35 UTC
[incubator-linkis] branch dev-1.3.1 updated: feat: linkis-storage-script-dev-client unit test (#3487)
This is an automated email from the ASF dual-hosted git repository.
peacewong 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 80ad77ea4 feat: linkis-storage-script-dev-client unit test (#3487)
80ad77ea4 is described below
commit 80ad77ea49f1a848c38a57e07cee7eb37ed6856d
Author: ruY <43...@users.noreply.github.com>
AuthorDate: Fri Sep 23 18:13:30 2022 +0800
feat: linkis-storage-script-dev-client unit test (#3487)
---
.../filesystem/WorkspaceClientFactoryTest.scala | 36 +++++++++++++++++
.../filesystem/WorkspaceClientImplTest.scala | 36 +++++++++++++++++
.../action/OpenScriptFromBMLActionTest.scala | 35 +++++++++++++++++
.../filesystem/conf/WorkspaceClientConfTest.scala | 45 ++++++++++++++++++++++
.../response/ScriptFromBMLResponseTest.scala | 38 ++++++++++++++++++
5 files changed, 190 insertions(+)
diff --git a/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/WorkspaceClientFactoryTest.scala b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/WorkspaceClientFactoryTest.scala
new file mode 100644
index 000000000..c284a14c3
--- /dev/null
+++ b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/WorkspaceClientFactoryTest.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.filesystem
+
+import org.junit.jupiter.api.{Assertions, DisplayName, Test}
+
+class WorkspaceClientFactoryTest {
+
+ @Test
+ @DisplayName("getClientTest")
+ def getClientTest(): Unit = {
+
+ val user = "hadoop"
+ val token = "abc"
+ val gatewayAddress = "127.0.0.1:9001"
+
+ val client = WorkspaceClientFactory.getClient(user, token, gatewayAddress)
+ Assertions.assertNotNull(client)
+ }
+
+}
diff --git a/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/WorkspaceClientImplTest.scala b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/WorkspaceClientImplTest.scala
new file mode 100644
index 000000000..83408ed7e
--- /dev/null
+++ b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/WorkspaceClientImplTest.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.filesystem
+
+import org.junit.jupiter.api.{Assertions, DisplayName, Test}
+
+class WorkspaceClientImplTest {
+
+ @Test
+ @DisplayName("createObject")
+ def createObject(): Unit = {
+
+ val user = "hadoop"
+ val token = "abc"
+ val gatewayAddress = "127.0.0.1:9001"
+
+ val client = new WorkspaceClientImpl(user, token, gatewayAddress)
+ Assertions.assertNotNull(client)
+ }
+
+}
diff --git a/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/action/OpenScriptFromBMLActionTest.scala b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/action/OpenScriptFromBMLActionTest.scala
new file mode 100644
index 000000000..5b5d6cc32
--- /dev/null
+++ b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/action/OpenScriptFromBMLActionTest.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.filesystem.action
+
+import org.junit.jupiter.api.{Assertions, DisplayName, Test}
+
+class OpenScriptFromBMLActionTest {
+
+ @Test
+ @DisplayName("commonConstTest")
+ def commonConstTest(): Unit = {
+ val user = "hadoop"
+ val action = new OpenScriptFromBMLAction
+ action.setUser(user)
+
+ Assertions.assertEquals(user, action.getUser)
+ Assertions.assertNotNull(action.getURL)
+ }
+
+}
diff --git a/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/conf/WorkspaceClientConfTest.scala b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/conf/WorkspaceClientConfTest.scala
new file mode 100644
index 000000000..312c1f27d
--- /dev/null
+++ b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/conf/WorkspaceClientConfTest.scala
@@ -0,0 +1,45 @@
+/*
+ * 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.filesystem.conf
+
+import org.junit.jupiter.api.{Assertions, DisplayName, Test}
+
+class WorkspaceClientConfTest {
+
+ @Test
+ @DisplayName("commonConstTest")
+ def commonConstTest(): Unit = {
+
+ val gateway = WorkspaceClientConf.gateway
+ val prefix = WorkspaceClientConf.prefix
+ val scriptFromBML = WorkspaceClientConf.scriptFromBML
+ val dwsVersion = WorkspaceClientConf.dwsVersion
+ val tokenKey = WorkspaceClientConf.tokenKey
+ val tokenValue = WorkspaceClientConf.tokenValue
+ val scriptFromBMLUrl = WorkspaceClientConf.scriptFromBMLUrl
+
+ Assertions.assertEquals("", gateway)
+ Assertions.assertNotNull(prefix)
+ Assertions.assertNotNull(scriptFromBML)
+ Assertions.assertEquals("v1", dwsVersion)
+ Assertions.assertNotNull(tokenKey)
+ Assertions.assertNotNull(tokenValue)
+ Assertions.assertNotNull(scriptFromBMLUrl)
+ }
+
+}
diff --git a/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/response/ScriptFromBMLResponseTest.scala b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/response/ScriptFromBMLResponseTest.scala
new file mode 100644
index 000000000..c4e9e386c
--- /dev/null
+++ b/linkis-public-enhancements/linkis-script-dev/linkis-storage-script-dev-client/src/test/scala/org/apache/linkis/filesystem/response/ScriptFromBMLResponseTest.scala
@@ -0,0 +1,38 @@
+/*
+ * 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.filesystem.response
+
+import org.junit.jupiter.api.{Assertions, DisplayName, Test}
+
+class ScriptFromBMLResponseTest {
+
+ @Test
+ @DisplayName("commonConst")
+ def commonConst(): Unit = {
+ val scriptContent = "show databases;"
+ val response = new ScriptFromBMLResponse(
+ scriptContent,
+ new java.util.HashMap[String, java.util.Map[String, Object]]
+ )
+
+ Assertions.assertEquals(scriptContent, response.scriptContent)
+ Assertions.assertTrue(response.metadata.size() == 0)
+
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org