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/10/11 07:05:47 UTC

[incubator-linkis] branch dev-1.3.1 updated: feat: add datasource-client unit test (#3556)

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 88ddb1998 feat: add datasource-client unit test (#3556)
88ddb1998 is described below

commit 88ddb1998c22c75861a132da86adcb3a39b3f063
Author: ruY <43...@users.noreply.github.com>
AuthorDate: Tue Oct 11 15:05:42 2022 +0800

    feat: add datasource-client unit test (#3556)
    
    * feat: add datasource-client unit test
---
 .../client/config/DatasourceClientConfigTest.java  | 49 ++++++++++++++++++++++
 .../DataSourceClientBuilderExceptionTest.java      | 34 +++++++++++++++
 .../imp/LinkisDataSourceRemoteClientTest.java      | 37 ++++++++++++++++
 3 files changed, 120 insertions(+)

diff --git a/linkis-public-enhancements/linkis-datasource/linkis-datasource-client/src/test/java/org/apache/linkis/datasource/client/config/DatasourceClientConfigTest.java b/linkis-public-enhancements/linkis-datasource/linkis-datasource-client/src/test/java/org/apache/linkis/datasource/client/config/DatasourceClientConfigTest.java
new file mode 100644
index 000000000..40db9eabf
--- /dev/null
+++ b/linkis-public-enhancements/linkis-datasource/linkis-datasource-client/src/test/java/org/apache/linkis/datasource/client/config/DatasourceClientConfigTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.datasource.client.config;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class DatasourceClientConfigTest {
+
+  @Test
+  @DisplayName("constTest")
+  public void constTest() {
+
+    String metaDataService = DatasourceClientConfig.METADATA_SERVICE_MODULE().getValue();
+    String dataSourceService = DatasourceClientConfig.DATA_SOURCE_SERVICE_MODULE().getValue();
+    String authTokenKey = DatasourceClientConfig.AUTH_TOKEN_KEY().getValue();
+    String authTokenValue = DatasourceClientConfig.AUTH_TOKEN_VALUE().getValue();
+    String dataSourceClientName =
+        DatasourceClientConfig.DATA_SOURCE_SERVICE_CLIENT_NAME().getValue();
+    Object connectionMaxSize = DatasourceClientConfig.CONNECTION_MAX_SIZE().getValue();
+    Object connectionTimeOut = DatasourceClientConfig.CONNECTION_TIMEOUT().getValue();
+    Object connectionReadTimeOut = DatasourceClientConfig.CONNECTION_READ_TIMEOUT().getValue();
+
+    Assertions.assertNotNull(metaDataService);
+    Assertions.assertNotNull(dataSourceService);
+    Assertions.assertNotNull(authTokenKey);
+    Assertions.assertNotNull(authTokenValue);
+    Assertions.assertNotNull(dataSourceClientName);
+    Assertions.assertNotNull(connectionMaxSize);
+    Assertions.assertNotNull(connectionTimeOut);
+    Assertions.assertNotNull(connectionReadTimeOut);
+  }
+}
diff --git a/linkis-public-enhancements/linkis-datasource/linkis-datasource-client/src/test/java/org/apache/linkis/datasource/client/exception/DataSourceClientBuilderExceptionTest.java b/linkis-public-enhancements/linkis-datasource/linkis-datasource-client/src/test/java/org/apache/linkis/datasource/client/exception/DataSourceClientBuilderExceptionTest.java
new file mode 100644
index 000000000..40c31beb4
--- /dev/null
+++ b/linkis-public-enhancements/linkis-datasource/linkis-datasource-client/src/test/java/org/apache/linkis/datasource/client/exception/DataSourceClientBuilderExceptionTest.java
@@ -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.datasource.client.exception;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class DataSourceClientBuilderExceptionTest {
+
+  @Test
+  @DisplayName("exceptionTest")
+  public void exceptionTest() {
+
+    String errorDesc = "this is error";
+    DataSourceClientBuilderException exception = new DataSourceClientBuilderException(errorDesc);
+    Assertions.assertEquals(errorDesc, exception.getDesc());
+  }
+}
diff --git a/linkis-public-enhancements/linkis-datasource/linkis-datasource-client/src/test/java/org/apache/linkis/datasource/client/imp/LinkisDataSourceRemoteClientTest.java b/linkis-public-enhancements/linkis-datasource/linkis-datasource-client/src/test/java/org/apache/linkis/datasource/client/imp/LinkisDataSourceRemoteClientTest.java
new file mode 100644
index 000000000..779c4b99d
--- /dev/null
+++ b/linkis-public-enhancements/linkis-datasource/linkis-datasource-client/src/test/java/org/apache/linkis/datasource/client/imp/LinkisDataSourceRemoteClientTest.java
@@ -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.datasource.client.imp;
+
+import org.apache.linkis.datasource.client.impl.LinkisDataSourceRemoteClient;
+import org.apache.linkis.httpclient.dws.config.DWSClientConfig;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class LinkisDataSourceRemoteClientTest {
+
+  @Test
+  @DisplayName("createClientConfigTest")
+  public void createClientConfigTest() {
+
+    LinkisDataSourceRemoteClient client = new LinkisDataSourceRemoteClient();
+    DWSClientConfig clientConfig = client.createClientConfig();
+    Assertions.assertNotNull(clientConfig);
+  }
+}


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