Browse Source

feat: Introduce new datasource vertica (#14232)

Co-authored-by: Zinway Liu <zinway.liu@ucloud.cn>
3.2.1-prepare
Zinway 1 year ago committed by GitHub
parent
commit
18d176c5f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      docs/configs/docsdev.js
  2. 21
      docs/docs/en/guide/datasource/vertica.md
  3. 19
      docs/docs/zh/guide/datasource/vertica.md
  4. BIN
      docs/img/new_ui/dev/datasource/vertica.png
  5. 7
      dolphinscheduler-bom/pom.xml
  6. 3
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/DataSourceConstants.java
  7. 5
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-all/pom.xml
  8. 35
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTO.java
  9. 80
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTOTest.java
  10. 45
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/MySQLDataSourceParamDTO.java
  11. 50
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/pom.xml
  12. 31
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/VerticaDataSourceChannel.java
  13. 37
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/VerticaDataSourceChannelFactory.java
  14. 30
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/VerticaDataSourceClient.java
  15. 38
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/param/VerticaConnectionParam.java
  16. 43
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/param/VerticaDataSourceParamDTO.java
  17. 134
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/param/VerticaDataSourceProcessor.java
  18. 33
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/test/java/org/apache/dolphinscheduler/plugin/datasource/vertica/VerticaDataSourceChannelFactoryTest.java
  19. 39
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/test/java/org/apache/dolphinscheduler/plugin/datasource/vertica/VerticaDataSourceChannelTest.java
  20. 108
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/test/java/org/apache/dolphinscheduler/plugin/datasource/vertica/param/VerticaDataSourceProcessorTest.java
  21. 65
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/test/java/org/apache/dolphinscheduler/plugin/datasource/vertica/provider/JDBCDataSourceProviderTest.java
  22. 149
      dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/test/java/org/apache/dolphinscheduler/plugin/datasource/vertica/utils/DataSourceUtilsTest.java
  23. 1
      dolphinscheduler-datasource-plugin/pom.xml
  24. 5
      dolphinscheduler-dist/release-docs/LICENSE
  25. 23
      dolphinscheduler-dist/release-docs/NOTICE
  26. 18
      dolphinscheduler-dist/release-docs/licenses/LICENSE-vertica-jdbc.txt
  27. 3
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/enums/DbType.java
  28. 1
      dolphinscheduler-ui/src/service/modules/data-source/types.ts
  29. 5
      dolphinscheduler-ui/src/views/datasource/list/use-form.ts
  30. 5
      dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-datasource.ts
  31. 3
      tools/dependencies/known-dependencies.txt

8
docs/configs/docsdev.js

@ -254,6 +254,10 @@ export default {
title: 'File Parameter',
link: '/en-us/docs/dev/user_doc/guide/parameter/file-parameter.html',
},
{
title: 'Vertica',
link: '/en-us/docs/dev/user_doc/guide/datasource/vertica.html',
},
],
},
{
@ -930,6 +934,10 @@ export default {
title: 'SSH',
link: '/zh-cn/docs/dev/user_doc/guide/task/ssh.html',
},
{
title: 'Vertica',
link: '/zh-cn/docs/dev/user_doc/guide/datasource/vertica.html',
},
],
},
{

21
docs/docs/en/guide/datasource/vertica.md

@ -0,0 +1,21 @@
# Vertica
![vertica](../../../../img/new_ui/dev/datasource/vertica.png)
## Datasource Parameters
| **Parameter** | **Description** |
|----------------------------|------------------------------------------------------------|
| Datasource | Select VERTICA. |
| Datasource Name | Enter the name of the DataSource. |
| Description | Enter a description of the DataSource. |
| IP/Host Name | Enter the Vertica service IP. |
| Port | Enter the Vertica service port. |
| Username | Set the username for Vertica connection. |
| Password | Set the password for Vertica connection. |
| Database name | Enter the database name of the Vertica connection. |
| Jdbc connection parameters | Parameter settings for Vertica connection, in JSON format. |
## Native Supported
Yes, could use this datasource by default.

19
docs/docs/zh/guide/datasource/vertica.md

@ -0,0 +1,19 @@
# VERTICA 数据源
![vertica](../../../../img/new_ui/dev/datasource/vertica.png)
| **参数名称** | **参数描述** |
|-----------|--------------------------------|
| 数据源 | 选择 VERTICA |
| 数据源名称 | 输入数据源的名称 |
| 描述 | 输入数据源的描述 |
| IP 主机名 | 输入连接 VERTICA 的 IP |
| 端口 | 输入连接 VERTICA 的端口 |
| 用户名 | 设置连接 VERTICA 的用户名 |
| 密码 | 设置连接 VERTICA 的密码 |
| 数据库名 | 输入连接 VERTICA 的数据库名称 |
| JDBC 连接参数 | 用于 VERTICA 连接的参数设置,以 JSON 形式填写 |
## 是否原生支持
是,数据源不需要任务附加操作即可使用。

BIN
docs/img/new_ui/dev/datasource/vertica.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

7
dolphinscheduler-bom/pom.xml

@ -57,6 +57,7 @@
<cron-utils.version>9.1.6</cron-utils.version>
<h2.version>2.1.210</h2.version>
<mysql-connector.version>8.0.16</mysql-connector.version>
<vertica-jdbc.version>12.0.4-0</vertica-jdbc.version>
<oracle-jdbc.version>21.5.0.0</oracle-jdbc.version>
<dameng-jdbc.version>8.1.2.79</dameng-jdbc.version>
<slf4j.version>1.7.36</slf4j.version>
@ -398,6 +399,12 @@
<version>${dameng-jdbc.version}</version>
</dependency>
<dependency>
<groupId>com.vertica.jdbc</groupId>
<artifactId>vertica-jdbc</artifactId>
<version>${vertica-jdbc.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>

3
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/constants/DataSourceConstants.java

@ -41,6 +41,7 @@ public class DataSourceConstants {
public static final String ORG_APACHE_KYUUBI_JDBC_DRIVER = "org.apache.kyuubi.jdbc.KyuubiHiveDriver";
public static final String COM_OCEANBASE_JDBC_DRIVER = "com.oceanbase.jdbc.Driver";
public static final String NET_SNOWFLAKE_JDBC_DRIVER = "net.snowflake.client.jdbc.SnowflakeDriver";
public static final String COM_VERTICA_JDBC_DRIVER = "com.vertica.jdbc.Driver";
/**
* validation Query
*/
@ -60,6 +61,7 @@ public class DataSourceConstants {
public static final String SNOWFLAKE_VALIDATION_QUERY = "select 1";
public static final String KYUUBI_VALIDATION_QUERY = "select 1";
public static final String VERTICA_VALIDATION_QUERY = "select 1";
/**
* jdbc url
@ -82,6 +84,7 @@ public class DataSourceConstants {
public static final String JDBC_DAMENG = "jdbc:dm://";
public static final String JDBC_OCEANBASE = "jdbc:oceanbase://";
public static final String JDBC_SNOWFLAKE = "jdbc:snowflake://";
public static final String JDBC_VERTICA = "jdbc:vertica://";
/**
* database type

5
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-all/pom.xml

@ -127,5 +127,10 @@
<artifactId>dolphinscheduler-datasource-kyuubi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-datasource-vertica</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

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

@ -17,9 +17,11 @@
package org.apache.dolphinscheduler.plugin.datasource.api.datasource;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.spi.enums.DbType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Map;
/**
@ -89,6 +91,39 @@ public abstract class BaseDataSourceParamDTO implements Serializable {
this.port = port;
}
/**
* extract the host and port from the address,
* then set it
* @param address address like 'jdbc:mysql://host:port' or 'jdbc:hive2://zk1:port,zk2:port,zk3:port'
*/
public void setHostAndPortByAddress(String address) {
if (address == null) {
throw new IllegalArgumentException("address is null.");
}
address = address.trim();
int doubleSlashIndex = address.indexOf(Constants.DOUBLE_SLASH);
// trim address like 'jdbc:mysql://host:port/xxx' ends with '/xxx'
int slashIndex = address.indexOf(Constants.SLASH, doubleSlashIndex + 2);
String hostPortString = slashIndex == -1 ? address.substring(doubleSlashIndex + 2)
: address.substring(doubleSlashIndex + 2, slashIndex);
ArrayList<String> hosts = new ArrayList<>();
String portString = null;
for (String hostPort : hostPortString.split(Constants.COMMA)) {
String[] parts = hostPort.split(Constants.COLON);
hosts.add(parts[0]);
if (portString == null && parts.length > 1)
portString = parts[1];
}
if (hosts.size() == 0 || portString == null) {
throw new IllegalArgumentException(String.format("host:port '%s' illegal.", hostPortString));
}
this.host = String.join(Constants.COMMA, hosts);
this.port = Integer.parseInt(portString);
}
public String getDatabase() {
return database;
}

80
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTOTest.java

@ -0,0 +1,80 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.api.datasource;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* Use MySQLDataSourceParamDTO extends BaseDataSourceParamDTO for test.
*/
public class BaseDataSourceParamDTOTest {
private MySQLDataSourceParamDTO mockDataSourceParamDTO;
@BeforeEach
public void setUp() {
mockDataSourceParamDTO = new MySQLDataSourceParamDTO();
}
@Test
public void setHostAndPortByAddressTest1() {
mockDataSourceParamDTO.setHostAndPortByAddress("jdbc:mysql://1.2.3.4:3306");
assertEquals("1.2.3.4", mockDataSourceParamDTO.getHost());
assertEquals(3306, mockDataSourceParamDTO.getPort());
}
@Test
public void setHostAndPortByAddressTest2() {
mockDataSourceParamDTO.setHostAndPortByAddress("jdbc:mysql://1.2.3.4:3306/database");
assertEquals("1.2.3.4", mockDataSourceParamDTO.getHost());
assertEquals(3306, mockDataSourceParamDTO.getPort());
}
@Test
public void setHostAndPortByAddressTest3() {
mockDataSourceParamDTO.setHostAndPortByAddress("jdbc:mysql://h1,h2,h3:3306");
assertEquals("h1,h2,h3", mockDataSourceParamDTO.getHost());
assertEquals(3306, mockDataSourceParamDTO.getPort());
}
@Test
public void setHostAndPortByAddressTest4() {
mockDataSourceParamDTO.setHostAndPortByAddress("jdbc:mysql://h1:3306,h2:3306,h3:3306");
assertEquals("h1,h2,h3", mockDataSourceParamDTO.getHost());
assertEquals(3306, mockDataSourceParamDTO.getPort());
}
@Test
public void setHostAndPortByAddressTest5() {
Throwable exception = assertThrows(IllegalArgumentException.class,
() -> mockDataSourceParamDTO.setHostAndPortByAddress("jdbc:mysql://h1"));
assertEquals("host:port 'h1' illegal.", exception.getMessage());
}
@Test
public void setHostAndPortByAddressTest6() {
Throwable exception = assertThrows(NumberFormatException.class,
() -> mockDataSourceParamDTO.setHostAndPortByAddress("jdbc:mysql://h1:port"));
assertEquals("For input string: \"port\"", exception.getMessage());
}
}

45
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/MySQLDataSourceParamDTO.java

@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.api.datasource;
import org.apache.dolphinscheduler.spi.enums.DbType;
/**
* Used for test in BaseDataSourceParamDTOTest.
*/
public class MySQLDataSourceParamDTO extends BaseDataSourceParamDTO {
@Override
public String toString() {
return "MySQLDataSourceParamDTO{"
+ "name='" + name + '\''
+ ", note='" + note + '\''
+ ", host='" + host + '\''
+ ", port=" + port
+ ", database='" + database + '\''
+ ", userName='" + userName + '\''
+ ", password='" + password + '\''
+ ", other='" + other + '\''
+ '}';
}
@Override
public DbType getType() {
return DbType.MYSQL;
}
}

50
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/pom.xml

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-datasource-plugin</artifactId>
<version>dev-SNAPSHOT</version>
</parent>
<artifactId>dolphinscheduler-datasource-vertica</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-spi</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.dolphinscheduler</groupId>
<artifactId>dolphinscheduler-datasource-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.vertica.jdbc</groupId>
<artifactId>vertica-jdbc</artifactId>
</dependency>
</dependencies>
</project>

31
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/VerticaDataSourceChannel.java

@ -0,0 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceClient;
import org.apache.dolphinscheduler.spi.enums.DbType;
public class VerticaDataSourceChannel implements DataSourceChannel {
@Override
public DataSourceClient createDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
return new VerticaDataSourceClient(baseConnectionParam, dbType);
}
}

37
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/VerticaDataSourceChannelFactory.java

@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannelFactory;
import com.google.auto.service.AutoService;
@AutoService(DataSourceChannelFactory.class)
public class VerticaDataSourceChannelFactory implements DataSourceChannelFactory {
@Override
public String getName() {
return "vertica";
}
@Override
public DataSourceChannel create() {
return new VerticaDataSourceChannel();
}
}

30
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/VerticaDataSourceClient.java

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica;
import org.apache.dolphinscheduler.plugin.datasource.api.client.CommonDataSourceClient;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType;
public class VerticaDataSourceClient extends CommonDataSourceClient {
public VerticaDataSourceClient(BaseConnectionParam baseConnectionParam, DbType dbType) {
super(baseConnectionParam, dbType);
}
}

38
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/param/VerticaConnectionParam.java

@ -0,0 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica.param;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
public class VerticaConnectionParam extends BaseConnectionParam {
@Override
public String toString() {
return "VerticaConnectionParam{"
+ "user='" + user + '\''
+ ", password='" + password + '\''
+ ", address='" + address + '\''
+ ", database='" + database + '\''
+ ", jdbcUrl='" + jdbcUrl + '\''
+ ", driverLocation='" + driverLocation + '\''
+ ", driverClassName='" + driverClassName + '\''
+ ", validationQuery='" + validationQuery + '\''
+ ", other='" + other + '\''
+ '}';
}
}

43
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/param/VerticaDataSourceParamDTO.java

@ -0,0 +1,43 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica.param;
import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.enums.DbType;
public class VerticaDataSourceParamDTO extends BaseDataSourceParamDTO {
@Override
public String toString() {
return "VerticaDataSourceParamDTO{"
+ "name='" + name + '\''
+ ", note='" + note + '\''
+ ", host='" + host + '\''
+ ", port=" + port
+ ", database='" + database + '\''
+ ", userName='" + userName + '\''
+ ", password='" + password + '\''
+ ", other='" + other + '\''
+ '}';
}
@Override
public DbType getType() {
return DbType.VERTICA;
}
}

134
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/main/java/org/apache/dolphinscheduler/plugin/datasource/vertica/param/VerticaDataSourceProcessor.java

@ -0,0 +1,134 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica.param;
import org.apache.dolphinscheduler.common.constants.DataSourceConstants;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
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.DataSourceProcessor;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.datasource.ConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.apache.commons.collections4.MapUtils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Map;
import com.google.auto.service.AutoService;
@AutoService(DataSourceProcessor.class)
public class VerticaDataSourceProcessor extends AbstractDataSourceProcessor {
@Override
public BaseDataSourceParamDTO castDatasourceParamDTO(String paramJson) {
return JSONUtils.parseObject(paramJson, VerticaDataSourceParamDTO.class);
}
@Override
public BaseDataSourceParamDTO createDatasourceParamDTO(String connectionJson) {
VerticaConnectionParam connectionParams = (VerticaConnectionParam) createConnectionParams(connectionJson);
VerticaDataSourceParamDTO verticaDatasourceParamDTO = new VerticaDataSourceParamDTO();
verticaDatasourceParamDTO.setHostAndPortByAddress(connectionParams.getAddress());
verticaDatasourceParamDTO.setUserName(connectionParams.getUser());
verticaDatasourceParamDTO.setDatabase(connectionParams.getDatabase());
verticaDatasourceParamDTO.setOther(connectionParams.getOther());
return verticaDatasourceParamDTO;
}
@Override
public BaseConnectionParam createConnectionParams(BaseDataSourceParamDTO dataSourceParam) {
VerticaDataSourceParamDTO verticaDatasourceParam = (VerticaDataSourceParamDTO) dataSourceParam;
// address format: "jdbc:vertica://VerticaHost:portNumber"
String address = String.format("%s%s:%s", DataSourceConstants.JDBC_VERTICA, verticaDatasourceParam.getHost(),
verticaDatasourceParam.getPort());
// jdbc format: "jdbc:vertica://VerticaHost:portNumber/databaseName"
String jdbcUrl = String.format("%s/%s", address, verticaDatasourceParam.getDatabase());
VerticaConnectionParam verticaConnectionParam = new VerticaConnectionParam();
verticaConnectionParam.setJdbcUrl(jdbcUrl);
verticaConnectionParam.setDatabase(verticaDatasourceParam.getDatabase());
verticaConnectionParam.setAddress(address);
verticaConnectionParam.setUser(verticaDatasourceParam.getUserName());
verticaConnectionParam.setPassword(PasswordUtils.encodePassword(verticaDatasourceParam.getPassword()));
verticaConnectionParam.setDriverClassName(getDatasourceDriver());
verticaConnectionParam.setValidationQuery(getValidationQuery());
return verticaConnectionParam;
}
@Override
public ConnectionParam createConnectionParams(String connectionJson) {
return JSONUtils.parseObject(connectionJson, VerticaConnectionParam.class);
}
@Override
public String getDatasourceDriver() {
return DataSourceConstants.COM_VERTICA_JDBC_DRIVER;
}
@Override
public String getValidationQuery() {
return DataSourceConstants.VERTICA_VALIDATION_QUERY;
}
@Override
public String getJdbcUrl(ConnectionParam connectionParam) {
VerticaConnectionParam verticaConnectionParam = (VerticaConnectionParam) connectionParam;
String jdbcUrl = verticaConnectionParam.getJdbcUrl();
if (MapUtils.isNotEmpty(verticaConnectionParam.getOther())) {
jdbcUrl = String.format("%s?%s", jdbcUrl, transformOther(verticaConnectionParam.getOther()));
}
return jdbcUrl;
}
@Override
public Connection getConnection(ConnectionParam connectionParam) throws ClassNotFoundException, SQLException {
VerticaConnectionParam verticaConnectionParam = (VerticaConnectionParam) connectionParam;
Class.forName(getDatasourceDriver());
String user = verticaConnectionParam.getUser();
String password = PasswordUtils.decodePassword(verticaConnectionParam.getPassword());
return DriverManager.getConnection(getJdbcUrl(connectionParam), user, password);
}
@Override
public DbType getDbType() {
return DbType.VERTICA;
}
@Override
public DataSourceProcessor create() {
return new VerticaDataSourceProcessor();
}
private String transformOther(Map<String, String> otherMap) {
if (MapUtils.isEmpty(otherMap)) {
return null;
}
StringBuilder stringBuilder = new StringBuilder();
otherMap.forEach((key, value) -> stringBuilder.append(String.format("%s=%s&", key, value)));
return stringBuilder.toString();
}
}

33
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/test/java/org/apache/dolphinscheduler/plugin/datasource/vertica/VerticaDataSourceChannelFactoryTest.java

@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica;
import org.apache.dolphinscheduler.spi.datasource.DataSourceChannel;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class VerticaDataSourceChannelFactoryTest {
@Test
public void testCreate() {
VerticaDataSourceChannelFactory sourceChannelFactory = new VerticaDataSourceChannelFactory();
DataSourceChannel dataSourceChannel = sourceChannelFactory.create();
Assertions.assertNotNull(dataSourceChannel);
}
}

39
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/test/java/org/apache/dolphinscheduler/plugin/datasource/vertica/VerticaDataSourceChannelTest.java

@ -0,0 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica;
import org.apache.dolphinscheduler.plugin.datasource.vertica.param.VerticaConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
public class VerticaDataSourceChannelTest {
@Test
public void testCreateDataSourceClient() {
VerticaDataSourceChannel sourceChannel = Mockito.mock(VerticaDataSourceChannel.class);
VerticaDataSourceClient dataSourceClient = Mockito.mock(VerticaDataSourceClient.class);
Mockito.when(sourceChannel.createDataSourceClient(Mockito.any(), Mockito.any())).thenReturn(dataSourceClient);
Assertions.assertNotNull(sourceChannel.createDataSourceClient(new VerticaConnectionParam(), DbType.VERTICA));
}
}

108
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/test/java/org/apache/dolphinscheduler/plugin/datasource/vertica/param/VerticaDataSourceProcessorTest.java

@ -0,0 +1,108 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica.param;
import org.apache.dolphinscheduler.common.constants.DataSourceConstants;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
import org.apache.dolphinscheduler.spi.enums.DbType;
import java.util.HashMap;
import java.util.Map;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
public class VerticaDataSourceProcessorTest {
private VerticaDataSourceProcessor verticaDatasourceProcessor = new VerticaDataSourceProcessor();
@Test
public void testCreateConnectionParams() {
Map<String, String> props = new HashMap<>();
props.put("serverTimezone", "utc");
VerticaDataSourceParamDTO verticaDatasourceParamDTO = new VerticaDataSourceParamDTO();
verticaDatasourceParamDTO.setUserName("root");
verticaDatasourceParamDTO.setPassword("123456");
verticaDatasourceParamDTO.setHost("localhost");
verticaDatasourceParamDTO.setPort(5433);
verticaDatasourceParamDTO.setDatabase("default");
verticaDatasourceParamDTO.setOther(props);
try (MockedStatic<PasswordUtils> mockedStaticPasswordUtils = Mockito.mockStatic(PasswordUtils.class)) {
mockedStaticPasswordUtils.when(() -> PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("test");
VerticaConnectionParam connectionParams = (VerticaConnectionParam) verticaDatasourceProcessor
.createConnectionParams(verticaDatasourceParamDTO);
Assertions.assertEquals("jdbc:vertica://localhost:5433", connectionParams.getAddress());
Assertions.assertEquals("jdbc:vertica://localhost:5433/default", connectionParams.getJdbcUrl());
}
}
@Test
public void testCreateConnectionParams2() {
String connectionJson =
"{\"user\":\"root\",\"password\":\"123456\",\"address\":\"jdbc:vertica://localhost:5433\""
+ ",\"database\":\"default\",\"jdbcUrl\":\"jdbc:vertica://localhost:5433/default\"}";
VerticaConnectionParam connectionParams = (VerticaConnectionParam) verticaDatasourceProcessor
.createConnectionParams(connectionJson);
Assertions.assertNotNull(connectionJson);
Assertions.assertEquals("root", connectionParams.getUser());
}
@Test
public void testGetDatasourceDriver() {
Assertions.assertEquals(DataSourceConstants.COM_VERTICA_JDBC_DRIVER,
verticaDatasourceProcessor.getDatasourceDriver());
}
@Test
public void testGetJdbcUrl() {
VerticaConnectionParam verticaConnectionParam = new VerticaConnectionParam();
verticaConnectionParam.setJdbcUrl("jdbc:vertica://localhost:5433/default");
Assertions.assertEquals(
"jdbc:vertica://localhost:5433/default",
verticaDatasourceProcessor.getJdbcUrl(verticaConnectionParam));
}
@Test
public void testGetDbType() {
Assertions.assertEquals(DbType.VERTICA, verticaDatasourceProcessor.getDbType());
}
@Test
public void testGetValidationQuery() {
Assertions.assertEquals(DataSourceConstants.VERTICA_VALIDATION_QUERY,
verticaDatasourceProcessor.getValidationQuery());
}
@Test
public void testGetDatasourceUniqueId() {
VerticaConnectionParam verticaConnectionParam = new VerticaConnectionParam();
verticaConnectionParam.setJdbcUrl("jdbc:vertica://localhost:5433/default");
verticaConnectionParam.setUser("root");
verticaConnectionParam.setPassword("123456");
try (MockedStatic<PasswordUtils> mockedPasswordUtils = Mockito.mockStatic(PasswordUtils.class)) {
mockedPasswordUtils.when(() -> PasswordUtils.encodePassword(Mockito.anyString())).thenReturn("123456");
Assertions.assertEquals("vertica@root@123456@jdbc:vertica://localhost:5433/default",
verticaDatasourceProcessor.getDatasourceUniqueId(verticaConnectionParam, DbType.VERTICA));
}
}
}

65
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/test/java/org/apache/dolphinscheduler/plugin/datasource/vertica/provider/JDBCDataSourceProviderTest.java

@ -0,0 +1,65 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica.provider;
import org.apache.dolphinscheduler.plugin.datasource.api.provider.JDBCDataSourceProvider;
import org.apache.dolphinscheduler.plugin.datasource.vertica.param.VerticaConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import com.zaxxer.hikari.HikariDataSource;
@ExtendWith(MockitoExtension.class)
public class JDBCDataSourceProviderTest {
@Test
public void testCreateJdbcDataSource() {
try (
MockedStatic<JDBCDataSourceProvider> mockedJDBCDataSourceProvider =
Mockito.mockStatic(JDBCDataSourceProvider.class)) {
HikariDataSource dataSource = Mockito.mock(HikariDataSource.class);
mockedJDBCDataSourceProvider
.when(() -> JDBCDataSourceProvider.createJdbcDataSource(Mockito.any(), Mockito.any()))
.thenReturn(dataSource);
Assertions.assertNotNull(
JDBCDataSourceProvider.createJdbcDataSource(new VerticaConnectionParam(), DbType.VERTICA));
}
}
@Test
public void testCreateOneSessionJdbcDataSource() {
try (
MockedStatic<JDBCDataSourceProvider> mockedJDBCDataSourceProvider =
Mockito.mockStatic(JDBCDataSourceProvider.class)) {
HikariDataSource dataSource = Mockito.mock(HikariDataSource.class);
mockedJDBCDataSourceProvider
.when(() -> JDBCDataSourceProvider.createOneSessionJdbcDataSource(Mockito.any(), Mockito.any()))
.thenReturn(dataSource);
Assertions.assertNotNull(
JDBCDataSourceProvider.createOneSessionJdbcDataSource(new VerticaConnectionParam(),
DbType.VERTICA));
}
}
}

149
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-vertica/src/test/java/org/apache/dolphinscheduler/plugin/datasource/vertica/utils/DataSourceUtilsTest.java

@ -0,0 +1,149 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.datasource.vertica.utils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
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.DataSourceUtils;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils;
import org.apache.dolphinscheduler.plugin.datasource.vertica.param.VerticaConnectionParam;
import org.apache.dolphinscheduler.plugin.datasource.vertica.param.VerticaDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.datasource.ConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
@ExtendWith(MockitoExtension.class)
public class DataSourceUtilsTest {
@Test
public void testCheckDatasourceParam() {
VerticaDataSourceParamDTO verticaDatasourceParamDTO = new VerticaDataSourceParamDTO();
verticaDatasourceParamDTO.setHost("localhost");
verticaDatasourceParamDTO.setDatabase("default");
Map<String, String> other = new HashMap<>();
other.put("serverTimezone", "Asia/Shanghai");
other.put("queryTimeout", "-1");
other.put("characterEncoding", "utf8");
verticaDatasourceParamDTO.setOther(other);
DataSourceUtils.checkDatasourceParam(verticaDatasourceParamDTO);
Assertions.assertTrue(true);
}
@Test
public void testBuildConnectionParams() {
VerticaDataSourceParamDTO verticaDatasourceParamDTO = new VerticaDataSourceParamDTO();
verticaDatasourceParamDTO.setHost("localhost");
verticaDatasourceParamDTO.setDatabase("default");
verticaDatasourceParamDTO.setUserName("root");
verticaDatasourceParamDTO.setPort(5433);
verticaDatasourceParamDTO.setPassword("123456");
try (
MockedStatic<PasswordUtils> mockedStaticPasswordUtils = Mockito.mockStatic(PasswordUtils.class);
MockedStatic<CommonUtils> mockedStaticCommonUtils = Mockito.mockStatic(CommonUtils.class)) {
mockedStaticPasswordUtils.when(() -> PasswordUtils.encodePassword(Mockito.anyString()))
.thenReturn("123456");
mockedStaticCommonUtils.when(CommonUtils::getKerberosStartupState).thenReturn(false);
ConnectionParam connectionParam = DataSourceUtils.buildConnectionParams(verticaDatasourceParamDTO);
Assertions.assertNotNull(connectionParam);
}
}
@Test
public void testBuildConnectionParams2() {
VerticaDataSourceParamDTO verticaDatasourceParamDTO = new VerticaDataSourceParamDTO();
verticaDatasourceParamDTO.setHost("localhost");
verticaDatasourceParamDTO.setDatabase("default");
verticaDatasourceParamDTO.setUserName("root");
verticaDatasourceParamDTO.setPort(5433);
verticaDatasourceParamDTO.setPassword("123456");
ConnectionParam connectionParam = DataSourceUtils.buildConnectionParams(DbType.VERTICA,
JSONUtils.toJsonString(verticaDatasourceParamDTO));
Assertions.assertNotNull(connectionParam);
}
@Test
public void testGetConnection() throws ExecutionException {
try (
MockedStatic<PropertyUtils> mockedStaticPropertyUtils = Mockito.mockStatic(PropertyUtils.class);
MockedStatic<DataSourceClientProvider> mockedStaticDataSourceClientProvider =
Mockito.mockStatic(DataSourceClientProvider.class)) {
mockedStaticPropertyUtils.when(() -> PropertyUtils.getLong("kerberos.expire.time", 24L)).thenReturn(24L);
DataSourceClientProvider clientProvider = Mockito.mock(DataSourceClientProvider.class);
mockedStaticDataSourceClientProvider.when(DataSourceClientProvider::getInstance).thenReturn(clientProvider);
Connection connection = Mockito.mock(Connection.class);
Mockito.when(clientProvider.getConnection(Mockito.any(), Mockito.any())).thenReturn(connection);
VerticaConnectionParam connectionParam = new VerticaConnectionParam();
connectionParam.setUser("root");
connectionParam.setPassword("123456");
connection = DataSourceClientProvider.getInstance().getConnection(DbType.VERTICA, connectionParam);
Assertions.assertNotNull(connection);
}
}
@Test
public void testGetJdbcUrl() {
VerticaConnectionParam verticaConnectionParam = new VerticaConnectionParam();
verticaConnectionParam.setJdbcUrl("jdbc:vertica://localhost:5433");
String jdbcUrl = DataSourceUtils.getJdbcUrl(DbType.VERTICA, verticaConnectionParam);
Assertions.assertEquals("jdbc:vertica://localhost:5433",
jdbcUrl);
}
@Test
public void testBuildDatasourceParamDTO() {
VerticaConnectionParam connectionParam = new VerticaConnectionParam();
connectionParam.setJdbcUrl("jdbc:vertica://localhost:5433");
connectionParam.setAddress("jdbc:vertica://localhost:5433");
connectionParam.setUser("root");
connectionParam.setPassword("123456");
Assertions.assertNotNull(
DataSourceUtils.buildDatasourceParamDTO(DbType.VERTICA, JSONUtils.toJsonString(connectionParam)));
}
@Test
public void testGetDatasourceProcessor() {
Assertions.assertNotNull(DataSourceUtils.getDatasourceProcessor(DbType.VERTICA));
}
@Test
public void testGetDatasourceProcessorError() {
Assertions.assertThrows(Exception.class, () -> {
DataSourceUtils.getDatasourceProcessor(null);
});
}
}

1
dolphinscheduler-datasource-plugin/pom.xml

@ -50,6 +50,7 @@
<module>dolphinscheduler-datasource-ssh</module>
<module>dolphinscheduler-datasource-databend</module>
<module>dolphinscheduler-datasource-snowflake</module>
<module>dolphinscheduler-datasource-vertica</module>
</modules>
<dependencyManagement>

5
dolphinscheduler-dist/release-docs/LICENSE vendored

@ -788,3 +788,8 @@ SIL licenses
JDOM licenses
========================================
jdom2 2.0.6.1: https://github.com/hunterhacker/jdom/blob/master/LICENSE.txt JDOM
========================================
Vertica Client Driver License
========================================
vertica-jdbc 12.0.4-0: https://mvnrepository.com/artifact/com.vertica.jdbc/vertica-jdbc/12.0.4-0, Vertica Client Driver License

23
dolphinscheduler-dist/release-docs/NOTICE vendored

@ -2118,3 +2118,26 @@ Copyright 2010-2017 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
=========================================================================
Vertica Client Driver License NOTICE
=========================================================================
End User License Agreement
BY SELECTING “ACCEPT AND CONTINUE” BELOW, YOU ARE EXPRESSLY ACKNOWLEDGING AND AGREEING THAT THIS AGREEMENT, BETWEEN YOU AND MICRO FOCUS LLC (WITH ITS AFFILIATES, “MICRO FOCUS” OR “WE”), GOVERNS YOUR USE OF THE VERTICA CLIENT DRIVER SOFTWARE (TOGETHER WITH ANY UPDATES AND ENHANCEMENTS TO IT, AND ACCOMPANYING DOCUMENTATION, THE “DRIVERS”) THAT WE MAKE AVAILABLE TO YOU IN CONNECTION WITH MICRO FOCUS’ VERTICA SOFTWARE PRODUCT (OR ANY SUCCESSOR PRODUCT DESIGNATED BY US IN WRITING, THE “SOFTWARE”). THIS AGREEMENT GOVERNS THE LICENSING OF THE DRIVERS ONLY AND IF YOU WISH TO USE THE VERTICA SOFTWARE PRODUCT ITSELF, YOU WILL NEED TO LICENSE IT SEPARATELY UNDER THE APPROPRIATE COMMERCIAL OR COMMUNITY EDITION LICENSE.
1. Except as stated below in this Agreement, the Drivers are governed by the Micro Focus End User License Agreement (the “EULA”) located at https://www.microfocus.com/en-us/legal/software-licensing. In the event of any conflict between the terms of this Agreement and the EULA, this Agreement will control and take precedence.
2. This Agreement grants you a limited, nonexclusive, non-transferable, non-sublicensable license to install, use, and copy the object code of the Drivers free of charge for the sole purpose of developing a program that can use the Drivers to connect to the Software database. You may generally use the Drivers to connect to the Software. You may also distribute the Drivers, provided that (a) you distribute the Drivers as part of a software program or package that you develop; (b) you require end users to agree to terms that are consistent with, and at least as protective of Micro Focus and the Drivers as, this Agreement; (c) you retain without modification any copyright, patent, trademark, or attribution notices that are present in the Drivers; and (d) you distribute the Drivers for the sole purpose of your program connecting to the Software.
3. Your rights under this Agreement will immediately and automatically terminate if you do not comply with any term or condition of this Agreement. In the case of termination, you must cease all use and destroy all copies of the Drivers. We may modify, suspend, discontinue, or terminate your right to use part or all of the Drivers at any time without notice to you and Micro Focus will not be liable to you should it exercise those rights. We may amend this Agreement at our sole discretion by posting the revised terms on the Micro Focus website https://www.vertica.com/download/vertica/client-drivers/ or within the Drivers. Your continued use of the Drivers after any amendment’s effective date evidence your agreement to be bound by it.
4. The Drivers are the sole and exclusive intellectual property of Micro Focus. No support is provided for the Drivers.
5. Some components of the Drivers may be governed by applicable open source software licenses. Your license rights with respect to these individual components are defined by the applicable open source software licenses, and nothing in this Agreement will restrict, limit, or otherwise affect any rights or obligations you may have, or conditions to which you may be subject, under such open source software licenses.
6. The Drivers contains third party components, including any run time or other elements licensed to Micro Focus by a third party licensor (“Third Party Components”). Third Party Components are the sole and exclusive intellectual property of the applicable third party licensor. You agree that to the extent required by a third party licensor of a Third Party Component, that third party licensor is an intended third party beneficiary of this Agreement as necessary to protect its intellectual property rights software and limit certain uses thereof. You agree that any third party licensors of Third Party Components will have no liability with respect to the Third Party Components under this agreement.
7. NOTWITHSTANDING ANYTHING TO THE CONTRARY IN THE EULA, YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT USE AND DISTRIBUTION OF THE DRIVERS IS AT YOUR SOLE RISK AND ARE DELIVERED TO YOU “AS IS” WITHOUT WARRANTY OF ANY KIND, AND MICRO FOCUS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED.
8. You are liable for and will defend, indemnify, and hold harmless Micro Focus and its affiliates, officers, directors, agents, and employees, from and against any claims, liability, loss, damage, cost, or expense (including reasonable attorneys’ fees) arising out of (i) your distribution or use of your programs, (ii) your use of the Drivers, (iii) violation of applicable law, or (iv) violation of any right of any person or entity, including without limitation intellectual property rights.
9. NOTWITHSTANDING ANYTHING TO THE CONTRARY IN THE EULA, TO THE EXTENT NOT PROHIBITED BY LAW, MICRO FOCUS WILL NOT BE LIABLE TO YOU FOR ANY INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR BREACH OF ANY EXPRESS OR IMPLIED WARRANTY, BREACH OF CONTRACT, NEGLIGENCE, STRICT LIABILITY, OR ANY OTHER LEGAL THEORY RELATED TO THE DRIVERS, INCLUDING WITHOUT LIMITATION ANY DAMAGES ARISING OUT OF LOSS OF PROFITS, REVENUE, DATA, OR USE OF THE DRIVERS. IN ANY CASE, MICRO FOCUS’ AGGREGATE LIABILITY UNDER THIS AGREEMENT WILL BE LIMITED TO $100.00.
[ ] I consent and accept the terms and conditions stated in this Agreement.
=========================================================================

18
dolphinscheduler-dist/release-docs/licenses/LICENSE-vertica-jdbc.txt vendored

@ -0,0 +1,18 @@
Vertica Client Driver License
https://www.vertica.com/download/vertica/client-drivers/
End User License Agreement
BY SELECTING “ACCEPT AND CONTINUE” BELOW, YOU ARE EXPRESSLY ACKNOWLEDGING AND AGREEING THAT THIS AGREEMENT, BETWEEN YOU AND MICRO FOCUS LLC (WITH ITS AFFILIATES, “MICRO FOCUS” OR “WE”), GOVERNS YOUR USE OF THE VERTICA CLIENT DRIVER SOFTWARE (TOGETHER WITH ANY UPDATES AND ENHANCEMENTS TO IT, AND ACCOMPANYING DOCUMENTATION, THE “DRIVERS”) THAT WE MAKE AVAILABLE TO YOU IN CONNECTION WITH MICRO FOCUS’ VERTICA SOFTWARE PRODUCT (OR ANY SUCCESSOR PRODUCT DESIGNATED BY US IN WRITING, THE “SOFTWARE”). THIS AGREEMENT GOVERNS THE LICENSING OF THE DRIVERS ONLY AND IF YOU WISH TO USE THE VERTICA SOFTWARE PRODUCT ITSELF, YOU WILL NEED TO LICENSE IT SEPARATELY UNDER THE APPROPRIATE COMMERCIAL OR COMMUNITY EDITION LICENSE.
1. Except as stated below in this Agreement, the Drivers are governed by the Micro Focus End User License Agreement (the “EULA”) located at https://www.microfocus.com/en-us/legal/software-licensing. In the event of any conflict between the terms of this Agreement and the EULA, this Agreement will control and take precedence.
2. This Agreement grants you a limited, nonexclusive, non-transferable, non-sublicensable license to install, use, and copy the object code of the Drivers free of charge for the sole purpose of developing a program that can use the Drivers to connect to the Software database. You may generally use the Drivers to connect to the Software. You may also distribute the Drivers, provided that (a) you distribute the Drivers as part of a software program or package that you develop; (b) you require end users to agree to terms that are consistent with, and at least as protective of Micro Focus and the Drivers as, this Agreement; (c) you retain without modification any copyright, patent, trademark, or attribution notices that are present in the Drivers; and (d) you distribute the Drivers for the sole purpose of your program connecting to the Software.
3. Your rights under this Agreement will immediately and automatically terminate if you do not comply with any term or condition of this Agreement. In the case of termination, you must cease all use and destroy all copies of the Drivers. We may modify, suspend, discontinue, or terminate your right to use part or all of the Drivers at any time without notice to you and Micro Focus will not be liable to you should it exercise those rights. We may amend this Agreement at our sole discretion by posting the revised terms on the Micro Focus website https://www.vertica.com/download/vertica/client-drivers/ or within the Drivers. Your continued use of the Drivers after any amendment’s effective date evidence your agreement to be bound by it.
4. The Drivers are the sole and exclusive intellectual property of Micro Focus. No support is provided for the Drivers.
5. Some components of the Drivers may be governed by applicable open source software licenses. Your license rights with respect to these individual components are defined by the applicable open source software licenses, and nothing in this Agreement will restrict, limit, or otherwise affect any rights or obligations you may have, or conditions to which you may be subject, under such open source software licenses.
6. The Drivers contains third party components, including any run time or other elements licensed to Micro Focus by a third party licensor (“Third Party Components”). Third Party Components are the sole and exclusive intellectual property of the applicable third party licensor. You agree that to the extent required by a third party licensor of a Third Party Component, that third party licensor is an intended third party beneficiary of this Agreement as necessary to protect its intellectual property rights software and limit certain uses thereof. You agree that any third party licensors of Third Party Components will have no liability with respect to the Third Party Components under this agreement.
7. NOTWITHSTANDING ANYTHING TO THE CONTRARY IN THE EULA, YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT USE AND DISTRIBUTION OF THE DRIVERS IS AT YOUR SOLE RISK AND ARE DELIVERED TO YOU “AS IS” WITHOUT WARRANTY OF ANY KIND, AND MICRO FOCUS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED.
8. You are liable for and will defend, indemnify, and hold harmless Micro Focus and its affiliates, officers, directors, agents, and employees, from and against any claims, liability, loss, damage, cost, or expense (including reasonable attorneys’ fees) arising out of (i) your distribution or use of your programs, (ii) your use of the Drivers, (iii) violation of applicable law, or (iv) violation of any right of any person or entity, including without limitation intellectual property rights.
9. NOTWITHSTANDING ANYTHING TO THE CONTRARY IN THE EULA, TO THE EXTENT NOT PROHIBITED BY LAW, MICRO FOCUS WILL NOT BE LIABLE TO YOU FOR ANY INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR BREACH OF ANY EXPRESS OR IMPLIED WARRANTY, BREACH OF CONTRACT, NEGLIGENCE, STRICT LIABILITY, OR ANY OTHER LEGAL THEORY RELATED TO THE DRIVERS, INCLUDING WITHOUT LIMITATION ANY DAMAGES ARISING OUT OF LOSS OF PROFITS, REVENUE, DATA, OR USE OF THE DRIVERS. IN ANY CASE, MICRO FOCUS’ AGGREGATE LIABILITY UNDER THIS AGREEMENT WILL BE LIMITED TO $100.00.
[ ] I consent and accept the terms and conditions stated in this Agreement.

3
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/enums/DbType.java

@ -48,7 +48,8 @@ public enum DbType {
SSH(17, "ssh"),
KYUUBI(18, "kyuubi"),
DATABEND(19, "databend"),
SNOWFLAKE(20, "snowflake");
SNOWFLAKE(20, "snowflake"),
VERTICA(21, "vertica");
private static final Map<Integer, DbType> DB_TYPE_MAP =
Arrays.stream(DbType.values()).collect(toMap(DbType::getCode, Functions.identity()));

1
dolphinscheduler-ui/src/service/modules/data-source/types.ts

@ -24,6 +24,7 @@ type IDataBase =
| 'ORACLE'
| 'SQLSERVER'
| 'DB2'
| 'VERTICA'
| 'PRESTO'
| 'REDSHIFT'
| 'ATHENA'

5
dolphinscheduler-ui/src/views/datasource/list/use-form.ts

@ -390,6 +390,11 @@ export const datasourceType: IDataBaseOptionKeys = {
label: 'DB2',
defaultPort: 50000
},
VERTICA: {
value: 'VERTICA',
label: 'VERTICA',
defaultPort: 5433
},
PRESTO: {
value: 'PRESTO',
label: 'PRESTO',

5
dolphinscheduler-ui/src/views/projects/task/components/node/fields/use-datasource.ts

@ -122,6 +122,11 @@ export function useDatasource(
id: 16,
code: 'DATABEND',
disabled: false
},
{
id: 21,
code: 'VERTICA',
disabled: false
}
]

3
tools/dependencies/known-dependencies.txt

@ -482,4 +482,5 @@ casdoor-java-sdk-1.11.0.jar
casdoor-spring-boot-starter-1.6.0.jar
org.apache.oltu.oauth2.client-1.0.2.jar
org.apache.oltu.oauth2.common-1.0.2.jar
snowflake-jdbc-3.13.10.jar
snowflake-jdbc-3.13.10.jar
vertica-jdbc-12.0.4-0.jar

Loading…
Cancel
Save