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 4e42c1da8 feat: linkis-mybatis unit test add
     new aa87a878c Merge pull request #3788 from 
ruY9527/dev-1.3.1-linkis-mybatis-unit-test
4e42c1da8 is described below

commit 4e42c1da8839b6675982fe1c472e6cf4d4ccf64c
Author: ruY9527 <[email protected]>
AuthorDate: Sat Nov 5 11:03:13 2022 +0800

    feat: linkis-mybatis unit test add
---
 .../apache/linkis/mybatis/DataSourceUtilsTest.java | 34 ++++++++++
 .../mybatis/conf/MybatisConfigurationTest.java     | 74 ++++++++++++++++++++++
 2 files changed, 108 insertions(+)

diff --git 
a/linkis-commons/linkis-mybatis/src/test/java/org/apache/linkis/mybatis/DataSourceUtilsTest.java
 
b/linkis-commons/linkis-mybatis/src/test/java/org/apache/linkis/mybatis/DataSourceUtilsTest.java
new file mode 100644
index 000000000..d162cf457
--- /dev/null
+++ 
b/linkis-commons/linkis-mybatis/src/test/java/org/apache/linkis/mybatis/DataSourceUtilsTest.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.mybatis;
+
+import javax.sql.DataSource;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class DataSourceUtilsTest {
+
+  @Test
+  @DisplayName("buildDataSourceTest")
+  public void buildDataSourceTest() {
+    DataSource dataSource = DataSourceUtils.buildDataSource("127.0.0.1", 
"hadoop", "hadoop");
+    Assertions.assertNotNull(dataSource);
+  }
+}
diff --git 
a/linkis-commons/linkis-mybatis/src/test/java/org/apache/linkis/mybatis/conf/MybatisConfigurationTest.java
 
b/linkis-commons/linkis-mybatis/src/test/java/org/apache/linkis/mybatis/conf/MybatisConfigurationTest.java
new file mode 100644
index 000000000..4aeddcdcc
--- /dev/null
+++ 
b/linkis-commons/linkis-mybatis/src/test/java/org/apache/linkis/mybatis/conf/MybatisConfigurationTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.mybatis.conf;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+public class MybatisConfigurationTest {
+
+  @Test
+  @DisplayName("constTest")
+  public void constTest() {
+
+    String bdpServerMybatisMapperLocations =
+        MybatisConfiguration.BDP_SERVER_MYBATIS_MAPPER_LOCATIONS.getValue();
+    String bdpServerMybatisTypealiasespackage =
+        MybatisConfiguration.BDP_SERVER_MYBATIS_TYPEALIASESPACKAGE.getValue();
+    String bdpServerMybatisConfiglocation =
+        MybatisConfiguration.BDP_SERVER_MYBATIS_CONFIGLOCATION.getValue();
+    String bdpServerMybatisBasepackage =
+        MybatisConfiguration.BDP_SERVER_MYBATIS_BASEPACKAGE.getValue();
+    String bdpServerMybatisDatasourceUrl =
+        MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_URL.getValue();
+    String bdpServerMybatisDatasourceUsername =
+        MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_USERNAME.getValue();
+    String bdpServerMybatisDatasourceDriverClassName =
+        
MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_DRIVER_CLASS_NAME.getValue();
+    Integer bdpServerMybatisDatasourceInitialsize =
+        
MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_INITIALSIZE.getValue();
+    Integer bdpServerMybatisDatasourceMinidle =
+        MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_MINIDLE.getValue();
+    Integer bdpServerMybatisDatasourceMaxactive =
+        
MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_MAXACTIVE.getValue();
+    Integer bdpServerMybatisDatasourceMaxwait =
+        MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_MAXWAIT.getValue();
+    Integer bdpServerMybatisDatasourceTberm =
+        MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_TBERM.getValue();
+    Integer bdpServerMybatisDatasourceMeitm =
+        MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_MEITM.getValue();
+    String bdpServerMybatisDatasourceValidationquery =
+        
MybatisConfiguration.BDP_SERVER_MYBATIS_DATASOURCE_VALIDATIONQUERY.getValue();
+
+    Assertions.assertEquals("", bdpServerMybatisMapperLocations);
+    Assertions.assertEquals("", bdpServerMybatisTypealiasespackage);
+    Assertions.assertEquals("classpath:/mybatis-config.xml", 
bdpServerMybatisConfiglocation);
+    Assertions.assertEquals("", bdpServerMybatisBasepackage);
+    Assertions.assertEquals("", bdpServerMybatisDatasourceUrl);
+    Assertions.assertEquals("", bdpServerMybatisDatasourceUsername);
+    Assertions.assertEquals("com.mysql.jdbc.Driver", 
bdpServerMybatisDatasourceDriverClassName);
+    Assertions.assertTrue(1 == 
bdpServerMybatisDatasourceInitialsize.intValue());
+    Assertions.assertTrue(1 == bdpServerMybatisDatasourceMinidle.intValue());
+    Assertions.assertTrue(20 == 
bdpServerMybatisDatasourceMaxactive.intValue());
+    Assertions.assertTrue(6000 == 
bdpServerMybatisDatasourceMaxwait.intValue());
+    Assertions.assertTrue(60000 == bdpServerMybatisDatasourceTberm.intValue());
+    Assertions.assertTrue(300000 == 
bdpServerMybatisDatasourceMeitm.intValue());
+    Assertions.assertEquals("SELECT 1", 
bdpServerMybatisDatasourceValidationquery);
+  }
+}


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

Reply via email to