Skip to content

Commit

Permalink
[cherry-pick][Fix-7485]Fix create hive datasource using ZooKee… (#7710)
Browse files Browse the repository at this point in the history
* [Fix-7485][datasource-plugin] Fix create hive datasource using ZooKeeper way in 2.0.1 (#7489)

# Conflicts:
#	dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/test/java/org/apache/dolphinscheduler/plugin/datasource/api/provider/JdbcDataSourceProviderTest.java
#	dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-hive/src/main/java/org/apache/dolphinscheduler/plugin/datasource/hive/HiveDataSourceClient.java

* update

Co-authored-by: wangbowen <[email protected]>
  • Loading branch information
lenboo and wangbowen1024 authored Dec 29, 2021
1 parent a262eeb commit b8f0beb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static HikariDataSource createJdbcDataSource(BaseConnectionParam properti
loaderJdbcDriver(classLoader, properties, dbType);

dataSource.setDriverClassName(properties.getDriverClassName());
dataSource.setJdbcUrl(properties.getJdbcUrl());
dataSource.setJdbcUrl(DatasourceUtil.getJdbcUrl(dbType, properties));
dataSource.setUsername(properties.getUser());
dataSource.setPassword(PasswordUtils.decodePassword(properties.getPassword()));

Expand All @@ -67,13 +67,13 @@ public static HikariDataSource createJdbcDataSource(BaseConnectionParam properti
/**
* @return One Session Jdbc DataSource
*/
public static HikariDataSource createOneSessionJdbcDataSource(BaseConnectionParam properties) {
public static HikariDataSource createOneSessionJdbcDataSource(BaseConnectionParam properties, DbType dbType) {
logger.info("Creating OneSession HikariDataSource pool for maxActive:{}", PropertyUtils.getInt(Constants.SPRING_DATASOURCE_MAX_ACTIVE, 50));

HikariDataSource dataSource = new HikariDataSource();

dataSource.setDriverClassName(properties.getDriverClassName());
dataSource.setJdbcUrl(properties.getJdbcUrl());
dataSource.setJdbcUrl(DatasourceUtil.getJdbcUrl(dbType, properties));
dataSource.setUsername(properties.getUser());
dataSource.setPassword(PasswordUtils.decodePassword(properties.getPassword()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void testCreateJdbcDataSource() {
public void testCreateOneSessionJdbcDataSource() {
PowerMockito.mockStatic(JdbcDataSourceProvider.class);
HikariDataSource dataSource = PowerMockito.mock(HikariDataSource.class);
PowerMockito.when(JdbcDataSourceProvider.createOneSessionJdbcDataSource(Mockito.any())).thenReturn(dataSource);
Assert.assertNotNull(JdbcDataSourceProvider.createOneSessionJdbcDataSource(new MysqlConnectionParam()));
PowerMockito.when(JdbcDataSourceProvider.createOneSessionJdbcDataSource(Mockito.any(), Mockito.any())).thenReturn(dataSource);
Assert.assertNotNull(JdbcDataSourceProvider.createOneSessionJdbcDataSource(new MysqlConnectionParam(), DbType.MYSQL));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected void initClient(BaseConnectionParam baseConnectionParam, DbType dbType
logger.info("Create ugi success.");

super.initClient(baseConnectionParam, dbType);
this.oneSessionDataSource = JdbcDataSourceProvider.createOneSessionJdbcDataSource(baseConnectionParam);
this.oneSessionDataSource = JdbcDataSourceProvider.createOneSessionJdbcDataSource(baseConnectionParam, dbType);
logger.info("Init {} success.", getClass().getName());
}

Expand Down

0 comments on commit b8f0beb

Please sign in to comment.