diff --git a/infra/data-source-pool/core/pom.xml b/infra/data-source-pool/core/pom.xml index 3becbf881ee417..b44d8895ea400f 100644 --- a/infra/data-source-pool/core/pom.xml +++ b/infra/data-source-pool/core/pom.xml @@ -54,5 +54,16 @@ ${project.version} test + + com.h2database + h2 + test + + + com.alibaba + druid + ${druid.version} + test + diff --git a/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreatorTest.java b/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreatorTest.java index 5c3ea17f30f243..7b48d76b7ec2c0 100644 --- a/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreatorTest.java +++ b/infra/data-source-pool/core/src/test/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourcePoolCreatorTest.java @@ -17,18 +17,20 @@ package org.apache.shardingsphere.infra.datasource.pool.creator; +import com.alibaba.druid.pool.DruidDataSource; import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties; import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource; import org.junit.jupiter.api.Test; import javax.sql.DataSource; +import java.sql.SQLException; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import static org.hamcrest.CoreMatchers.is; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertNull; class DataSourcePoolCreatorTest { @@ -59,4 +61,19 @@ private void assertDataSource(final MockedDataSource actual) { assertThat(actual.getMaxPoolSize(), is(100)); assertNull(actual.getMinPoolSize()); } + + @Test + void assertCreateAlibabaDruidDataSource() throws SQLException { + Map props = new LinkedHashMap<>(4, 1F); + props.put("url", "jdbc:h2:mem:foo_ds"); + props.put("driverClassName", "org.h2.Driver"); + props.put("username", "root"); + props.put("password", "root"); + DruidDataSource dataSource = (DruidDataSource) DataSourcePoolCreator.create(new DataSourcePoolProperties(DruidDataSource.class.getName(), props)); + dataSource.init(); + assertThat(dataSource.getUrl(), is("jdbc:h2:mem:foo_ds")); + assertThat(dataSource.getUsername(), is("root")); + assertThat(dataSource.getPassword(), is("root")); + dataSource.close(); + } } diff --git a/pom.xml b/pom.xml index 1ad4dc4d774c4a..7edde21164000a 100644 --- a/pom.xml +++ b/pom.xml @@ -126,6 +126,7 @@ 2.4.2 4.0.3 + 1.2.22 0.11.0 0.16.1