Browse Source

[Refactor] Rename class file, unified word spelling. (#7261)

3.0.0/version-upgrade
Zonglei Dong 3 years ago committed by GitHub
parent
commit
7e0010de35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java
  2. 18
      dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataSourceServiceTest.java
  3. 8
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/MonitorDBDao.java
  4. 6
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/MySQLPerformance.java
  5. 4
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/PostgreSQLPerformance.java
  6. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClient.java
  7. 2
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java
  8. 50
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTO.java
  9. 2
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHDFSConnectionParam.java
  10. 2
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHDFSDataSourceParamDTO.java
  11. 2
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/DataSourceProcessor.java
  12. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseConnectionParam.java
  13. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDataSourceParamDTO.java
  14. 18
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDataSourceProcessor.java
  15. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DataSourceParamDTO.java
  16. 8
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DataSourceProcessor.java
  17. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveConnectionParam.java
  18. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDataSourceParamDTO.java
  19. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDataSourceProcessor.java
  20. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MySQLConnectionParam.java
  21. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MySQLDataSourceParamDTO.java
  22. 20
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MySQLDataSourceProcessor.java
  23. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDataSourceParamDTO.java
  24. 8
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDataSourceProcessor.java
  25. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSQLConnectionParam.java
  26. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSQLDataSourceParamDTO.java
  27. 18
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSQLDataSourceProcessor.java
  28. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDataSourceParamDTO.java
  29. 8
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDataSourceProcessor.java
  30. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkConnectionParam.java
  31. 6
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDataSourceParamDTO.java
  32. 8
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDataSourceProcessor.java
  33. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SQLServerConnectionParam.java
  34. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SQLServerDataSourceParamDTO.java
  35. 18
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SQLServerDataSourceProcessor.java
  36. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JDBCDataSourceProvider.java
  37. 40
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DataSourceUtils.java
  38. 10
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClientTest.java
  39. 12
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDataSourceProcessorTest.java
  40. 6
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DataSourceProcessorTest.java
  41. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDataSourceProcessorTest.java
  42. 14
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MySQLDataSourceProcessorTest.java
  43. 6
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDataSourceProcessorTest.java
  44. 12
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSQLDataSourceProcessorTest.java
  45. 6
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDataSourceProcessorTest.java
  46. 6
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDataSourceProcessorTest.java
  47. 12
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SQLServerDataSourceProcessorTest.java
  48. 18
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JDBCDataSourceProviderTest.java
  49. 20
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DataSourceUtilsTest.java
  50. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickHouseDataSourceChannel.java
  51. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickHouseDataSourceChannelFactory.java
  52. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickHouseDataSourceClient.java
  53. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickHouseDataSourceChannelFactoryTest.java
  54. 12
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickHouseDataSourceChannelTest.java
  55. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java
  56. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MySQLDataSourceChannel.java
  57. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MySQLDataSourceChannelFactory.java
  58. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MySQLDataSourceClient.java
  59. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MySQLDataSourceChannelFactoryTest.java
  60. 12
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MySQLDataSourceChannelTest.java
  61. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgreSQLDataSourceChannel.java
  62. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgreSQLDataSourceChannelFactory.java
  63. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgreSQLDataSourceClient.java
  64. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgreSQLDataSourceChannelFactoryTest.java
  65. 12
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgreSQLDataSourceChannelTest.java
  66. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SQLServerDataSourceChannel.java
  67. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SQLServerDataSourceChannelFactory.java
  68. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SQLServerDataSourceClient.java
  69. 4
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SQLServerDataSourceChannelFactoryTest.java
  70. 12
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SQLServerDataSourceChannelTest.java
  71. 8
      dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/SqoopJobGenerator.java
  72. 4
      dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/sources/MySQLSourceGenerator.java
  73. 4
      dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/targets/MySQLTargetGenerator.java
  74. 6
      dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/dao/MySQLUpgradeDao.java
  75. 6
      dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/dao/PostgreSQLUpgradeDao.java

4
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java

@ -25,7 +25,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MySQLDataSourceParamDTO;
import java.util.HashMap; import java.util.HashMap;
@ -48,7 +48,7 @@ public class DataSourceControllerTest extends AbstractControllerTest {
@Ignore @Ignore
@Test @Test
public void testCreateDataSource() throws Exception { public void testCreateDataSource() throws Exception {
MysqlDatasourceParamDTO mysqlDatasourceParam = new MysqlDatasourceParamDTO(); MySQLDataSourceParamDTO mysqlDatasourceParam = new MySQLDataSourceParamDTO();
mysqlDatasourceParam.setName("mysql"); mysqlDatasourceParam.setName("mysql");
mysqlDatasourceParam.setNote("mysql data source test"); mysqlDatasourceParam.setNote("mysql data source test");
mysqlDatasourceParam.setHost("192.168.xxxx.xx"); mysqlDatasourceParam.setHost("192.168.xxxx.xx");

18
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/DataSourceServiceTest.java

@ -28,9 +28,9 @@ import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper;
import org.apache.dolphinscheduler.dao.mapper.DataSourceUserMapper; import org.apache.dolphinscheduler.dao.mapper.DataSourceUserMapper;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive.HiveDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive.HiveDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MySQLDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle.OracleDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle.OracleDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSqlDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSQLDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils;
@ -79,7 +79,7 @@ public class DataSourceServiceTest {
String dataSourceName = "dataSource01"; String dataSourceName = "dataSource01";
String dataSourceDesc = "test dataSource"; String dataSourceDesc = "test dataSource";
PostgreSqlDatasourceParamDTO postgreSqlDatasourceParam = new PostgreSqlDatasourceParamDTO(); PostgreSQLDataSourceParamDTO postgreSqlDatasourceParam = new PostgreSQLDataSourceParamDTO();
postgreSqlDatasourceParam.setDatabase(dataSourceName); postgreSqlDatasourceParam.setDatabase(dataSourceName);
postgreSqlDatasourceParam.setNote(dataSourceDesc); postgreSqlDatasourceParam.setNote(dataSourceDesc);
postgreSqlDatasourceParam.setHost("172.16.133.200"); postgreSqlDatasourceParam.setHost("172.16.133.200");
@ -128,7 +128,7 @@ public class DataSourceServiceTest {
String dataSourceName = "dataSource01"; String dataSourceName = "dataSource01";
String dataSourceDesc = "test dataSource"; String dataSourceDesc = "test dataSource";
PostgreSqlDatasourceParamDTO postgreSqlDatasourceParam = new PostgreSqlDatasourceParamDTO(); PostgreSQLDataSourceParamDTO postgreSqlDatasourceParam = new PostgreSQLDataSourceParamDTO();
postgreSqlDatasourceParam.setDatabase(dataSourceName); postgreSqlDatasourceParam.setDatabase(dataSourceName);
postgreSqlDatasourceParam.setNote(dataSourceDesc); postgreSqlDatasourceParam.setNote(dataSourceDesc);
postgreSqlDatasourceParam.setHost("172.16.133.200"); postgreSqlDatasourceParam.setHost("172.16.133.200");
@ -300,7 +300,7 @@ public class DataSourceServiceTest {
@Test @Test
public void buildParameter() { public void buildParameter() {
OracleDatasourceParamDTO oracleDatasourceParamDTO = new OracleDatasourceParamDTO(); OracleDataSourceParamDTO oracleDatasourceParamDTO = new OracleDataSourceParamDTO();
oracleDatasourceParamDTO.setHost("192.168.9.1"); oracleDatasourceParamDTO.setHost("192.168.9.1");
oracleDatasourceParamDTO.setPort(1521); oracleDatasourceParamDTO.setPort(1521);
oracleDatasourceParamDTO.setDatabase("im"); oracleDatasourceParamDTO.setDatabase("im");
@ -340,7 +340,7 @@ public class DataSourceServiceTest {
Map<String, String> other = new HashMap<>(); Map<String, String> other = new HashMap<>();
other.put("autoDeserialize", "yes"); other.put("autoDeserialize", "yes");
other.put("allowUrlInLocalInfile", "true"); other.put("allowUrlInLocalInfile", "true");
MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); MySQLDataSourceParamDTO mysqlDatasourceParamDTO = new MySQLDataSourceParamDTO();
mysqlDatasourceParamDTO.setHost("192.168.9.1"); mysqlDatasourceParamDTO.setHost("192.168.9.1");
mysqlDatasourceParamDTO.setPort(1521); mysqlDatasourceParamDTO.setPort(1521);
mysqlDatasourceParamDTO.setDatabase("im"); mysqlDatasourceParamDTO.setDatabase("im");
@ -353,7 +353,7 @@ public class DataSourceServiceTest {
Assert.assertEquals(expected, JSONUtils.toJsonString(connectionParam)); Assert.assertEquals(expected, JSONUtils.toJsonString(connectionParam));
PropertyUtils.setValue(Constants.DATASOURCE_ENCRYPTION_ENABLE, "false"); PropertyUtils.setValue(Constants.DATASOURCE_ENCRYPTION_ENABLE, "false");
mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); mysqlDatasourceParamDTO = new MySQLDataSourceParamDTO();
mysqlDatasourceParamDTO.setHost("192.168.9.1"); mysqlDatasourceParamDTO.setHost("192.168.9.1");
mysqlDatasourceParamDTO.setPort(1521); mysqlDatasourceParamDTO.setPort(1521);
mysqlDatasourceParamDTO.setDatabase("im"); mysqlDatasourceParamDTO.setDatabase("im");
@ -387,7 +387,7 @@ public class DataSourceServiceTest {
String dataSourceName = "dataSource01"; String dataSourceName = "dataSource01";
String dataSourceDesc = "test dataSource"; String dataSourceDesc = "test dataSource";
PostgreSqlDatasourceParamDTO postgreSqlDatasourceParam = new PostgreSqlDatasourceParamDTO(); PostgreSQLDataSourceParamDTO postgreSqlDatasourceParam = new PostgreSQLDataSourceParamDTO();
postgreSqlDatasourceParam.setDatabase(dataSourceName); postgreSqlDatasourceParam.setDatabase(dataSourceName);
postgreSqlDatasourceParam.setNote(dataSourceDesc); postgreSqlDatasourceParam.setNote(dataSourceDesc);
postgreSqlDatasourceParam.setHost("172.16.133.200"); postgreSqlDatasourceParam.setHost("172.16.133.200");

8
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/MonitorDBDao.java

@ -17,8 +17,8 @@
package org.apache.dolphinscheduler.dao; package org.apache.dolphinscheduler.dao;
import org.apache.dolphinscheduler.dao.entity.MonitorRecord; import org.apache.dolphinscheduler.dao.entity.MonitorRecord;
import org.apache.dolphinscheduler.dao.utils.MysqlPerformance; import org.apache.dolphinscheduler.dao.utils.MySQLPerformance;
import org.apache.dolphinscheduler.dao.utils.PostgrePerformance; import org.apache.dolphinscheduler.dao.utils.PostgreSQLPerformance;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
import java.sql.Connection; import java.sql.Connection;
@ -47,9 +47,9 @@ public class MonitorDBDao {
try (final Connection conn = dataSource.getConnection()) { try (final Connection conn = dataSource.getConnection()) {
String driverClassName = DriverManager.getDriver(conn.getMetaData().getURL()).getClass().getName(); String driverClassName = DriverManager.getDriver(conn.getMetaData().getURL()).getClass().getName();
if (driverClassName.contains(DbType.MYSQL.toString().toLowerCase())) { if (driverClassName.contains(DbType.MYSQL.toString().toLowerCase())) {
return new MysqlPerformance().getMonitorRecord(conn); return new MySQLPerformance().getMonitorRecord(conn);
} else if (driverClassName.contains(DbType.POSTGRESQL.toString().toLowerCase())) { } else if (driverClassName.contains(DbType.POSTGRESQL.toString().toLowerCase())) {
return new PostgrePerformance().getMonitorRecord(conn); return new PostgreSQLPerformance().getMonitorRecord(conn);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("SQLException: {}", e.getMessage(), e); logger.error("SQLException: {}", e.getMessage(), e);

6
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/MysqlPerformance.java → dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/MySQLPerformance.java

@ -33,11 +33,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* mysql performance * MySQL performance
*/ */
public class MysqlPerformance extends BaseDBPerformance{ public class MySQLPerformance extends BaseDBPerformance {
private static Logger logger = LoggerFactory.getLogger(MysqlPerformance.class); private static Logger logger = LoggerFactory.getLogger(MySQLPerformance.class);
/** /**

4
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/PostgrePerformance.java → dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/utils/PostgreSQLPerformance.java

@ -30,8 +30,8 @@ import java.util.Date;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class PostgrePerformance extends BaseDBPerformance { public class PostgreSQLPerformance extends BaseDBPerformance {
private static final Logger logger = LoggerFactory.getLogger(PostgrePerformance.class); private static final Logger logger = LoggerFactory.getLogger(PostgreSQLPerformance.class);
/** /**
* get monitor record * get monitor record

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClient.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.client; package org.apache.dolphinscheduler.plugin.datasource.api.client;
import org.apache.dolphinscheduler.plugin.datasource.api.provider.JdbcDataSourceProvider; import org.apache.dolphinscheduler.plugin.datasource.api.provider.JDBCDataSourceProvider;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; import org.apache.dolphinscheduler.spi.datasource.DataSourceClient;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
@ -65,7 +65,7 @@ public class CommonDataSourceClient implements DataSourceClient {
} }
protected void initClient(BaseConnectionParam baseConnectionParam, DbType dbType) { protected void initClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
this.dataSource = JdbcDataSourceProvider.createJdbcDataSource(baseConnectionParam, dbType); this.dataSource = JDBCDataSourceProvider.createJdbcDataSource(baseConnectionParam, dbType);
this.jdbcTemplate = new JdbcTemplate(dataSource); this.jdbcTemplate = new JdbcTemplate(dataSource);
} }

2
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/AbstractDataSourceProcessor.java

@ -27,7 +27,7 @@ import java.text.MessageFormat;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public abstract class AbstractDatasourceProcessor implements DatasourceProcessor { public abstract class AbstractDataSourceProcessor implements DataSourceProcessor {
private static final Pattern IPV4_PATTERN = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.\\,]+$"); private static final Pattern IPV4_PATTERN = Pattern.compile("^[a-zA-Z0-9\\_\\-\\.\\,]+$");

50
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTO.java

@ -17,15 +17,15 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource; package org.apache.dolphinscheduler.plugin.datasource.api.datasource;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse.ClickHouseDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse.ClickHouseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2.Db2DatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2.Db2DataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive.HiveDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive.HiveDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MySQLDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle.OracleDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle.OracleDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSqlDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSQLDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto.PrestoDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto.PrestoDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark.SparkDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark.SparkDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver.SqlServerDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver.SQLServerDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
import java.io.Serializable; import java.io.Serializable;
@ -37,27 +37,27 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
/** /**
* Basic datasource params submitted to api. * Basic datasource params submitted to api.
* <p> * <p>
* see {@link MysqlDatasourceParamDTO} * see {@link MySQLDataSourceParamDTO}
* see {@link PostgreSqlDatasourceParamDTO} * see {@link PostgreSQLDataSourceParamDTO}
* see {@link HiveDataSourceParamDTO} * see {@link HiveDataSourceParamDTO}
* see {@link SparkDatasourceParamDTO} * see {@link SparkDataSourceParamDTO}
* see {@link ClickHouseDatasourceParamDTO} * see {@link ClickHouseDataSourceParamDTO}
* see {@link OracleDatasourceParamDTO} * see {@link OracleDataSourceParamDTO}
* see {@link SqlServerDatasourceParamDTO} * see {@link SQLServerDataSourceParamDTO}
* see {@link Db2DatasourceParamDTO} * see {@link Db2DataSourceParamDTO}
* see {@link PrestoDatasourceParamDTO} * see {@link PrestoDataSourceParamDTO}
*/ */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes(value = { @JsonSubTypes(value = {
@JsonSubTypes.Type(value = MysqlDatasourceParamDTO.class, name = "MYSQL"), @JsonSubTypes.Type(value = MySQLDataSourceParamDTO.class, name = "MYSQL"),
@JsonSubTypes.Type(value = PostgreSqlDatasourceParamDTO.class, name = "POSTGRESQL"), @JsonSubTypes.Type(value = PostgreSQLDataSourceParamDTO.class, name = "POSTGRESQL"),
@JsonSubTypes.Type(value = HiveDataSourceParamDTO.class, name = "HIVE"), @JsonSubTypes.Type(value = HiveDataSourceParamDTO.class, name = "HIVE"),
@JsonSubTypes.Type(value = SparkDatasourceParamDTO.class, name = "SPARK"), @JsonSubTypes.Type(value = SparkDataSourceParamDTO.class, name = "SPARK"),
@JsonSubTypes.Type(value = ClickHouseDatasourceParamDTO.class, name = "CLICKHOUSE"), @JsonSubTypes.Type(value = ClickHouseDataSourceParamDTO.class, name = "CLICKHOUSE"),
@JsonSubTypes.Type(value = OracleDatasourceParamDTO.class, name = "ORACLE"), @JsonSubTypes.Type(value = OracleDataSourceParamDTO.class, name = "ORACLE"),
@JsonSubTypes.Type(value = SqlServerDatasourceParamDTO.class, name = "SQLSERVER"), @JsonSubTypes.Type(value = SQLServerDataSourceParamDTO.class, name = "SQLSERVER"),
@JsonSubTypes.Type(value = Db2DatasourceParamDTO.class, name = "DB2"), @JsonSubTypes.Type(value = Db2DataSourceParamDTO.class, name = "DB2"),
@JsonSubTypes.Type(value = PrestoDatasourceParamDTO.class, name = "PRESTO"), @JsonSubTypes.Type(value = PrestoDataSourceParamDTO.class, name = "PRESTO"),
}) })
public abstract class BaseDataSourceParamDTO implements Serializable { public abstract class BaseDataSourceParamDTO implements Serializable {

2
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHdfsConnectionParam.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHDFSConnectionParam.java

@ -19,7 +19,7 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
public class BaseHdfsConnectionParam extends BaseConnectionParam { public class BaseHDFSConnectionParam extends BaseConnectionParam {
protected String principal; protected String principal;
protected String javaSecurityKrb5Conf; protected String javaSecurityKrb5Conf;
protected String loginUserKeytabUsername; protected String loginUserKeytabUsername;

2
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHdfsDatasourceParamDTO.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHDFSDataSourceParamDTO.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource; package org.apache.dolphinscheduler.plugin.datasource.api.datasource;
public abstract class BaseHdfsDatasourceParamDTO extends BaseDataSourceParamDTO { public abstract class BaseHDFSDataSourceParamDTO extends BaseDataSourceParamDTO {
protected String principal; protected String principal;

2
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/DatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/DataSourceProcessor.java

@ -24,7 +24,7 @@ import java.io.IOException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
public interface DatasourceProcessor { public interface DataSourceProcessor {
/** /**
* check datasource param is valid * check datasource param is valid

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickhouseConnectionParam.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseConnectionParam.java

@ -19,10 +19,10 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
public class ClickhouseConnectionParam extends BaseConnectionParam { public class ClickHouseConnectionParam extends BaseConnectionParam {
@Override @Override
public String toString() { public String toString() {
return "ClickhouseConnectionParam{" return "ClickHouseConnectionParam{"
+ "user='" + user + '\'' + "user='" + user + '\''
+ ", password='" + password + '\'' + ", password='" + password + '\''
+ ", address='" + address + '\'' + ", address='" + address + '\''

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceParamDTO.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDataSourceParamDTO.java

@ -20,11 +20,11 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class ClickHouseDatasourceParamDTO extends BaseDataSourceParamDTO { public class ClickHouseDataSourceParamDTO extends BaseDataSourceParamDTO {
@Override @Override
public String toString() { public String toString() {
return "ClickHouseDatasourceParamDTO{" return "ClickHouseDataSourceParamDTO{"
+ "host='" + host + '\'' + "host='" + host + '\''
+ ", port=" + port + ", port=" + port
+ ", database='" + database + '\'' + ", database='" + database + '\''

18
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDataSourceProcessor.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; import org.apache.dolphinscheduler.spi.datasource.ConnectionParam;
@ -34,13 +34,13 @@ import java.sql.SQLException;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
public class ClickHouseDatasourceProcessor extends AbstractDatasourceProcessor { public class ClickHouseDataSourceProcessor extends AbstractDataSourceProcessor {
@Override @Override
public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
ClickhouseConnectionParam connectionParams = (ClickhouseConnectionParam) createConnectionParams(connectionJson); ClickHouseConnectionParam connectionParams = (ClickHouseConnectionParam) createConnectionParams(connectionJson);
ClickHouseDatasourceParamDTO clickHouseDatasourceParamDTO = new ClickHouseDatasourceParamDTO(); ClickHouseDataSourceParamDTO clickHouseDatasourceParamDTO = new ClickHouseDataSourceParamDTO();
clickHouseDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); clickHouseDatasourceParamDTO.setDatabase(connectionParams.getDatabase());
clickHouseDatasourceParamDTO.setUserName(connectionParams.getUser()); clickHouseDatasourceParamDTO.setUserName(connectionParams.getUser());
clickHouseDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); clickHouseDatasourceParamDTO.setOther(parseOther(connectionParams.getOther()));
@ -55,11 +55,11 @@ public class ClickHouseDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public ConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { public ConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) {
ClickHouseDatasourceParamDTO clickHouseParam = (ClickHouseDatasourceParamDTO) datasourceParam; ClickHouseDataSourceParamDTO clickHouseParam = (ClickHouseDataSourceParamDTO) datasourceParam;
String address = String.format("%s%s:%s", Constants.JDBC_CLICKHOUSE, clickHouseParam.getHost(), clickHouseParam.getPort()); String address = String.format("%s%s:%s", Constants.JDBC_CLICKHOUSE, clickHouseParam.getHost(), clickHouseParam.getPort());
String jdbcUrl = address + "/" + clickHouseParam.getDatabase(); String jdbcUrl = address + "/" + clickHouseParam.getDatabase();
ClickhouseConnectionParam clickhouseConnectionParam = new ClickhouseConnectionParam(); ClickHouseConnectionParam clickhouseConnectionParam = new ClickHouseConnectionParam();
clickhouseConnectionParam.setDatabase(clickHouseParam.getDatabase()); clickhouseConnectionParam.setDatabase(clickHouseParam.getDatabase());
clickhouseConnectionParam.setAddress(address); clickhouseConnectionParam.setAddress(address);
clickhouseConnectionParam.setJdbcUrl(jdbcUrl); clickhouseConnectionParam.setJdbcUrl(jdbcUrl);
@ -74,7 +74,7 @@ public class ClickHouseDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public ConnectionParam createConnectionParams(String connectionJson) { public ConnectionParam createConnectionParams(String connectionJson) {
return JSONUtils.parseObject(connectionJson, ClickhouseConnectionParam.class); return JSONUtils.parseObject(connectionJson, ClickHouseConnectionParam.class);
} }
@Override @Override
@ -89,7 +89,7 @@ public class ClickHouseDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public String getJdbcUrl(ConnectionParam connectionParam) { public String getJdbcUrl(ConnectionParam connectionParam) {
ClickhouseConnectionParam clickhouseConnectionParam = (ClickhouseConnectionParam) connectionParam; ClickHouseConnectionParam clickhouseConnectionParam = (ClickHouseConnectionParam) connectionParam;
String jdbcUrl = clickhouseConnectionParam.getJdbcUrl(); String jdbcUrl = clickhouseConnectionParam.getJdbcUrl();
if (!StringUtils.isEmpty(clickhouseConnectionParam.getOther())) { if (!StringUtils.isEmpty(clickhouseConnectionParam.getOther())) {
jdbcUrl = String.format("%s?%s", jdbcUrl, clickhouseConnectionParam.getOther()); jdbcUrl = String.format("%s?%s", jdbcUrl, clickhouseConnectionParam.getOther());
@ -99,7 +99,7 @@ public class ClickHouseDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException {
ClickhouseConnectionParam clickhouseConnectionParam = (ClickhouseConnectionParam) connectionParam; ClickHouseConnectionParam clickhouseConnectionParam = (ClickHouseConnectionParam) connectionParam;
Class.forName(getDatasourceDriver()); Class.forName(getDatasourceDriver());
return DriverManager.getConnection(getJdbcUrl(clickhouseConnectionParam), return DriverManager.getConnection(getJdbcUrl(clickhouseConnectionParam),
clickhouseConnectionParam.getUser(), PasswordUtils.decodePassword(clickhouseConnectionParam.getPassword())); clickhouseConnectionParam.getUser(), PasswordUtils.decodePassword(clickhouseConnectionParam.getPassword()));

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceParamDTO.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DataSourceParamDTO.java

@ -20,11 +20,11 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class Db2DatasourceParamDTO extends BaseDataSourceParamDTO { public class Db2DataSourceParamDTO extends BaseDataSourceParamDTO {
@Override @Override
public String toString() { public String toString() {
return "Db2DatasourceParamDTO{" return "Db2DataSourceParamDTO{"
+ "name='" + name + '\'' + "name='" + name + '\''
+ ", note='" + note + '\'' + ", note='" + note + '\''
+ ", host='" + host + '\'' + ", host='" + host + '\''

8
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DataSourceProcessor.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
@ -35,13 +35,13 @@ import java.sql.SQLException;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
public class Db2DatasourceProcessor extends AbstractDatasourceProcessor { public class Db2DataSourceProcessor extends AbstractDataSourceProcessor {
@Override @Override
public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
Db2ConnectionParam connectionParams = (Db2ConnectionParam) createConnectionParams(connectionJson); Db2ConnectionParam connectionParams = (Db2ConnectionParam) createConnectionParams(connectionJson);
Db2DatasourceParamDTO db2DatasourceParamDTO = new Db2DatasourceParamDTO(); Db2DataSourceParamDTO db2DatasourceParamDTO = new Db2DataSourceParamDTO();
db2DatasourceParamDTO.setDatabase(connectionParams.getDatabase()); db2DatasourceParamDTO.setDatabase(connectionParams.getDatabase());
db2DatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); db2DatasourceParamDTO.setOther(parseOther(connectionParams.getOther()));
db2DatasourceParamDTO.setUserName(db2DatasourceParamDTO.getUserName()); db2DatasourceParamDTO.setUserName(db2DatasourceParamDTO.getUserName());
@ -56,7 +56,7 @@ public class Db2DatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) {
Db2DatasourceParamDTO db2Param = (Db2DatasourceParamDTO) datasourceParam; Db2DataSourceParamDTO db2Param = (Db2DataSourceParamDTO) datasourceParam;
String address = String.format("%s%s:%s", Constants.JDBC_DB2, db2Param.getHost(), db2Param.getPort()); String address = String.format("%s%s:%s", Constants.JDBC_DB2, db2Param.getHost(), db2Param.getPort());
String jdbcUrl = String.format("%s/%s", address, db2Param.getDatabase()); String jdbcUrl = String.format("%s/%s", address, db2Param.getDatabase());

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveConnectionParam.java

@ -17,9 +17,9 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHdfsConnectionParam; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHDFSConnectionParam;
public class HiveConnectionParam extends BaseHdfsConnectionParam { public class HiveConnectionParam extends BaseHDFSConnectionParam {
@Override @Override
public String toString() { public String toString() {
return "HiveConnectionParam{" return "HiveConnectionParam{"

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDataSourceParamDTO.java

@ -17,10 +17,10 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHdfsDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHDFSDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class HiveDataSourceParamDTO extends BaseHdfsDatasourceParamDTO { public class HiveDataSourceParamDTO extends BaseHDFSDataSourceParamDTO {
@Override @Override
public String toString() { public String toString() {

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDataSourceProcessor.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
@ -37,7 +37,7 @@ import java.sql.SQLException;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
public class HiveDatasourceProcessor extends AbstractDatasourceProcessor { public class HiveDataSourceProcessor extends AbstractDataSourceProcessor {
@Override @Override
public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlConnectionParam.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MySQLConnectionParam.java

@ -19,10 +19,10 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
public class MysqlConnectionParam extends BaseConnectionParam { public class MySQLConnectionParam extends BaseConnectionParam {
@Override @Override
public String toString() { public String toString() {
return "MysqlConnectionParam{" return "MySQLConnectionParam{"
+ "user='" + user + '\'' + "user='" + user + '\''
+ ", password='" + password + '\'' + ", password='" + password + '\''
+ ", address='" + address + '\'' + ", address='" + address + '\''

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceParamDTO.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MySQLDataSourceParamDTO.java

@ -20,11 +20,11 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class MysqlDatasourceParamDTO extends BaseDataSourceParamDTO { public class MySQLDataSourceParamDTO extends BaseDataSourceParamDTO {
@Override @Override
public String toString() { public String toString() {
return "MysqlDatasourceParamDTO{" return "MySQLDataSourceParamDTO{"
+ "name='" + name + '\'' + "name='" + name + '\''
+ ", note='" + note + '\'' + ", note='" + note + '\''
+ ", host='" + host + '\'' + ", host='" + host + '\''

20
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MySQLDataSourceProcessor.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
@ -39,9 +39,9 @@ import java.util.Map;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class MysqlDatasourceProcessor extends AbstractDatasourceProcessor { public class MySQLDataSourceProcessor extends AbstractDataSourceProcessor {
private final Logger logger = LoggerFactory.getLogger(MysqlDatasourceProcessor.class); private final Logger logger = LoggerFactory.getLogger(MySQLDataSourceProcessor.class);
private static final String ALLOW_LOAD_LOCAL_IN_FILE_NAME = "allowLoadLocalInfile"; private static final String ALLOW_LOAD_LOCAL_IN_FILE_NAME = "allowLoadLocalInfile";
@ -55,8 +55,8 @@ public class MysqlDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
MysqlConnectionParam connectionParams = (MysqlConnectionParam) createConnectionParams(connectionJson); MySQLConnectionParam connectionParams = (MySQLConnectionParam) createConnectionParams(connectionJson);
MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); MySQLDataSourceParamDTO mysqlDatasourceParamDTO = new MySQLDataSourceParamDTO();
mysqlDatasourceParamDTO.setUserName(connectionParams.getUser()); mysqlDatasourceParamDTO.setUserName(connectionParams.getUser());
mysqlDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); mysqlDatasourceParamDTO.setDatabase(connectionParams.getDatabase());
@ -73,11 +73,11 @@ public class MysqlDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO dataSourceParam) { public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO dataSourceParam) {
MysqlDatasourceParamDTO mysqlDatasourceParam = (MysqlDatasourceParamDTO) dataSourceParam; MySQLDataSourceParamDTO mysqlDatasourceParam = (MySQLDataSourceParamDTO) dataSourceParam;
String address = String.format("%s%s:%s", Constants.JDBC_MYSQL, mysqlDatasourceParam.getHost(), mysqlDatasourceParam.getPort()); String address = String.format("%s%s:%s", Constants.JDBC_MYSQL, mysqlDatasourceParam.getHost(), mysqlDatasourceParam.getPort());
String jdbcUrl = String.format("%s/%s", address, mysqlDatasourceParam.getDatabase()); String jdbcUrl = String.format("%s/%s", address, mysqlDatasourceParam.getDatabase());
MysqlConnectionParam mysqlConnectionParam = new MysqlConnectionParam(); MySQLConnectionParam mysqlConnectionParam = new MySQLConnectionParam();
mysqlConnectionParam.setJdbcUrl(jdbcUrl); mysqlConnectionParam.setJdbcUrl(jdbcUrl);
mysqlConnectionParam.setDatabase(mysqlDatasourceParam.getDatabase()); mysqlConnectionParam.setDatabase(mysqlDatasourceParam.getDatabase());
mysqlConnectionParam.setAddress(address); mysqlConnectionParam.setAddress(address);
@ -93,7 +93,7 @@ public class MysqlDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public ConnectionParam createConnectionParams(String connectionJson) { public ConnectionParam createConnectionParams(String connectionJson) {
return JSONUtils.parseObject(connectionJson, MysqlConnectionParam.class); return JSONUtils.parseObject(connectionJson, MySQLConnectionParam.class);
} }
@Override @Override
@ -108,7 +108,7 @@ public class MysqlDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public String getJdbcUrl(ConnectionParam connectionParam) { public String getJdbcUrl(ConnectionParam connectionParam) {
MysqlConnectionParam mysqlConnectionParam = (MysqlConnectionParam) connectionParam; MySQLConnectionParam mysqlConnectionParam = (MySQLConnectionParam) connectionParam;
String jdbcUrl = mysqlConnectionParam.getJdbcUrl(); String jdbcUrl = mysqlConnectionParam.getJdbcUrl();
if (!StringUtils.isEmpty(mysqlConnectionParam.getOther())) { if (!StringUtils.isEmpty(mysqlConnectionParam.getOther())) {
return String.format("%s?%s&%s", jdbcUrl, mysqlConnectionParam.getOther(), APPEND_PARAMS); return String.format("%s?%s&%s", jdbcUrl, mysqlConnectionParam.getOther(), APPEND_PARAMS);
@ -118,7 +118,7 @@ public class MysqlDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException {
MysqlConnectionParam mysqlConnectionParam = (MysqlConnectionParam) connectionParam; MySQLConnectionParam mysqlConnectionParam = (MySQLConnectionParam) connectionParam;
Class.forName(getDatasourceDriver()); Class.forName(getDatasourceDriver());
String user = mysqlConnectionParam.getUser(); String user = mysqlConnectionParam.getUser();
if (user.contains(AUTO_DESERIALIZE)) { if (user.contains(AUTO_DESERIALIZE)) {

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceParamDTO.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDataSourceParamDTO.java

@ -21,7 +21,7 @@ import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSour
import org.apache.dolphinscheduler.spi.enums.DbConnectType; import org.apache.dolphinscheduler.spi.enums.DbConnectType;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class OracleDatasourceParamDTO extends BaseDataSourceParamDTO { public class OracleDataSourceParamDTO extends BaseDataSourceParamDTO {
private DbConnectType connectType; private DbConnectType connectType;
@ -35,7 +35,7 @@ public class OracleDatasourceParamDTO extends BaseDataSourceParamDTO {
@Override @Override
public String toString() { public String toString() {
return "OracleDatasourceParamDTO{" return "OracleDataSourceParamDTO{"
+ "name='" + name + '\'' + "name='" + name + '\''
+ ", note='" + note + '\'' + ", note='" + note + '\''
+ ", host='" + host + '\'' + ", host='" + host + '\''

8
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDataSourceProcessor.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
@ -38,12 +38,12 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class OracleDatasourceProcessor extends AbstractDatasourceProcessor { public class OracleDataSourceProcessor extends AbstractDataSourceProcessor {
@Override @Override
public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
OracleConnectionParam connectionParams = (OracleConnectionParam) createConnectionParams(connectionJson); OracleConnectionParam connectionParams = (OracleConnectionParam) createConnectionParams(connectionJson);
OracleDatasourceParamDTO oracleDatasourceParamDTO = new OracleDatasourceParamDTO(); OracleDataSourceParamDTO oracleDatasourceParamDTO = new OracleDataSourceParamDTO();
oracleDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); oracleDatasourceParamDTO.setDatabase(connectionParams.getDatabase());
oracleDatasourceParamDTO.setUserName(connectionParams.getUser()); oracleDatasourceParamDTO.setUserName(connectionParams.getUser());
@ -63,7 +63,7 @@ public class OracleDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) {
OracleDatasourceParamDTO oracleParam = (OracleDatasourceParamDTO) datasourceParam; OracleDataSourceParamDTO oracleParam = (OracleDataSourceParamDTO) datasourceParam;
String address; String address;
if (DbConnectType.ORACLE_SID.equals(oracleParam.getConnectType())) { if (DbConnectType.ORACLE_SID.equals(oracleParam.getConnectType())) {
address = String.format("%s%s:%s", address = String.format("%s%s:%s",

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlConnectionParam.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSQLConnectionParam.java

@ -19,10 +19,10 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
public class PostgreSqlConnectionParam extends BaseConnectionParam { public class PostgreSQLConnectionParam extends BaseConnectionParam {
@Override @Override
public String toString() { public String toString() {
return "PostgreSqlConnectionParam{" return "PostgreSQLConnectionParam{"
+ "user='" + user + '\'' + "user='" + user + '\''
+ ", password='" + password + '\'' + ", password='" + password + '\''
+ ", address='" + address + '\'' + ", address='" + address + '\''

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceParamDTO.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSQLDataSourceParamDTO.java

@ -20,11 +20,11 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class PostgreSqlDatasourceParamDTO extends BaseDataSourceParamDTO { public class PostgreSQLDataSourceParamDTO extends BaseDataSourceParamDTO {
@Override @Override
public String toString() { public String toString() {
return "PostgreSqlDatasourceParamDTO{" return "PostgreSQLDataSourceParamDTO{"
+ "host='" + host + '\'' + "host='" + host + '\''
+ ", port=" + port + ", port=" + port
+ ", database='" + database + '\'' + ", database='" + database + '\''

18
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSQLDataSourceProcessor.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
@ -35,12 +35,12 @@ import java.sql.SQLException;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
public class PostgreSqlDatasourceProcessor extends AbstractDatasourceProcessor { public class PostgreSQLDataSourceProcessor extends AbstractDataSourceProcessor {
@Override @Override
public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
PostgreSqlConnectionParam connectionParams = (PostgreSqlConnectionParam) createConnectionParams(connectionJson); PostgreSQLConnectionParam connectionParams = (PostgreSQLConnectionParam) createConnectionParams(connectionJson);
PostgreSqlDatasourceParamDTO postgreSqlDatasourceParamDTO = new PostgreSqlDatasourceParamDTO(); PostgreSQLDataSourceParamDTO postgreSqlDatasourceParamDTO = new PostgreSQLDataSourceParamDTO();
postgreSqlDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); postgreSqlDatasourceParamDTO.setDatabase(connectionParams.getDatabase());
postgreSqlDatasourceParamDTO.setUserName(connectionParams.getUser()); postgreSqlDatasourceParamDTO.setUserName(connectionParams.getUser());
postgreSqlDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); postgreSqlDatasourceParamDTO.setOther(parseOther(connectionParams.getOther()));
@ -56,11 +56,11 @@ public class PostgreSqlDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) {
PostgreSqlDatasourceParamDTO postgreSqlParam = (PostgreSqlDatasourceParamDTO) datasourceParam; PostgreSQLDataSourceParamDTO postgreSqlParam = (PostgreSQLDataSourceParamDTO) datasourceParam;
String address = String.format("%s%s:%s", Constants.JDBC_POSTGRESQL, postgreSqlParam.getHost(), postgreSqlParam.getPort()); String address = String.format("%s%s:%s", Constants.JDBC_POSTGRESQL, postgreSqlParam.getHost(), postgreSqlParam.getPort());
String jdbcUrl = String.format("%s/%s", address, postgreSqlParam.getDatabase()); String jdbcUrl = String.format("%s/%s", address, postgreSqlParam.getDatabase());
PostgreSqlConnectionParam postgreSqlConnectionParam = new PostgreSqlConnectionParam(); PostgreSQLConnectionParam postgreSqlConnectionParam = new PostgreSQLConnectionParam();
postgreSqlConnectionParam.setJdbcUrl(jdbcUrl); postgreSqlConnectionParam.setJdbcUrl(jdbcUrl);
postgreSqlConnectionParam.setAddress(address); postgreSqlConnectionParam.setAddress(address);
postgreSqlConnectionParam.setDatabase(postgreSqlParam.getDatabase()); postgreSqlConnectionParam.setDatabase(postgreSqlParam.getDatabase());
@ -76,7 +76,7 @@ public class PostgreSqlDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public ConnectionParam createConnectionParams(String connectionJson) { public ConnectionParam createConnectionParams(String connectionJson) {
return JSONUtils.parseObject(connectionJson, PostgreSqlConnectionParam.class); return JSONUtils.parseObject(connectionJson, PostgreSQLConnectionParam.class);
} }
@Override @Override
@ -91,7 +91,7 @@ public class PostgreSqlDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public String getJdbcUrl(ConnectionParam connectionParam) { public String getJdbcUrl(ConnectionParam connectionParam) {
PostgreSqlConnectionParam postgreSqlConnectionParam = (PostgreSqlConnectionParam) connectionParam; PostgreSQLConnectionParam postgreSqlConnectionParam = (PostgreSQLConnectionParam) connectionParam;
if (!StringUtils.isEmpty(postgreSqlConnectionParam.getOther())) { if (!StringUtils.isEmpty(postgreSqlConnectionParam.getOther())) {
return String.format("%s?%s", postgreSqlConnectionParam.getJdbcUrl(), postgreSqlConnectionParam.getOther()); return String.format("%s?%s", postgreSqlConnectionParam.getJdbcUrl(), postgreSqlConnectionParam.getOther());
} }
@ -100,7 +100,7 @@ public class PostgreSqlDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException {
PostgreSqlConnectionParam postgreSqlConnectionParam = (PostgreSqlConnectionParam) connectionParam; PostgreSQLConnectionParam postgreSqlConnectionParam = (PostgreSQLConnectionParam) connectionParam;
Class.forName(getDatasourceDriver()); Class.forName(getDatasourceDriver());
return DriverManager.getConnection(getJdbcUrl(postgreSqlConnectionParam), return DriverManager.getConnection(getJdbcUrl(postgreSqlConnectionParam),
postgreSqlConnectionParam.getUser(), PasswordUtils.decodePassword(postgreSqlConnectionParam.getPassword())); postgreSqlConnectionParam.getUser(), PasswordUtils.decodePassword(postgreSqlConnectionParam.getPassword()));

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceParamDTO.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDataSourceParamDTO.java

@ -20,11 +20,11 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class PrestoDatasourceParamDTO extends BaseDataSourceParamDTO { public class PrestoDataSourceParamDTO extends BaseDataSourceParamDTO {
@Override @Override
public String toString() { public String toString() {
return "PrestoDatasourceParamDTO{" return "PrestoDataSourceParamDTO{"
+ "name='" + name + '\'' + "name='" + name + '\''
+ ", note='" + note + '\'' + ", note='" + note + '\''
+ ", host='" + host + '\'' + ", host='" + host + '\''

8
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDataSourceProcessor.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
@ -37,7 +37,7 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class PrestoDatasourceProcessor extends AbstractDatasourceProcessor { public class PrestoDataSourceProcessor extends AbstractDataSourceProcessor {
@Override @Override
public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
@ -46,7 +46,7 @@ public class PrestoDatasourceProcessor extends AbstractDatasourceProcessor {
String[] hostSeperator = connectionParams.getAddress().split(Constants.DOUBLE_SLASH); String[] hostSeperator = connectionParams.getAddress().split(Constants.DOUBLE_SLASH);
String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(Constants.COMMA); String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(Constants.COMMA);
PrestoDatasourceParamDTO prestoDatasourceParamDTO = new PrestoDatasourceParamDTO(); PrestoDataSourceParamDTO prestoDatasourceParamDTO = new PrestoDataSourceParamDTO();
prestoDatasourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(Constants.COLON)[1])); prestoDatasourceParamDTO.setPort(Integer.parseInt(hostPortArray[0].split(Constants.COLON)[1]));
prestoDatasourceParamDTO.setHost(hostPortArray[0].split(Constants.COLON)[0]); prestoDatasourceParamDTO.setHost(hostPortArray[0].split(Constants.COLON)[0]);
prestoDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); prestoDatasourceParamDTO.setDatabase(connectionParams.getDatabase());
@ -58,7 +58,7 @@ public class PrestoDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) {
PrestoDatasourceParamDTO prestoParam = (PrestoDatasourceParamDTO) datasourceParam; PrestoDataSourceParamDTO prestoParam = (PrestoDataSourceParamDTO) datasourceParam;
String address = String.format("%s%s:%s", Constants.JDBC_PRESTO, prestoParam.getHost(), prestoParam.getPort()); String address = String.format("%s%s:%s", Constants.JDBC_PRESTO, prestoParam.getHost(), prestoParam.getPort());
String jdbcUrl = address + "/" + prestoParam.getDatabase(); String jdbcUrl = address + "/" + prestoParam.getDatabase();

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkConnectionParam.java

@ -17,9 +17,9 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHdfsConnectionParam; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHDFSConnectionParam;
public class SparkConnectionParam extends BaseHdfsConnectionParam { public class SparkConnectionParam extends BaseHDFSConnectionParam {
@Override @Override
public String toString() { public String toString() {
return "SparkConnectionParam{" return "SparkConnectionParam{"

6
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceParamDTO.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDataSourceParamDTO.java

@ -17,14 +17,14 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHdfsDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseHDFSDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class SparkDatasourceParamDTO extends BaseHdfsDatasourceParamDTO { public class SparkDataSourceParamDTO extends BaseHDFSDataSourceParamDTO {
@Override @Override
public String toString() { public String toString() {
return "SparkDatasourceParamDTO{" return "SparkDataSourceParamDTO{"
+ "host='" + host + '\'' + "host='" + host + '\''
+ ", port=" + port + ", port=" + port
+ ", database='" + database + '\'' + ", database='" + database + '\''

8
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDataSourceProcessor.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
@ -40,13 +40,13 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class SparkDatasourceProcessor extends AbstractDatasourceProcessor { public class SparkDataSourceProcessor extends AbstractDataSourceProcessor {
@Override @Override
public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
SparkConnectionParam connectionParams = (SparkConnectionParam) createConnectionParams(connectionJson); SparkConnectionParam connectionParams = (SparkConnectionParam) createConnectionParams(connectionJson);
SparkDatasourceParamDTO sparkDatasourceParamDTO = new SparkDatasourceParamDTO(); SparkDataSourceParamDTO sparkDatasourceParamDTO = new SparkDataSourceParamDTO();
sparkDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); sparkDatasourceParamDTO.setDatabase(connectionParams.getDatabase());
sparkDatasourceParamDTO.setUserName(connectionParams.getUser()); sparkDatasourceParamDTO.setUserName(connectionParams.getUser());
sparkDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); sparkDatasourceParamDTO.setOther(parseOther(connectionParams.getOther()));
@ -69,7 +69,7 @@ public class SparkDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO dataSourceParam) { public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO dataSourceParam) {
StringBuilder address = new StringBuilder(); StringBuilder address = new StringBuilder();
SparkDatasourceParamDTO sparkDatasourceParam = (SparkDatasourceParamDTO) dataSourceParam; SparkDataSourceParamDTO sparkDatasourceParam = (SparkDataSourceParamDTO) dataSourceParam;
address.append(Constants.JDBC_HIVE_2); address.append(Constants.JDBC_HIVE_2);
for (String zkHost : sparkDatasourceParam.getHost().split(",")) { for (String zkHost : sparkDatasourceParam.getHost().split(",")) {
address.append(String.format("%s:%s,", zkHost, sparkDatasourceParam.getPort())); address.append(String.format("%s:%s,", zkHost, sparkDatasourceParam.getPort()));

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerConnectionParam.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SQLServerConnectionParam.java

@ -19,10 +19,10 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
public class SqlServerConnectionParam extends BaseConnectionParam { public class SQLServerConnectionParam extends BaseConnectionParam {
@Override @Override
public String toString() { public String toString() {
return "SqlServerConnectionParam{" return "SQLServerConnectionParam{"
+ "user='" + user + '\'' + "user='" + user + '\''
+ ", password='" + password + '\'' + ", password='" + password + '\''
+ ", address='" + address + '\'' + ", address='" + address + '\''

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceParamDTO.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SQLServerDataSourceParamDTO.java

@ -20,11 +20,11 @@ package org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class SqlServerDatasourceParamDTO extends BaseDataSourceParamDTO { public class SQLServerDataSourceParamDTO extends BaseDataSourceParamDTO {
@Override @Override
public String toString() { public String toString() {
return "SqlServerDatasourceParamDTO{" return "SqlServerDataSourceParamDTO{"
+ "name='" + name + '\'' + "name='" + name + '\''
+ ", note='" + note + '\'' + ", note='" + note + '\''
+ ", host='" + host + '\'' + ", host='" + host + '\''

18
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceProcessor.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SQLServerDataSourceProcessor.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver; package org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.AbstractDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
@ -35,15 +35,15 @@ import java.sql.SQLException;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map; import java.util.Map;
public class SqlServerDatasourceProcessor extends AbstractDatasourceProcessor { public class SQLServerDataSourceProcessor extends AbstractDataSourceProcessor {
@Override @Override
public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) { public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
SqlServerConnectionParam connectionParams = (SqlServerConnectionParam) createConnectionParams(connectionJson); SQLServerConnectionParam connectionParams = (SQLServerConnectionParam) createConnectionParams(connectionJson);
String[] hostSeperator = connectionParams.getAddress().split(Constants.DOUBLE_SLASH); String[] hostSeperator = connectionParams.getAddress().split(Constants.DOUBLE_SLASH);
String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(Constants.COMMA); String[] hostPortArray = hostSeperator[hostSeperator.length - 1].split(Constants.COMMA);
SqlServerDatasourceParamDTO sqlServerDatasourceParamDTO = new SqlServerDatasourceParamDTO(); SQLServerDataSourceParamDTO sqlServerDatasourceParamDTO = new SQLServerDataSourceParamDTO();
sqlServerDatasourceParamDTO.setDatabase(connectionParams.getDatabase()); sqlServerDatasourceParamDTO.setDatabase(connectionParams.getDatabase());
sqlServerDatasourceParamDTO.setUserName(connectionParams.getUser()); sqlServerDatasourceParamDTO.setUserName(connectionParams.getUser());
sqlServerDatasourceParamDTO.setOther(parseOther(connectionParams.getOther())); sqlServerDatasourceParamDTO.setOther(parseOther(connectionParams.getOther()));
@ -54,11 +54,11 @@ public class SqlServerDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) { public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO datasourceParam) {
SqlServerDatasourceParamDTO sqlServerParam = (SqlServerDatasourceParamDTO) datasourceParam; SQLServerDataSourceParamDTO sqlServerParam = (SQLServerDataSourceParamDTO) datasourceParam;
String address = String.format("%s%s:%s", Constants.JDBC_SQLSERVER, sqlServerParam.getHost(), sqlServerParam.getPort()); String address = String.format("%s%s:%s", Constants.JDBC_SQLSERVER, sqlServerParam.getHost(), sqlServerParam.getPort());
String jdbcUrl = address + ";databaseName=" + sqlServerParam.getDatabase(); String jdbcUrl = address + ";databaseName=" + sqlServerParam.getDatabase();
SqlServerConnectionParam sqlServerConnectionParam = new SqlServerConnectionParam(); SQLServerConnectionParam sqlServerConnectionParam = new SQLServerConnectionParam();
sqlServerConnectionParam.setAddress(address); sqlServerConnectionParam.setAddress(address);
sqlServerConnectionParam.setDatabase(sqlServerParam.getDatabase()); sqlServerConnectionParam.setDatabase(sqlServerParam.getDatabase());
sqlServerConnectionParam.setJdbcUrl(jdbcUrl); sqlServerConnectionParam.setJdbcUrl(jdbcUrl);
@ -73,7 +73,7 @@ public class SqlServerDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public BaseConnectionParam createConnectionParams(String connectionJson) { public BaseConnectionParam createConnectionParams(String connectionJson) {
return JSONUtils.parseObject(connectionJson, SqlServerConnectionParam.class); return JSONUtils.parseObject(connectionJson, SQLServerConnectionParam.class);
} }
@Override @Override
@ -88,7 +88,7 @@ public class SqlServerDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public String getJdbcUrl(ConnectionParam connectionParam) { public String getJdbcUrl(ConnectionParam connectionParam) {
SqlServerConnectionParam sqlServerConnectionParam = (SqlServerConnectionParam) connectionParam; SQLServerConnectionParam sqlServerConnectionParam = (SQLServerConnectionParam) connectionParam;
if (!StringUtils.isEmpty(sqlServerConnectionParam.getOther())) { if (!StringUtils.isEmpty(sqlServerConnectionParam.getOther())) {
return String.format("%s;%s", sqlServerConnectionParam.getJdbcUrl(), sqlServerConnectionParam.getOther()); return String.format("%s;%s", sqlServerConnectionParam.getJdbcUrl(), sqlServerConnectionParam.getOther());
@ -98,7 +98,7 @@ public class SqlServerDatasourceProcessor extends AbstractDatasourceProcessor {
@Override @Override
public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException { public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException {
SqlServerConnectionParam sqlServerConnectionParam = (SqlServerConnectionParam) connectionParam; SQLServerConnectionParam sqlServerConnectionParam = (SQLServerConnectionParam) connectionParam;
Class.forName(getDatasourceDriver()); Class.forName(getDatasourceDriver());
return DriverManager.getConnection(getJdbcUrl(connectionParam), sqlServerConnectionParam.getUser(), return DriverManager.getConnection(getJdbcUrl(connectionParam), sqlServerConnectionParam.getUser(),
PasswordUtils.decodePassword(sqlServerConnectionParam.getPassword())); PasswordUtils.decodePassword(sqlServerConnectionParam.getPassword()));

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProvider.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JDBCDataSourceProvider.java

@ -35,9 +35,9 @@ import com.zaxxer.hikari.HikariDataSource;
/** /**
* Jdbc Data Source Provider * Jdbc Data Source Provider
*/ */
public class JdbcDataSourceProvider { public class JDBCDataSourceProvider {
private static final Logger logger = LoggerFactory.getLogger(JdbcDataSourceProvider.class); private static final Logger logger = LoggerFactory.getLogger(JDBCDataSourceProvider.class);
public static HikariDataSource createJdbcDataSource(BaseConnectionParam properties, DbType dbType) { public static HikariDataSource createJdbcDataSource(BaseConnectionParam properties, DbType dbType) {
logger.info("Creating HikariDataSource pool for maxActive:{}", PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_ACTIVE, 50)); logger.info("Creating HikariDataSource pool for maxActive:{}", PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_ACTIVE, 50));

40
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DataSourceUtils.java

@ -18,16 +18,16 @@
package org.apache.dolphinscheduler.plugin.datasource.api.utils; package org.apache.dolphinscheduler.plugin.datasource.api.utils;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.DatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.DataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse.ClickHouseDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse.ClickHouseDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2.Db2DatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.db2.Db2DataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive.HiveDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.hive.HiveDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MySQLDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle.OracleDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.oracle.OracleDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSqlDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSQLDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto.PrestoDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.presto.PrestoDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark.SparkDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.spark.SparkDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver.SqlServerDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver.SQLServerDataSourceProcessor;
import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; import org.apache.dolphinscheduler.spi.datasource.ConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
@ -41,15 +41,15 @@ public class DataSourceUtils {
private static final Logger logger = LoggerFactory.getLogger(DataSourceUtils.class); private static final Logger logger = LoggerFactory.getLogger(DataSourceUtils.class);
private static final DatasourceProcessor mysqlProcessor = new MysqlDatasourceProcessor(); private static final DataSourceProcessor mysqlProcessor = new MySQLDataSourceProcessor();
private static final DatasourceProcessor postgreSqlProcessor = new PostgreSqlDatasourceProcessor(); private static final DataSourceProcessor postgreSqlProcessor = new PostgreSQLDataSourceProcessor();
private static final DatasourceProcessor hiveProcessor = new HiveDatasourceProcessor(); private static final DataSourceProcessor hiveProcessor = new HiveDataSourceProcessor();
private static final DatasourceProcessor sparkProcessor = new SparkDatasourceProcessor(); private static final DataSourceProcessor sparkProcessor = new SparkDataSourceProcessor();
private static final DatasourceProcessor clickhouseProcessor = new ClickHouseDatasourceProcessor(); private static final DataSourceProcessor clickhouseProcessor = new ClickHouseDataSourceProcessor();
private static final DatasourceProcessor oracleProcessor = new OracleDatasourceProcessor(); private static final DataSourceProcessor oracleProcessor = new OracleDataSourceProcessor();
private static final DatasourceProcessor sqlServerProcessor = new SqlServerDatasourceProcessor(); private static final DataSourceProcessor sqlServerProcessor = new SQLServerDataSourceProcessor();
private static final DatasourceProcessor db2PROCESSOR = new Db2DatasourceProcessor(); private static final DataSourceProcessor db2PROCESSOR = new Db2DataSourceProcessor();
private static final DatasourceProcessor prestoPROCESSOR = new PrestoDatasourceProcessor(); private static final DataSourceProcessor prestoPROCESSOR = new PrestoDataSourceProcessor();
/** /**
* check datasource param * check datasource param
@ -86,7 +86,7 @@ public class DataSourceUtils {
return getDatasourceProcessor(dbType).createDatasourceParamDTO(connectionParams); return getDatasourceProcessor(dbType).createDatasourceParamDTO(connectionParams);
} }
public static DatasourceProcessor getDatasourceProcessor(DbType dbType) { public static DataSourceProcessor getDatasourceProcessor(DbType dbType) {
switch (dbType) { switch (dbType) {
case MYSQL: case MYSQL:
return mysqlProcessor; return mysqlProcessor;

10
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/client/CommonDataSourceClientTest.java

@ -17,8 +17,8 @@
package org.apache.dolphinscheduler.plugin.datasource.api.client; package org.apache.dolphinscheduler.plugin.datasource.api.client;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlConnectionParam; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MySQLConnectionParam;
import org.apache.dolphinscheduler.plugin.datasource.api.provider.JdbcDataSourceProvider; import org.apache.dolphinscheduler.plugin.datasource.api.provider.JDBCDataSourceProvider;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
@ -39,7 +39,7 @@ import com.zaxxer.hikari.HikariDataSource;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") @SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient")
@PrepareForTest(value = {HikariDataSource.class, CommonDataSourceClient.class, JdbcDataSourceProvider.class, JdbcTemplate.class, Connection.class}) @PrepareForTest(value = {HikariDataSource.class, CommonDataSourceClient.class, JDBCDataSourceProvider.class, JdbcTemplate.class, Connection.class})
public class CommonDataSourceClientTest { public class CommonDataSourceClientTest {
@Mock @Mock
@ -54,7 +54,7 @@ public class CommonDataSourceClientTest {
@Test @Test
public void testCheckEnv() { public void testCheckEnv() {
BaseConnectionParam baseConnectionParam = new MysqlConnectionParam(); BaseConnectionParam baseConnectionParam = new MySQLConnectionParam();
PowerMockito.doNothing().when(commonDataSourceClient).checkEnv(Mockito.any(BaseConnectionParam.class)); PowerMockito.doNothing().when(commonDataSourceClient).checkEnv(Mockito.any(BaseConnectionParam.class));
commonDataSourceClient.checkEnv(baseConnectionParam); commonDataSourceClient.checkEnv(baseConnectionParam);
Mockito.verify(commonDataSourceClient).checkEnv(Mockito.any(BaseConnectionParam.class)); Mockito.verify(commonDataSourceClient).checkEnv(Mockito.any(BaseConnectionParam.class));
@ -79,7 +79,7 @@ public class CommonDataSourceClientTest {
@Test @Test
public void testInitClient() { public void testInitClient() {
BaseConnectionParam baseConnectionParam = new MysqlConnectionParam(); BaseConnectionParam baseConnectionParam = new MySQLConnectionParam();
PowerMockito.doNothing().when(commonDataSourceClient).initClient(Mockito.any(BaseConnectionParam.class), Mockito.any()); PowerMockito.doNothing().when(commonDataSourceClient).initClient(Mockito.any(BaseConnectionParam.class), Mockito.any());
commonDataSourceClient.initClient(baseConnectionParam, DbType.MYSQL); commonDataSourceClient.initClient(baseConnectionParam, DbType.MYSQL);
Mockito.verify(commonDataSourceClient).initClient(Mockito.any(BaseConnectionParam.class), Mockito.any()); Mockito.verify(commonDataSourceClient).initClient(Mockito.any(BaseConnectionParam.class), Mockito.any());

12
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDatasourceProcessorTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/clickhouse/ClickHouseDataSourceProcessorTest.java

@ -38,15 +38,15 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) @PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class})
public class ClickHouseDatasourceProcessorTest { public class ClickHouseDataSourceProcessorTest {
private ClickHouseDatasourceProcessor clickHouseDatasourceProcessor = new ClickHouseDatasourceProcessor(); private ClickHouseDataSourceProcessor clickHouseDatasourceProcessor = new ClickHouseDataSourceProcessor();
@Test @Test
public void testCreateConnectionParams() { public void testCreateConnectionParams() {
Map<String, String> props = new HashMap<>(); Map<String, String> props = new HashMap<>();
props.put("serverTimezone", "utc"); props.put("serverTimezone", "utc");
ClickHouseDatasourceParamDTO clickhouseConnectionParam = new ClickHouseDatasourceParamDTO(); ClickHouseDataSourceParamDTO clickhouseConnectionParam = new ClickHouseDataSourceParamDTO();
clickhouseConnectionParam.setUserName("user"); clickhouseConnectionParam.setUserName("user");
clickhouseConnectionParam.setPassword("password"); clickhouseConnectionParam.setPassword("password");
clickhouseConnectionParam.setHost("localhost"); clickhouseConnectionParam.setHost("localhost");
@ -55,7 +55,7 @@ public class ClickHouseDatasourceProcessorTest {
clickhouseConnectionParam.setOther(props); clickhouseConnectionParam.setOther(props);
PowerMockito.mockStatic(PasswordUtils.class); PowerMockito.mockStatic(PasswordUtils.class);
PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test");
ClickhouseConnectionParam connectionParams = (ClickhouseConnectionParam) clickHouseDatasourceProcessor ClickHouseConnectionParam connectionParams = (ClickHouseConnectionParam) clickHouseDatasourceProcessor
.createConnectionParams(clickhouseConnectionParam); .createConnectionParams(clickhouseConnectionParam);
Assert.assertNotNull(connectionParams); Assert.assertNotNull(connectionParams);
Assert.assertEquals("jdbc:clickhouse://localhost:8123", connectionParams.getAddress()); Assert.assertEquals("jdbc:clickhouse://localhost:8123", connectionParams.getAddress());
@ -66,7 +66,7 @@ public class ClickHouseDatasourceProcessorTest {
public void testCreateConnectionParams2() { public void testCreateConnectionParams2() {
String connectionParamJson = "{\"address\":\"jdbc:clickhouse://localhost:8123\",\"database\":\"default\"," String connectionParamJson = "{\"address\":\"jdbc:clickhouse://localhost:8123\",\"database\":\"default\","
+ "\"jdbcUrl\":\"jdbc:clickhouse://localhost:8123/default\",\"user\":\"default\",\"password\":\"123456\"}"; + "\"jdbcUrl\":\"jdbc:clickhouse://localhost:8123/default\",\"user\":\"default\",\"password\":\"123456\"}";
ClickhouseConnectionParam clickhouseConnectionParam = (ClickhouseConnectionParam) clickHouseDatasourceProcessor ClickHouseConnectionParam clickhouseConnectionParam = (ClickHouseConnectionParam) clickHouseDatasourceProcessor
.createConnectionParams(connectionParamJson); .createConnectionParams(connectionParamJson);
Assert.assertNotNull(clickhouseConnectionParam); Assert.assertNotNull(clickhouseConnectionParam);
Assert.assertEquals("default", clickhouseConnectionParam.getUser()); Assert.assertEquals("default", clickhouseConnectionParam.getUser());
@ -81,7 +81,7 @@ public class ClickHouseDatasourceProcessorTest {
@Test @Test
public void testGetJdbcUrl() { public void testGetJdbcUrl() {
ClickhouseConnectionParam connectionParam = new ClickhouseConnectionParam(); ClickHouseConnectionParam connectionParam = new ClickHouseConnectionParam();
connectionParam.setUser("default"); connectionParam.setUser("default");
connectionParam.setJdbcUrl("jdbc:clickhouse://localhost:8123/default"); connectionParam.setJdbcUrl("jdbc:clickhouse://localhost:8123/default");
connectionParam.setOther("other=other1"); connectionParam.setOther("other=other1");

6
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DatasourceProcessorTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/db2/Db2DataSourceProcessorTest.java

@ -38,15 +38,15 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) @PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class})
public class Db2DatasourceProcessorTest { public class Db2DataSourceProcessorTest {
private Db2DatasourceProcessor db2DatasourceProcessor = new Db2DatasourceProcessor(); private Db2DataSourceProcessor db2DatasourceProcessor = new Db2DataSourceProcessor();
@Test @Test
public void testCreateConnectionParams() { public void testCreateConnectionParams() {
Map<String, String> props = new HashMap<>(); Map<String, String> props = new HashMap<>();
props.put("serverTimezone", "utc"); props.put("serverTimezone", "utc");
Db2DatasourceParamDTO db2DatasourceParamDTO = new Db2DatasourceParamDTO(); Db2DataSourceParamDTO db2DatasourceParamDTO = new Db2DataSourceParamDTO();
db2DatasourceParamDTO.setUserName("root"); db2DatasourceParamDTO.setUserName("root");
db2DatasourceParamDTO.setPassword("123456"); db2DatasourceParamDTO.setPassword("123456");
db2DatasourceParamDTO.setHost("localhost"); db2DatasourceParamDTO.setHost("localhost");

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDatasourceProcessorTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/hive/HiveDataSourceProcessorTest.java

@ -38,9 +38,9 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) @PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class})
public class HiveDatasourceProcessorTest { public class HiveDataSourceProcessorTest {
private HiveDatasourceProcessor hiveDatasourceProcessor = new HiveDatasourceProcessor(); private HiveDataSourceProcessor hiveDatasourceProcessor = new HiveDataSourceProcessor();
@Test @Test
public void testCreateConnectionParams() { public void testCreateConnectionParams() {

14
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MysqlDatasourceProcessorTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/mysql/MySQLDataSourceProcessorTest.java

@ -38,15 +38,15 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) @PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class})
public class MysqlDatasourceProcessorTest { public class MySQLDataSourceProcessorTest {
private MysqlDatasourceProcessor mysqlDatasourceProcessor = new MysqlDatasourceProcessor(); private MySQLDataSourceProcessor mysqlDatasourceProcessor = new MySQLDataSourceProcessor();
@Test @Test
public void testCreateConnectionParams() { public void testCreateConnectionParams() {
Map<String, String> props = new HashMap<>(); Map<String, String> props = new HashMap<>();
props.put("serverTimezone", "utc"); props.put("serverTimezone", "utc");
MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); MySQLDataSourceParamDTO mysqlDatasourceParamDTO = new MySQLDataSourceParamDTO();
mysqlDatasourceParamDTO.setUserName("root"); mysqlDatasourceParamDTO.setUserName("root");
mysqlDatasourceParamDTO.setPassword("123456"); mysqlDatasourceParamDTO.setPassword("123456");
mysqlDatasourceParamDTO.setHost("localhost"); mysqlDatasourceParamDTO.setHost("localhost");
@ -55,7 +55,7 @@ public class MysqlDatasourceProcessorTest {
mysqlDatasourceParamDTO.setOther(props); mysqlDatasourceParamDTO.setOther(props);
PowerMockito.mockStatic(PasswordUtils.class); PowerMockito.mockStatic(PasswordUtils.class);
PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test");
MysqlConnectionParam connectionParams = (MysqlConnectionParam) mysqlDatasourceProcessor MySQLConnectionParam connectionParams = (MySQLConnectionParam) mysqlDatasourceProcessor
.createConnectionParams(mysqlDatasourceParamDTO); .createConnectionParams(mysqlDatasourceParamDTO);
Assert.assertEquals("jdbc:mysql://localhost:3306", connectionParams.getAddress()); Assert.assertEquals("jdbc:mysql://localhost:3306", connectionParams.getAddress());
Assert.assertEquals("jdbc:mysql://localhost:3306/default", connectionParams.getJdbcUrl()); Assert.assertEquals("jdbc:mysql://localhost:3306/default", connectionParams.getJdbcUrl());
@ -65,7 +65,7 @@ public class MysqlDatasourceProcessorTest {
public void testCreateConnectionParams2() { public void testCreateConnectionParams2() {
String connectionJson = "{\"user\":\"root\",\"password\":\"123456\",\"address\":\"jdbc:mysql://localhost:3306\"" String connectionJson = "{\"user\":\"root\",\"password\":\"123456\",\"address\":\"jdbc:mysql://localhost:3306\""
+ ",\"database\":\"default\",\"jdbcUrl\":\"jdbc:mysql://localhost:3306/default\"}"; + ",\"database\":\"default\",\"jdbcUrl\":\"jdbc:mysql://localhost:3306/default\"}";
MysqlConnectionParam connectionParams = (MysqlConnectionParam) mysqlDatasourceProcessor MySQLConnectionParam connectionParams = (MySQLConnectionParam) mysqlDatasourceProcessor
.createConnectionParams(connectionJson); .createConnectionParams(connectionJson);
Assert.assertNotNull(connectionJson); Assert.assertNotNull(connectionJson);
Assert.assertEquals("root", connectionParams.getUser()); Assert.assertEquals("root", connectionParams.getUser());
@ -78,7 +78,7 @@ public class MysqlDatasourceProcessorTest {
@Test @Test
public void testGetJdbcUrl() { public void testGetJdbcUrl() {
MysqlConnectionParam mysqlConnectionParam = new MysqlConnectionParam(); MySQLConnectionParam mysqlConnectionParam = new MySQLConnectionParam();
mysqlConnectionParam.setJdbcUrl("jdbc:mysql://localhost:3306/default"); mysqlConnectionParam.setJdbcUrl("jdbc:mysql://localhost:3306/default");
Assert.assertEquals("jdbc:mysql://localhost:3306/default?allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false", Assert.assertEquals("jdbc:mysql://localhost:3306/default?allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false",
mysqlDatasourceProcessor.getJdbcUrl(mysqlConnectionParam)); mysqlDatasourceProcessor.getJdbcUrl(mysqlConnectionParam));
@ -96,7 +96,7 @@ public class MysqlDatasourceProcessorTest {
@Test @Test
public void testGetDatasourceUniqueId() { public void testGetDatasourceUniqueId() {
MysqlConnectionParam mysqlConnectionParam = new MysqlConnectionParam(); MySQLConnectionParam mysqlConnectionParam = new MySQLConnectionParam();
mysqlConnectionParam.setJdbcUrl("jdbc:mysql://localhost:3306/default"); mysqlConnectionParam.setJdbcUrl("jdbc:mysql://localhost:3306/default");
mysqlConnectionParam.setUser("root"); mysqlConnectionParam.setUser("root");
Assert.assertEquals("mysql@root@jdbc:mysql://localhost:3306/default", mysqlDatasourceProcessor.getDatasourceUniqueId(mysqlConnectionParam, DbType.MYSQL)); Assert.assertEquals("mysql@root@jdbc:mysql://localhost:3306/default", mysqlDatasourceProcessor.getDatasourceUniqueId(mysqlConnectionParam, DbType.MYSQL));

6
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDatasourceProcessorTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/oracle/OracleDataSourceProcessorTest.java

@ -39,15 +39,15 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) @PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class})
public class OracleDatasourceProcessorTest { public class OracleDataSourceProcessorTest {
private OracleDatasourceProcessor oracleDatasourceProcessor = new OracleDatasourceProcessor(); private OracleDataSourceProcessor oracleDatasourceProcessor = new OracleDataSourceProcessor();
@Test @Test
public void testCreateConnectionParams() { public void testCreateConnectionParams() {
Map<String, String> props = new HashMap<>(); Map<String, String> props = new HashMap<>();
props.put("serverTimezone", "utc"); props.put("serverTimezone", "utc");
OracleDatasourceParamDTO oracleDatasourceParamDTO = new OracleDatasourceParamDTO(); OracleDataSourceParamDTO oracleDatasourceParamDTO = new OracleDataSourceParamDTO();
oracleDatasourceParamDTO.setConnectType(DbConnectType.ORACLE_SID); oracleDatasourceParamDTO.setConnectType(DbConnectType.ORACLE_SID);
oracleDatasourceParamDTO.setHost("localhost"); oracleDatasourceParamDTO.setHost("localhost");
oracleDatasourceParamDTO.setPort(3308); oracleDatasourceParamDTO.setPort(3308);

12
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSqlDatasourceProcessorTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/postgresql/PostgreSQLDataSourceProcessorTest.java

@ -38,15 +38,15 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) @PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class})
public class PostgreSqlDatasourceProcessorTest { public class PostgreSQLDataSourceProcessorTest {
private PostgreSqlDatasourceProcessor postgreSqlDatasourceProcessor = new PostgreSqlDatasourceProcessor(); private PostgreSQLDataSourceProcessor postgreSqlDatasourceProcessor = new PostgreSQLDataSourceProcessor();
@Test @Test
public void testCreateConnectionParams() { public void testCreateConnectionParams() {
Map<String, String> props = new HashMap<>(); Map<String, String> props = new HashMap<>();
props.put("serverTimezone", "utc"); props.put("serverTimezone", "utc");
PostgreSqlDatasourceParamDTO postgreSqlDatasourceParamDTO = new PostgreSqlDatasourceParamDTO(); PostgreSQLDataSourceParamDTO postgreSqlDatasourceParamDTO = new PostgreSQLDataSourceParamDTO();
postgreSqlDatasourceParamDTO.setUserName("root"); postgreSqlDatasourceParamDTO.setUserName("root");
postgreSqlDatasourceParamDTO.setPassword("123456"); postgreSqlDatasourceParamDTO.setPassword("123456");
postgreSqlDatasourceParamDTO.setHost("localhost"); postgreSqlDatasourceParamDTO.setHost("localhost");
@ -55,7 +55,7 @@ public class PostgreSqlDatasourceProcessorTest {
postgreSqlDatasourceParamDTO.setOther(props); postgreSqlDatasourceParamDTO.setOther(props);
PowerMockito.mockStatic(PasswordUtils.class); PowerMockito.mockStatic(PasswordUtils.class);
PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test");
PostgreSqlConnectionParam connectionParams = (PostgreSqlConnectionParam) postgreSqlDatasourceProcessor PostgreSQLConnectionParam connectionParams = (PostgreSQLConnectionParam) postgreSqlDatasourceProcessor
.createConnectionParams(postgreSqlDatasourceParamDTO); .createConnectionParams(postgreSqlDatasourceParamDTO);
Assert.assertEquals("jdbc:postgresql://localhost:3308", connectionParams.getAddress()); Assert.assertEquals("jdbc:postgresql://localhost:3308", connectionParams.getAddress());
Assert.assertEquals("jdbc:postgresql://localhost:3308/default", connectionParams.getJdbcUrl()); Assert.assertEquals("jdbc:postgresql://localhost:3308/default", connectionParams.getJdbcUrl());
@ -66,7 +66,7 @@ public class PostgreSqlDatasourceProcessorTest {
public void testCreateConnectionParams2() { public void testCreateConnectionParams2() {
String connectionJson = "{\"user\":\"root\",\"password\":\"123456\",\"address\":\"jdbc:postgresql://localhost:3308\"" String connectionJson = "{\"user\":\"root\",\"password\":\"123456\",\"address\":\"jdbc:postgresql://localhost:3308\""
+ ",\"database\":\"default\",\"jdbcUrl\":\"jdbc:postgresql://localhost:3308/default\"}"; + ",\"database\":\"default\",\"jdbcUrl\":\"jdbc:postgresql://localhost:3308/default\"}";
PostgreSqlConnectionParam connectionParams = (PostgreSqlConnectionParam) postgreSqlDatasourceProcessor PostgreSQLConnectionParam connectionParams = (PostgreSQLConnectionParam) postgreSqlDatasourceProcessor
.createConnectionParams(connectionJson); .createConnectionParams(connectionJson);
Assert.assertNotNull(connectionParams); Assert.assertNotNull(connectionParams);
Assert.assertEquals("root", connectionParams.getUser()); Assert.assertEquals("root", connectionParams.getUser());
@ -79,7 +79,7 @@ public class PostgreSqlDatasourceProcessorTest {
@Test @Test
public void testGetJdbcUrl() { public void testGetJdbcUrl() {
PostgreSqlConnectionParam postgreSqlConnectionParam = new PostgreSqlConnectionParam(); PostgreSQLConnectionParam postgreSqlConnectionParam = new PostgreSQLConnectionParam();
postgreSqlConnectionParam.setJdbcUrl("jdbc:postgresql://localhost:3308/default"); postgreSqlConnectionParam.setJdbcUrl("jdbc:postgresql://localhost:3308/default");
postgreSqlConnectionParam.setOther("other"); postgreSqlConnectionParam.setOther("other");

6
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDatasourceProcessorTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/presto/PrestoDataSourceProcessorTest.java

@ -38,15 +38,15 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) @PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class})
public class PrestoDatasourceProcessorTest { public class PrestoDataSourceProcessorTest {
private PrestoDatasourceProcessor prestoDatasourceProcessor = new PrestoDatasourceProcessor(); private PrestoDataSourceProcessor prestoDatasourceProcessor = new PrestoDataSourceProcessor();
@Test @Test
public void testCreateConnectionParams() { public void testCreateConnectionParams() {
Map<String, String> props = new HashMap<>(); Map<String, String> props = new HashMap<>();
props.put("serverTimezone", "utc"); props.put("serverTimezone", "utc");
PrestoDatasourceParamDTO prestoDatasourceParamDTO = new PrestoDatasourceParamDTO(); PrestoDataSourceParamDTO prestoDatasourceParamDTO = new PrestoDataSourceParamDTO();
prestoDatasourceParamDTO.setHost("localhost"); prestoDatasourceParamDTO.setHost("localhost");
prestoDatasourceParamDTO.setPort(1234); prestoDatasourceParamDTO.setPort(1234);
prestoDatasourceParamDTO.setDatabase("default"); prestoDatasourceParamDTO.setDatabase("default");

6
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDatasourceProcessorTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/spark/SparkDataSourceProcessorTest.java

@ -38,15 +38,15 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) @PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class})
public class SparkDatasourceProcessorTest { public class SparkDataSourceProcessorTest {
private SparkDatasourceProcessor sparkDatasourceProcessor = new SparkDatasourceProcessor(); private SparkDataSourceProcessor sparkDatasourceProcessor = new SparkDataSourceProcessor();
@Test @Test
public void testCreateConnectionParams() { public void testCreateConnectionParams() {
Map<String, String> props = new HashMap<>(); Map<String, String> props = new HashMap<>();
props.put("serverTimezone", "utc"); props.put("serverTimezone", "utc");
SparkDatasourceParamDTO sparkDatasourceParamDTO = new SparkDatasourceParamDTO(); SparkDataSourceParamDTO sparkDatasourceParamDTO = new SparkDataSourceParamDTO();
sparkDatasourceParamDTO.setUserName("root"); sparkDatasourceParamDTO.setUserName("root");
sparkDatasourceParamDTO.setPassword("12345"); sparkDatasourceParamDTO.setPassword("12345");
sparkDatasourceParamDTO.setHost("localhost1,localhost2"); sparkDatasourceParamDTO.setHost("localhost1,localhost2");

12
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SqlServerDatasourceProcessorTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/sqlserver/SQLServerDataSourceProcessorTest.java

@ -39,15 +39,15 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class}) @PrepareForTest({Class.class, DriverManager.class, DataSourceUtils.class, CommonUtils.class, DataSourceClientProvider.class, PasswordUtils.class})
public class SqlServerDatasourceProcessorTest { public class SQLServerDataSourceProcessorTest {
private SqlServerDatasourceProcessor sqlServerDatasourceProcessor = new SqlServerDatasourceProcessor(); private SQLServerDataSourceProcessor sqlServerDatasourceProcessor = new SQLServerDataSourceProcessor();
@Test @Test
public void testCreateConnectionParams() { public void testCreateConnectionParams() {
Map<String, String> props = new HashMap<>(); Map<String, String> props = new HashMap<>();
props.put("serverTimezone", "utc"); props.put("serverTimezone", "utc");
SqlServerDatasourceParamDTO sqlServerDatasourceParamDTO = new SqlServerDatasourceParamDTO(); SQLServerDataSourceParamDTO sqlServerDatasourceParamDTO = new SQLServerDataSourceParamDTO();
sqlServerDatasourceParamDTO.setUserName("root"); sqlServerDatasourceParamDTO.setUserName("root");
sqlServerDatasourceParamDTO.setPassword("123456"); sqlServerDatasourceParamDTO.setPassword("123456");
sqlServerDatasourceParamDTO.setDatabase("default"); sqlServerDatasourceParamDTO.setDatabase("default");
@ -56,7 +56,7 @@ public class SqlServerDatasourceProcessorTest {
sqlServerDatasourceParamDTO.setOther(props); sqlServerDatasourceParamDTO.setOther(props);
PowerMockito.mockStatic(PasswordUtils.class); PowerMockito.mockStatic(PasswordUtils.class);
PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test"); PowerMockito.when(PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test");
SqlServerConnectionParam connectionParams = (SqlServerConnectionParam) sqlServerDatasourceProcessor SQLServerConnectionParam connectionParams = (SQLServerConnectionParam) sqlServerDatasourceProcessor
.createConnectionParams(sqlServerDatasourceParamDTO); .createConnectionParams(sqlServerDatasourceParamDTO);
Assert.assertEquals("jdbc:sqlserver://localhost:1234", connectionParams.getAddress()); Assert.assertEquals("jdbc:sqlserver://localhost:1234", connectionParams.getAddress());
Assert.assertEquals("jdbc:sqlserver://localhost:1234;databaseName=default", connectionParams.getJdbcUrl()); Assert.assertEquals("jdbc:sqlserver://localhost:1234;databaseName=default", connectionParams.getJdbcUrl());
@ -67,7 +67,7 @@ public class SqlServerDatasourceProcessorTest {
public void testCreateConnectionParams2() { public void testCreateConnectionParams2() {
String connectionJson = "{\"user\":\"root\",\"password\":\"123456\",\"address\":\"jdbc:sqlserver://localhost:1234\"" String connectionJson = "{\"user\":\"root\",\"password\":\"123456\",\"address\":\"jdbc:sqlserver://localhost:1234\""
+ ",\"database\":\"default\",\"jdbcUrl\":\"jdbc:sqlserver://localhost:1234;databaseName=default\"}"; + ",\"database\":\"default\",\"jdbcUrl\":\"jdbc:sqlserver://localhost:1234;databaseName=default\"}";
SqlServerConnectionParam sqlServerConnectionParam = JSONUtils.parseObject(connectionJson, SqlServerConnectionParam.class); SQLServerConnectionParam sqlServerConnectionParam = JSONUtils.parseObject(connectionJson, SQLServerConnectionParam.class);
Assert.assertNotNull(sqlServerConnectionParam); Assert.assertNotNull(sqlServerConnectionParam);
Assert.assertEquals("root", sqlServerConnectionParam.getUser()); Assert.assertEquals("root", sqlServerConnectionParam.getUser());
} }
@ -79,7 +79,7 @@ public class SqlServerDatasourceProcessorTest {
@Test @Test
public void testGetJdbcUrl() { public void testGetJdbcUrl() {
SqlServerConnectionParam sqlServerConnectionParam = new SqlServerConnectionParam(); SQLServerConnectionParam sqlServerConnectionParam = new SQLServerConnectionParam();
sqlServerConnectionParam.setJdbcUrl("jdbc:sqlserver://localhost:1234;databaseName=default"); sqlServerConnectionParam.setJdbcUrl("jdbc:sqlserver://localhost:1234;databaseName=default");
sqlServerConnectionParam.setOther("other"); sqlServerConnectionParam.setOther("other");
Assert.assertEquals("jdbc:sqlserver://localhost:1234;databaseName=default;other", Assert.assertEquals("jdbc:sqlserver://localhost:1234;databaseName=default;other",

18
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProviderTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JDBCDataSourceProviderTest.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.api.provider; package org.apache.dolphinscheduler.plugin.datasource.api.provider;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlConnectionParam; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MySQLConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
import org.junit.Assert; import org.junit.Assert;
@ -31,23 +31,23 @@ import org.powermock.modules.junit4.PowerMockRunner;
import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.HikariDataSource;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest(value = {HikariDataSource.class, JdbcDataSourceProvider.class}) @PrepareForTest(value = {HikariDataSource.class, JDBCDataSourceProvider.class})
public class JdbcDataSourceProviderTest { public class JDBCDataSourceProviderTest {
@Test @Test
public void testCreateJdbcDataSource() { public void testCreateJdbcDataSource() {
PowerMockito.mockStatic(JdbcDataSourceProvider.class); PowerMockito.mockStatic(JDBCDataSourceProvider.class);
HikariDataSource dataSource = PowerMockito.mock(HikariDataSource.class); HikariDataSource dataSource = PowerMockito.mock(HikariDataSource.class);
PowerMockito.when(JdbcDataSourceProvider.createJdbcDataSource(Mockito.any(), Mockito.any())).thenReturn(dataSource); PowerMockito.when(JDBCDataSourceProvider.createJdbcDataSource(Mockito.any(), Mockito.any())).thenReturn(dataSource);
Assert.assertNotNull(JdbcDataSourceProvider.createJdbcDataSource(new MysqlConnectionParam(), DbType.MYSQL)); Assert.assertNotNull(JDBCDataSourceProvider.createJdbcDataSource(new MySQLConnectionParam(), DbType.MYSQL));
} }
@Test @Test
public void testCreateOneSessionJdbcDataSource() { public void testCreateOneSessionJdbcDataSource() {
PowerMockito.mockStatic(JdbcDataSourceProvider.class); PowerMockito.mockStatic(JDBCDataSourceProvider.class);
HikariDataSource dataSource = PowerMockito.mock(HikariDataSource.class); HikariDataSource dataSource = PowerMockito.mock(HikariDataSource.class);
PowerMockito.when(JdbcDataSourceProvider.createOneSessionJdbcDataSource(Mockito.any())).thenReturn(dataSource); PowerMockito.when(JDBCDataSourceProvider.createOneSessionJdbcDataSource(Mockito.any())).thenReturn(dataSource);
Assert.assertNotNull(JdbcDataSourceProvider.createOneSessionJdbcDataSource(new MysqlConnectionParam())); Assert.assertNotNull(JDBCDataSourceProvider.createOneSessionJdbcDataSource(new MySQLConnectionParam()));
} }
} }

20
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DataSourceUtilsTest.java

@ -17,9 +17,9 @@
package org.apache.dolphinscheduler.plugin.datasource.api.utils; package org.apache.dolphinscheduler.plugin.datasource.api.utils;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlConnectionParam; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MySQLConnectionParam;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceParamDTO; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MySQLDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlDatasourceProcessor; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MySQLDataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider;
import org.apache.dolphinscheduler.spi.datasource.ConnectionParam; import org.apache.dolphinscheduler.spi.datasource.ConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
@ -39,12 +39,12 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({Class.class, DriverManager.class, MysqlDatasourceProcessor.class, DataSourceClientProvider.class, PasswordUtils.class, CommonUtils.class}) @PrepareForTest({Class.class, DriverManager.class, MySQLDataSourceProcessor.class, DataSourceClientProvider.class, PasswordUtils.class, CommonUtils.class})
public class DataSourceUtilsTest { public class DataSourceUtilsTest {
@Test @Test
public void testCheckDatasourceParam() { public void testCheckDatasourceParam() {
MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); MySQLDataSourceParamDTO mysqlDatasourceParamDTO = new MySQLDataSourceParamDTO();
mysqlDatasourceParamDTO.setHost("localhost"); mysqlDatasourceParamDTO.setHost("localhost");
mysqlDatasourceParamDTO.setDatabase("default"); mysqlDatasourceParamDTO.setDatabase("default");
Map<String, String> other = new HashMap<>(); Map<String, String> other = new HashMap<>();
@ -58,7 +58,7 @@ public class DataSourceUtilsTest {
@Test @Test
public void testBuildConnectionParams() { public void testBuildConnectionParams() {
MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); MySQLDataSourceParamDTO mysqlDatasourceParamDTO = new MySQLDataSourceParamDTO();
mysqlDatasourceParamDTO.setHost("localhost"); mysqlDatasourceParamDTO.setHost("localhost");
mysqlDatasourceParamDTO.setDatabase("default"); mysqlDatasourceParamDTO.setDatabase("default");
mysqlDatasourceParamDTO.setUserName("root"); mysqlDatasourceParamDTO.setUserName("root");
@ -74,7 +74,7 @@ public class DataSourceUtilsTest {
@Test @Test
public void testBuildConnectionParams2() { public void testBuildConnectionParams2() {
MysqlDatasourceParamDTO mysqlDatasourceParamDTO = new MysqlDatasourceParamDTO(); MySQLDataSourceParamDTO mysqlDatasourceParamDTO = new MySQLDataSourceParamDTO();
mysqlDatasourceParamDTO.setHost("localhost"); mysqlDatasourceParamDTO.setHost("localhost");
mysqlDatasourceParamDTO.setDatabase("default"); mysqlDatasourceParamDTO.setDatabase("default");
mysqlDatasourceParamDTO.setUserName("root"); mysqlDatasourceParamDTO.setUserName("root");
@ -94,7 +94,7 @@ public class DataSourceUtilsTest {
Connection connection = PowerMockito.mock(Connection.class); Connection connection = PowerMockito.mock(Connection.class);
PowerMockito.when(clientProvider.getConnection(Mockito.any(), Mockito.any())).thenReturn(connection); PowerMockito.when(clientProvider.getConnection(Mockito.any(), Mockito.any())).thenReturn(connection);
MysqlConnectionParam connectionParam = new MysqlConnectionParam(); MySQLConnectionParam connectionParam = new MySQLConnectionParam();
connectionParam.setUser("root"); connectionParam.setUser("root");
connectionParam.setPassword("123456"); connectionParam.setPassword("123456");
connection = DataSourceClientProvider.getInstance().getConnection(DbType.MYSQL, connectionParam); connection = DataSourceClientProvider.getInstance().getConnection(DbType.MYSQL, connectionParam);
@ -105,7 +105,7 @@ public class DataSourceUtilsTest {
@Test @Test
public void testGetJdbcUrl() { public void testGetJdbcUrl() {
MysqlConnectionParam mysqlConnectionParam = new MysqlConnectionParam(); MySQLConnectionParam mysqlConnectionParam = new MySQLConnectionParam();
mysqlConnectionParam.setJdbcUrl("jdbc:mysql://localhost:3308"); mysqlConnectionParam.setJdbcUrl("jdbc:mysql://localhost:3308");
String jdbcUrl = DataSourceUtils.getJdbcUrl(DbType.MYSQL, mysqlConnectionParam); String jdbcUrl = DataSourceUtils.getJdbcUrl(DbType.MYSQL, mysqlConnectionParam);
Assert.assertEquals("jdbc:mysql://localhost:3308?allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false", Assert.assertEquals("jdbc:mysql://localhost:3308?allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false",
@ -114,7 +114,7 @@ public class DataSourceUtilsTest {
@Test @Test
public void testBuildDatasourceParamDTO() { public void testBuildDatasourceParamDTO() {
MysqlConnectionParam connectionParam = new MysqlConnectionParam(); MySQLConnectionParam connectionParam = new MySQLConnectionParam();
connectionParam.setJdbcUrl("jdbc:mysql://localhost:3308?allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false"); connectionParam.setJdbcUrl("jdbc:mysql://localhost:3308?allowLoadLocalInfile=false&autoDeserialize=false&allowLocalInfile=false&allowUrlInLocalInfile=false");
connectionParam.setAddress("jdbc:mysql://localhost:3308"); connectionParam.setAddress("jdbc:mysql://localhost:3308");
connectionParam.setUser("root"); connectionParam.setUser("root");

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannel.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickHouseDataSourceChannel.java

@ -22,10 +22,10 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; import org.apache.dolphinscheduler.spi.datasource.DataSourceClient;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class ClickhouseDataSourceChannel implements DataSourceChannel { public class ClickHouseDataSourceChannel implements DataSourceChannel {
@Override @Override
public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
return new ClickhouseDataSourceClient(baseConnectionParam, dbType); return new ClickHouseDataSourceClient(baseConnectionParam, dbType);
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelFactory.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickHouseDataSourceChannelFactory.java

@ -23,7 +23,7 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
@AutoService(DataSourceChannelFactory.class) @AutoService(DataSourceChannelFactory.class)
public class ClickhouseDataSourceChannelFactory implements DataSourceChannelFactory { public class ClickHouseDataSourceChannelFactory implements DataSourceChannelFactory {
@Override @Override
public String getName() { public String getName() {
return "clickhouse"; return "clickhouse";
@ -31,6 +31,6 @@ public class ClickhouseDataSourceChannelFactory implements DataSourceChannelFact
@Override @Override
public DataSourceChannel create() { public DataSourceChannel create() {
return new ClickhouseDataSourceChannel(); return new ClickHouseDataSourceChannel();
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceClient.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/main/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickHouseDataSourceClient.java

@ -21,9 +21,9 @@ import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSource
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class ClickhouseDataSourceClient extends CommonDataSourceClient { public class ClickHouseDataSourceClient extends CommonDataSourceClient {
public ClickhouseDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { public ClickHouseDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
super(baseConnectionParam, dbType); super(baseConnectionParam, dbType);
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelFactoryTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickHouseDataSourceChannelFactoryTest.java

@ -22,11 +22,11 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class ClickhouseDataSourceChannelFactoryTest { public class ClickHouseDataSourceChannelFactoryTest {
@Test @Test
public void testCreate() { public void testCreate() {
ClickhouseDataSourceChannelFactory sourceChannelFactory = new ClickhouseDataSourceChannelFactory(); ClickHouseDataSourceChannelFactory sourceChannelFactory = new ClickHouseDataSourceChannelFactory();
DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); DataSourceChannel dataSourceChannel = sourceChannelFactory.create();
Assert.assertNotNull(dataSourceChannel); Assert.assertNotNull(dataSourceChannel);
} }

12
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickhouseDataSourceChannelTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-clickhouse/src/test/java/org/apache/dolphinscheduler/plugin/datasource/clickhouse/ClickHouseDataSourceChannelTest.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.clickhouse; package org.apache.dolphinscheduler.plugin.datasource.clickhouse;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse.ClickhouseConnectionParam; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.clickhouse.ClickHouseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
import org.junit.Assert; import org.junit.Assert;
@ -31,14 +31,14 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") @SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient")
@PrepareForTest({ClickhouseDataSourceClient.class, ClickhouseDataSourceChannel.class}) @PrepareForTest({ClickHouseDataSourceClient.class, ClickHouseDataSourceChannel.class})
public class ClickhouseDataSourceChannelTest { public class ClickHouseDataSourceChannelTest {
@Test @Test
public void testCreateDataSourceClient() { public void testCreateDataSourceClient() {
ClickhouseDataSourceChannel sourceChannel = PowerMockito.mock(ClickhouseDataSourceChannel.class); ClickHouseDataSourceChannel sourceChannel = PowerMockito.mock(ClickHouseDataSourceChannel.class);
ClickhouseDataSourceClient dataSourceClient = PowerMockito.mock(ClickhouseDataSourceClient.class); ClickHouseDataSourceClient dataSourceClient = PowerMockito.mock(ClickHouseDataSourceClient.class);
PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any(), Mockito.any())).thenReturn(dataSourceClient); PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any(), Mockito.any())).thenReturn(dataSourceClient);
Assert.assertNotNull(sourceChannel.createDataSourceClient(new ClickhouseConnectionParam(), DbType.CLICKHOUSE)); Assert.assertNotNull(sourceChannel.createDataSourceClient(new ClickHouseConnectionParam(), DbType.CLICKHOUSE));
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java

@ -21,7 +21,7 @@ import static org.apache.dolphinscheduler.spi.task.TaskConstants.JAVA_SECURITY_K
import static org.apache.dolphinscheduler.spi.task.TaskConstants.JAVA_SECURITY_KRB5_CONF_PATH; import static org.apache.dolphinscheduler.spi.task.TaskConstants.JAVA_SECURITY_KRB5_CONF_PATH;
import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient; import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient;
import org.apache.dolphinscheduler.plugin.datasource.api.provider.JdbcDataSourceProvider; import org.apache.dolphinscheduler.plugin.datasource.api.provider.JDBCDataSourceProvider;
import org.apache.dolphinscheduler.plugin.datasource.utils.CommonUtil; import org.apache.dolphinscheduler.plugin.datasource.utils.CommonUtil;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
@ -78,7 +78,7 @@ public class HiveDataSourceClient extends CommonDataSourceClient {
logger.info("Create ugi success."); logger.info("Create ugi success.");
super.initClient(baseConnectionParam, dbType); super.initClient(baseConnectionParam, dbType);
this.oneSessionDataSource = JdbcDataSourceProvider.createOneSessionJdbcDataSource(baseConnectionParam); this.oneSessionDataSource = JDBCDataSourceProvider.createOneSessionJdbcDataSource(baseConnectionParam);
logger.info("Init {} success.", getClass().getName()); logger.info("Init {} success.", getClass().getName());
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannel.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MySQLDataSourceChannel.java

@ -22,10 +22,10 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; import org.apache.dolphinscheduler.spi.datasource.DataSourceClient;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class MysqlDataSourceChannel implements DataSourceChannel { public class MySQLDataSourceChannel implements DataSourceChannel {
@Override @Override
public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
return new MysqlDataSourceClient(baseConnectionParam, dbType); return new MySQLDataSourceClient(baseConnectionParam, dbType);
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelFactory.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MySQLDataSourceChannelFactory.java

@ -23,7 +23,7 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
@AutoService(DataSourceChannelFactory.class) @AutoService(DataSourceChannelFactory.class)
public class MysqlDataSourceChannelFactory implements DataSourceChannelFactory { public class MySQLDataSourceChannelFactory implements DataSourceChannelFactory {
@Override @Override
public String getName() { public String getName() {
return "mysql"; return "mysql";
@ -31,6 +31,6 @@ public class MysqlDataSourceChannelFactory implements DataSourceChannelFactory {
@Override @Override
public DataSourceChannel create() { public DataSourceChannel create() {
return new MysqlDataSourceChannel(); return new MySQLDataSourceChannel();
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceClient.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MySQLDataSourceClient.java

@ -21,9 +21,9 @@ import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSource
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class MysqlDataSourceClient extends CommonDataSourceClient { public class MySQLDataSourceClient extends CommonDataSourceClient {
public MysqlDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { public MySQLDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
super(baseConnectionParam, dbType); super(baseConnectionParam, dbType);
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelFactoryTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MySQLDataSourceChannelFactoryTest.java

@ -22,11 +22,11 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class MysqlDataSourceChannelFactoryTest { public class MySQLDataSourceChannelFactoryTest {
@Test @Test
public void testCreate() { public void testCreate() {
MysqlDataSourceChannelFactory sourceChannelFactory = new MysqlDataSourceChannelFactory(); MySQLDataSourceChannelFactory sourceChannelFactory = new MySQLDataSourceChannelFactory();
DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); DataSourceChannel dataSourceChannel = sourceChannelFactory.create();
Assert.assertNotNull(dataSourceChannel); Assert.assertNotNull(dataSourceChannel);
} }

12
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MysqlDataSourceChannelTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-mysql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/mysql/MySQLDataSourceChannelTest.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.mysql; package org.apache.dolphinscheduler.plugin.datasource.mysql;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MysqlConnectionParam; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.mysql.MySQLConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
import org.junit.Assert; import org.junit.Assert;
@ -31,14 +31,14 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") @SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient")
@PrepareForTest({MysqlDataSourceClient.class, MysqlDataSourceChannel.class}) @PrepareForTest({MySQLDataSourceClient.class, MySQLDataSourceChannel.class})
public class MysqlDataSourceChannelTest { public class MySQLDataSourceChannelTest {
@Test @Test
public void testCreateDataSourceClient() { public void testCreateDataSourceClient() {
MysqlDataSourceChannel sourceChannel = PowerMockito.mock(MysqlDataSourceChannel.class); MySQLDataSourceChannel sourceChannel = PowerMockito.mock(MySQLDataSourceChannel.class);
MysqlDataSourceClient dataSourceClient = PowerMockito.mock(MysqlDataSourceClient.class); MySQLDataSourceClient dataSourceClient = PowerMockito.mock(MySQLDataSourceClient.class);
PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any(), Mockito.any())).thenReturn(dataSourceClient); PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any(), Mockito.any())).thenReturn(dataSourceClient);
Assert.assertNotNull(sourceChannel.createDataSourceClient(new MysqlConnectionParam(), DbType.MYSQL)); Assert.assertNotNull(sourceChannel.createDataSourceClient(new MySQLConnectionParam(), DbType.MYSQL));
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannel.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgreSQLDataSourceChannel.java

@ -22,10 +22,10 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; import org.apache.dolphinscheduler.spi.datasource.DataSourceClient;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class PostgresqlDataSourceChannel implements DataSourceChannel { public class PostgreSQLDataSourceChannel implements DataSourceChannel {
@Override @Override
public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
return new PostgresqlDataSourceClient(baseConnectionParam, dbType); return new PostgreSQLDataSourceClient(baseConnectionParam, dbType);
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelFactory.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgreSQLDataSourceChannelFactory.java

@ -23,7 +23,7 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
@AutoService(DataSourceChannelFactory.class) @AutoService(DataSourceChannelFactory.class)
public class PostgresqlDataSourceChannelFactory implements DataSourceChannelFactory { public class PostgreSQLDataSourceChannelFactory implements DataSourceChannelFactory {
@Override @Override
public String getName() { public String getName() {
return "postgresql"; return "postgresql";
@ -31,6 +31,6 @@ public class PostgresqlDataSourceChannelFactory implements DataSourceChannelFact
@Override @Override
public DataSourceChannel create() { public DataSourceChannel create() {
return new PostgresqlDataSourceChannel(); return new PostgreSQLDataSourceChannel();
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceClient.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/main/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgreSQLDataSourceClient.java

@ -21,9 +21,9 @@ import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSource
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class PostgresqlDataSourceClient extends CommonDataSourceClient { public class PostgreSQLDataSourceClient extends CommonDataSourceClient {
public PostgresqlDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { public PostgreSQLDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
super(baseConnectionParam, dbType); super(baseConnectionParam, dbType);
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelFactoryTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgreSQLDataSourceChannelFactoryTest.java

@ -22,11 +22,11 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class PostgresqlDataSourceChannelFactoryTest { public class PostgreSQLDataSourceChannelFactoryTest {
@Test @Test
public void testCreate() { public void testCreate() {
PostgresqlDataSourceChannelFactory sourceChannelFactory = new PostgresqlDataSourceChannelFactory(); PostgreSQLDataSourceChannelFactory sourceChannelFactory = new PostgreSQLDataSourceChannelFactory();
DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); DataSourceChannel dataSourceChannel = sourceChannelFactory.create();
Assert.assertNotNull(dataSourceChannel); Assert.assertNotNull(dataSourceChannel);
} }

12
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgresqlDataSourceChannelTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-postgresql/src/test/java/org/apache/dolphinscheduler/plugin/datasource/postgresql/PostgreSQLDataSourceChannelTest.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.postgresql; package org.apache.dolphinscheduler.plugin.datasource.postgresql;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSqlConnectionParam; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.postgresql.PostgreSQLConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
import org.junit.Assert; import org.junit.Assert;
@ -31,14 +31,14 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") @SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient")
@PrepareForTest({PostgresqlDataSourceClient.class, PostgresqlDataSourceChannel.class}) @PrepareForTest({PostgreSQLDataSourceClient.class, PostgreSQLDataSourceChannel.class})
public class PostgresqlDataSourceChannelTest { public class PostgreSQLDataSourceChannelTest {
@Test @Test
public void testCreateDataSourceClient() { public void testCreateDataSourceClient() {
PostgresqlDataSourceChannel sourceChannel = PowerMockito.mock(PostgresqlDataSourceChannel.class); PostgreSQLDataSourceChannel sourceChannel = PowerMockito.mock(PostgreSQLDataSourceChannel.class);
PostgresqlDataSourceClient dataSourceClient = PowerMockito.mock(PostgresqlDataSourceClient.class); PostgreSQLDataSourceClient dataSourceClient = PowerMockito.mock(PostgreSQLDataSourceClient.class);
PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any(), Mockito.any())).thenReturn(dataSourceClient); PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any(), Mockito.any())).thenReturn(dataSourceClient);
Assert.assertNotNull(sourceChannel.createDataSourceClient(new PostgreSqlConnectionParam(), DbType.POSTGRESQL)); Assert.assertNotNull(sourceChannel.createDataSourceClient(new PostgreSQLConnectionParam(), DbType.POSTGRESQL));
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlServerDataSourceChannel.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SQLServerDataSourceChannel.java

@ -22,10 +22,10 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceClient; import org.apache.dolphinscheduler.spi.datasource.DataSourceClient;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class SqlServerDataSourceChannel implements DataSourceChannel { public class SQLServerDataSourceChannel implements DataSourceChannel {
@Override @Override
public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
return new SqlserverDataSourceClient(baseConnectionParam, dbType); return new SQLServerDataSourceClient(baseConnectionParam, dbType);
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlServerDataSourceChannelFactory.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SQLServerDataSourceChannelFactory.java

@ -23,7 +23,7 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
@AutoService(DataSourceChannelFactory.class) @AutoService(DataSourceChannelFactory.class)
public class SqlServerDataSourceChannelFactory implements DataSourceChannelFactory { public class SQLServerDataSourceChannelFactory implements DataSourceChannelFactory {
@Override @Override
public String getName() { public String getName() {
return "sqlserver"; return "sqlserver";
@ -31,6 +31,6 @@ public class SqlServerDataSourceChannelFactory implements DataSourceChannelFacto
@Override @Override
public DataSourceChannel create() { public DataSourceChannel create() {
return new SqlServerDataSourceChannel(); return new SQLServerDataSourceChannel();
} }
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceClient.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/main/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SQLServerDataSourceClient.java

@ -21,9 +21,9 @@ import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSource
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
public class SqlserverDataSourceClient extends CommonDataSourceClient { public class SQLServerDataSourceClient extends CommonDataSourceClient {
public SqlserverDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) { public SQLServerDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
super(baseConnectionParam, dbType); super(baseConnectionParam, dbType);
} }

4
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceChannelFactoryTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SQLServerDataSourceChannelFactoryTest.java

@ -22,11 +22,11 @@ import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
public class SqlserverDataSourceChannelFactoryTest { public class SQLServerDataSourceChannelFactoryTest {
@Test @Test
public void testCreate() { public void testCreate() {
SqlServerDataSourceChannelFactory sourceChannelFactory = new SqlServerDataSourceChannelFactory(); SQLServerDataSourceChannelFactory sourceChannelFactory = new SQLServerDataSourceChannelFactory();
DataSourceChannel dataSourceChannel = sourceChannelFactory.create(); DataSourceChannel dataSourceChannel = sourceChannelFactory.create();
Assert.assertNotNull(dataSourceChannel); Assert.assertNotNull(dataSourceChannel);
} }

12
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SqlserverDataSourceChannelTest.java → dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-sqlserver/src/test/java/org/apache/dolphinscheduler/plugin/datasource/sqlserver/SQLServerDataSourceChannelTest.java

@ -17,7 +17,7 @@
package org.apache.dolphinscheduler.plugin.datasource.sqlserver; package org.apache.dolphinscheduler.plugin.datasource.sqlserver;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver.SqlServerConnectionParam; import org.apache.dolphinscheduler.plugin.datasource.api.datasource.sqlserver.SQLServerConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.DbType;
import org.junit.Assert; import org.junit.Assert;
@ -31,14 +31,14 @@ import org.powermock.modules.junit4.PowerMockRunner;
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient") @SuppressStaticInitializationFor("org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient")
@PrepareForTest({SqlserverDataSourceClient.class, SqlServerDataSourceChannel.class}) @PrepareForTest({SQLServerDataSourceClient.class, SQLServerDataSourceChannel.class})
public class SqlserverDataSourceChannelTest { public class SQLServerDataSourceChannelTest {
@Test @Test
public void testCreateDataSourceClient() { public void testCreateDataSourceClient() {
SqlServerDataSourceChannel sourceChannel = PowerMockito.mock(SqlServerDataSourceChannel.class); SQLServerDataSourceChannel sourceChannel = PowerMockito.mock(SQLServerDataSourceChannel.class);
SqlserverDataSourceClient dataSourceClient = PowerMockito.mock(SqlserverDataSourceClient.class); SQLServerDataSourceClient dataSourceClient = PowerMockito.mock(SQLServerDataSourceClient.class);
PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any(), Mockito.any())).thenReturn(dataSourceClient); PowerMockito.when(sourceChannel.createDataSourceClient(Mockito.any(), Mockito.any())).thenReturn(dataSourceClient);
Assert.assertNotNull(sourceChannel.createDataSourceClient(new SqlServerConnectionParam(), DbType.SQLSERVER)); Assert.assertNotNull(sourceChannel.createDataSourceClient(new SQLServerConnectionParam(), DbType.SQLSERVER));
} }
} }

8
dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/SqoopJobGenerator.java

@ -20,10 +20,10 @@ package org.apache.dolphinscheduler.plugin.task.sqoop.generator;
import org.apache.dolphinscheduler.plugin.task.sqoop.SqoopJobType; import org.apache.dolphinscheduler.plugin.task.sqoop.SqoopJobType;
import org.apache.dolphinscheduler.plugin.task.sqoop.generator.sources.HdfsSourceGenerator; import org.apache.dolphinscheduler.plugin.task.sqoop.generator.sources.HdfsSourceGenerator;
import org.apache.dolphinscheduler.plugin.task.sqoop.generator.sources.HiveSourceGenerator; import org.apache.dolphinscheduler.plugin.task.sqoop.generator.sources.HiveSourceGenerator;
import org.apache.dolphinscheduler.plugin.task.sqoop.generator.sources.MysqlSourceGenerator; import org.apache.dolphinscheduler.plugin.task.sqoop.generator.sources.MySQLSourceGenerator;
import org.apache.dolphinscheduler.plugin.task.sqoop.generator.targets.HdfsTargetGenerator; import org.apache.dolphinscheduler.plugin.task.sqoop.generator.targets.HdfsTargetGenerator;
import org.apache.dolphinscheduler.plugin.task.sqoop.generator.targets.HiveTargetGenerator; import org.apache.dolphinscheduler.plugin.task.sqoop.generator.targets.HiveTargetGenerator;
import org.apache.dolphinscheduler.plugin.task.sqoop.generator.targets.MysqlTargetGenerator; import org.apache.dolphinscheduler.plugin.task.sqoop.generator.targets.MySQLTargetGenerator;
import org.apache.dolphinscheduler.plugin.task.sqoop.parameter.SqoopParameters; import org.apache.dolphinscheduler.plugin.task.sqoop.parameter.SqoopParameters;
import org.apache.dolphinscheduler.spi.task.request.TaskRequest; import org.apache.dolphinscheduler.spi.task.request.TaskRequest;
@ -93,7 +93,7 @@ public class SqoopJobGenerator {
private ISourceGenerator createSourceGenerator(String sourceType) { private ISourceGenerator createSourceGenerator(String sourceType) {
switch (sourceType) { switch (sourceType) {
case MYSQL: case MYSQL:
return new MysqlSourceGenerator(); return new MySQLSourceGenerator();
case HIVE: case HIVE:
return new HiveSourceGenerator(); return new HiveSourceGenerator();
case HDFS: case HDFS:
@ -112,7 +112,7 @@ public class SqoopJobGenerator {
private ITargetGenerator createTargetGenerator(String targetType) { private ITargetGenerator createTargetGenerator(String targetType) {
switch (targetType) { switch (targetType) {
case MYSQL: case MYSQL:
return new MysqlTargetGenerator(); return new MySQLTargetGenerator();
case HIVE: case HIVE:
return new HiveTargetGenerator(); return new HiveTargetGenerator();
case HDFS: case HDFS:

4
dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/sources/MysqlSourceGenerator.java → dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/sources/MySQLSourceGenerator.java

@ -54,9 +54,9 @@ import org.slf4j.LoggerFactory;
/** /**
* mysql source generator * mysql source generator
*/ */
public class MysqlSourceGenerator implements ISourceGenerator { public class MySQLSourceGenerator implements ISourceGenerator {
private static final Logger logger = LoggerFactory.getLogger(MysqlSourceGenerator.class); private static final Logger logger = LoggerFactory.getLogger(MySQLSourceGenerator.class);
@Override @Override
public String generate(SqoopParameters sqoopParameters, TaskRequest taskExecutionContext) { public String generate(SqoopParameters sqoopParameters, TaskRequest taskExecutionContext) {

4
dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/targets/MysqlTargetGenerator.java → dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/generator/targets/MySQLTargetGenerator.java

@ -47,9 +47,9 @@ import org.slf4j.LoggerFactory;
/** /**
* mysql target generator * mysql target generator
*/ */
public class MysqlTargetGenerator implements ITargetGenerator { public class MySQLTargetGenerator implements ITargetGenerator {
private static final Logger logger = LoggerFactory.getLogger(MysqlTargetGenerator.class); private static final Logger logger = LoggerFactory.getLogger(MySQLTargetGenerator.class);
@Override @Override
public String generate(SqoopParameters sqoopParameters, TaskRequest taskExecutionContext) { public String generate(SqoopParameters sqoopParameters, TaskRequest taskExecutionContext) {

6
dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/dao/MysqlUpgradeDao.java → dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/dao/MySQLUpgradeDao.java

@ -31,10 +31,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class MysqlUpgradeDao extends UpgradeDao { public class MySQLUpgradeDao extends UpgradeDao {
public static final Logger logger = LoggerFactory.getLogger(MysqlUpgradeDao.class); public static final Logger logger = LoggerFactory.getLogger(MySQLUpgradeDao.class);
private MysqlUpgradeDao(DataSource dataSource) { private MySQLUpgradeDao(DataSource dataSource) {
super(dataSource); super(dataSource);
} }

6
dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/dao/PostgresqlUpgradeDao.java → dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/dao/PostgreSQLUpgradeDao.java

@ -32,10 +32,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
public class PostgresqlUpgradeDao extends UpgradeDao { public class PostgreSQLUpgradeDao extends UpgradeDao {
public static final Logger logger = LoggerFactory.getLogger(PostgresqlUpgradeDao.class); public static final Logger logger = LoggerFactory.getLogger(PostgreSQLUpgradeDao.class);
private PostgresqlUpgradeDao(DataSource dataSource) { private PostgreSQLUpgradeDao(DataSource dataSource) {
super(dataSource); super(dataSource);
} }
Loading…
Cancel
Save