diff --git a/docs/content/user-manual/usage/tracing/spring-namespace.cn.md b/docs/content/user-manual/usage/tracing/spring-namespace.cn.md index bb5c497ef2..c45b5008ac 100644 --- a/docs/content/user-manual/usage/tracing/spring-namespace.cn.md +++ b/docs/content/user-manual/usage/tracing/spring-namespace.cn.md @@ -35,9 +35,9 @@ chapter = true - + - + diff --git a/docs/content/user-manual/usage/tracing/spring-namespace.en.md b/docs/content/user-manual/usage/tracing/spring-namespace.en.md index d5f68f07f1..c58c531938 100644 --- a/docs/content/user-manual/usage/tracing/spring-namespace.en.md +++ b/docs/content/user-manual/usage/tracing/spring-namespace.en.md @@ -33,9 +33,9 @@ chapter = true - + - + diff --git a/ecosystem/tracing/rdb/pom.xml b/ecosystem/tracing/rdb/pom.xml index 1bf77c6f3a..2dcc16378e 100644 --- a/ecosystem/tracing/rdb/pom.xml +++ b/ecosystem/tracing/rdb/pom.xml @@ -40,11 +40,6 @@ test - - org.apache.commons - commons-dbcp2 - test - com.zaxxer HikariCP diff --git a/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/config/RDBTracingStorageConfigurationTest.java b/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/config/RDBTracingStorageConfigurationTest.java index 2ba5f83811..b733454f94 100644 --- a/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/config/RDBTracingStorageConfigurationTest.java +++ b/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/config/RDBTracingStorageConfigurationTest.java @@ -18,17 +18,13 @@ package org.apache.shardingsphere.elasticjob.tracing.rdb.config; import com.zaxxer.hikari.HikariDataSource; -import org.apache.commons.dbcp2.BasicDataSource; import org.junit.jupiter.api.Test; +import javax.sql.DataSource; import java.sql.SQLException; -import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; -import static org.hamcrest.CoreMatchers.hasItem; -import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.MatcherAssert.assertThat; @@ -119,29 +115,25 @@ void assertDifferentHashCode() { targetDataSourceConfig.getProps().put("password", "root"); assertThat(originalDataSourceConfig.hashCode(), not(targetDataSourceConfig.hashCode())); originalDataSourceConfig = new RDBTracingStorageConfiguration(HikariDataSource.class.getName()); - targetDataSourceConfig = new RDBTracingStorageConfiguration(BasicDataSource.class.getName()); + targetDataSourceConfig = new RDBTracingStorageConfiguration(DataSource.class.getName()); assertThat(originalDataSourceConfig.hashCode(), not(targetDataSourceConfig.hashCode())); } - @SuppressWarnings("unchecked") @Test void assertGetDataSourceConfigurationWithConnectionInitSqls() { - BasicDataSource actualDataSource = new BasicDataSource(); + HikariDataSource actualDataSource = new HikariDataSource(); actualDataSource.setDriverClassName("org.h2.Driver"); - actualDataSource.setUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL"); + actualDataSource.setJdbcUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL"); actualDataSource.setUsername("root"); actualDataSource.setPassword("root"); - actualDataSource.setConnectionInitSqls(Arrays.asList("set names utf8mb4;", "set names utf8;")); + actualDataSource.setConnectionInitSql("set names utf8mb4;set names utf8;"); RDBTracingStorageConfiguration actual = RDBTracingStorageConfiguration.getDataSourceConfiguration(actualDataSource); - assertThat(actual.getDataSourceClassName(), is(BasicDataSource.class.getName())); + assertThat(actual.getDataSourceClassName(), is(HikariDataSource.class.getName())); assertThat(actual.getProps().get("driverClassName").toString(), is("org.h2.Driver")); - assertThat(actual.getProps().get("url").toString(), is("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL")); + assertThat(actual.getProps().get("jdbcUrl").toString(), is("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MySQL")); assertThat(actual.getProps().get("username").toString(), is("root")); assertThat(actual.getProps().get("password").toString(), is("root")); assertNull(actual.getProps().get("loginTimeout")); - assertThat(actual.getProps().get("connectionInitSqls"), instanceOf(List.class)); - List actualConnectionInitSql = (List) actual.getProps().get("connectionInitSqls"); - assertThat(actualConnectionInitSql, hasItem("set names utf8mb4;")); - assertThat(actualConnectionInitSql, hasItem("set names utf8;")); + assertThat(actual.getProps().get("connectionInitSql"), is("set names utf8mb4;set names utf8;")); } } diff --git a/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/listener/RDBTracingListenerFactoryTest.java b/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/listener/RDBTracingListenerFactoryTest.java index 78a1469088..eaa8bac8a0 100644 --- a/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/listener/RDBTracingListenerFactoryTest.java +++ b/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/listener/RDBTracingListenerFactoryTest.java @@ -17,12 +17,11 @@ package org.apache.shardingsphere.elasticjob.tracing.rdb.listener; -import org.apache.commons.dbcp2.BasicDataSource; +import com.zaxxer.hikari.HikariDataSource; import org.apache.shardingsphere.elasticjob.spi.tracing.exception.TracingConfigurationException; import org.junit.jupiter.api.Test; import javax.sql.DataSource; - import java.sql.SQLException; import static org.hamcrest.CoreMatchers.instanceOf; @@ -35,9 +34,9 @@ class RDBTracingListenerFactoryTest { @Test void assertCreateTracingListenerSuccess() throws TracingConfigurationException { - BasicDataSource dataSource = new BasicDataSource(); + HikariDataSource dataSource = new HikariDataSource(); dataSource.setDriverClassName(org.h2.Driver.class.getName()); - dataSource.setUrl("jdbc:h2:mem:job_event_storage"); + dataSource.setJdbcUrl("jdbc:h2:mem:job_event_storage"); dataSource.setUsername("sa"); dataSource.setPassword(""); assertThat(new RDBTracingListenerFactory().create(dataSource), instanceOf(RDBTracingListener.class)); diff --git a/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/listener/RDBTracingListenerTest.java b/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/listener/RDBTracingListenerTest.java index 1f146704b7..a21fff4f4c 100644 --- a/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/listener/RDBTracingListenerTest.java +++ b/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/listener/RDBTracingListenerTest.java @@ -17,10 +17,10 @@ package org.apache.shardingsphere.elasticjob.tracing.rdb.listener; -import org.apache.commons.dbcp2.BasicDataSource; -import org.apache.shardingsphere.elasticjob.spi.executor.ExecutionType; -import org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobTracingEventBus; +import com.zaxxer.hikari.HikariDataSource; import org.apache.shardingsphere.elasticjob.kernel.tracing.config.TracingConfiguration; +import org.apache.shardingsphere.elasticjob.kernel.tracing.event.JobTracingEventBus; +import org.apache.shardingsphere.elasticjob.spi.executor.ExecutionType; import org.apache.shardingsphere.elasticjob.spi.tracing.event.JobExecutionEvent; import org.apache.shardingsphere.elasticjob.spi.tracing.event.JobStatusTraceEvent; import org.apache.shardingsphere.elasticjob.spi.tracing.event.JobStatusTraceEvent.State; @@ -50,9 +50,9 @@ class RDBTracingListenerTest { @BeforeEach void setUp() throws SQLException { - BasicDataSource dataSource = new BasicDataSource(); + HikariDataSource dataSource = new HikariDataSource(); dataSource.setDriverClassName(org.h2.Driver.class.getName()); - dataSource.setUrl("jdbc:h2:mem:job_event_storage"); + dataSource.setJdbcUrl("jdbc:h2:mem:job_event_storage"); dataSource.setUsername("sa"); dataSource.setPassword(""); RDBTracingListener tracingListener = new RDBTracingListener(dataSource); diff --git a/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/storage/repository/RDBJobEventRepositoryTest.java b/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/storage/repository/RDBJobEventRepositoryTest.java index 9afa7b6f91..ee239ece63 100644 --- a/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/storage/repository/RDBJobEventRepositoryTest.java +++ b/ecosystem/tracing/rdb/src/test/java/org/apache/shardingsphere/elasticjob/tracing/rdb/storage/repository/RDBJobEventRepositoryTest.java @@ -17,7 +17,7 @@ package org.apache.shardingsphere.elasticjob.tracing.rdb.storage.repository; -import org.apache.commons.dbcp2.BasicDataSource; +import com.zaxxer.hikari.HikariDataSource; import org.apache.shardingsphere.elasticjob.spi.executor.ExecutionType; import org.apache.shardingsphere.elasticjob.spi.tracing.event.JobExecutionEvent; import org.apache.shardingsphere.elasticjob.spi.tracing.event.JobStatusTraceEvent; @@ -39,20 +39,20 @@ class RDBJobEventRepositoryTest { private RDBJobEventRepository repository; - private BasicDataSource dataSource; + private HikariDataSource dataSource; @BeforeEach void setup() throws SQLException { - dataSource = new BasicDataSource(); + dataSource = new HikariDataSource(); dataSource.setDriverClassName(org.h2.Driver.class.getName()); - dataSource.setUrl("jdbc:h2:mem:job_event_storage"); + dataSource.setJdbcUrl("jdbc:h2:mem:job_event_storage"); dataSource.setUsername("sa"); dataSource.setPassword(""); repository = RDBJobEventRepository.getInstance(dataSource); } @AfterEach - void teardown() throws SQLException { + void tearDown() { dataSource.close(); } diff --git a/examples/elasticjob-example-spring/src/main/resources/META-INF/application-context.xml b/examples/elasticjob-example-spring/src/main/resources/META-INF/application-context.xml index 4706d4fda0..94acf66557 100644 --- a/examples/elasticjob-example-spring/src/main/resources/META-INF/application-context.xml +++ b/examples/elasticjob-example-spring/src/main/resources/META-INF/application-context.xml @@ -36,9 +36,9 @@ - + - + diff --git a/pom.xml b/pom.xml index 8ef6e35f32..13f3c90577 100644 --- a/pom.xml +++ b/pom.xml @@ -91,8 +91,6 @@ 2.2.224 4.0.3 - 2.10.0 - 2.11.1 3.2.1 @@ -359,17 +357,6 @@ HikariCP ${hikari-cp.version} - - org.apache.commons - commons-dbcp2 - ${commons-dbcp2.version} - test - - - org.apache.commons - commons-pool2 - ${commons-pool2.version} - diff --git a/spring/namespace/pom.xml b/spring/namespace/pom.xml index 48ba28d340..62d842f237 100644 --- a/spring/namespace/pom.xml +++ b/spring/namespace/pom.xml @@ -80,11 +80,6 @@ com.h2database h2 - - org.apache.commons - commons-dbcp2 - test - org.awaitility awaitility diff --git a/spring/namespace/src/test/resources/META-INF/job/base.xml b/spring/namespace/src/test/resources/META-INF/job/base.xml index b2b83c4509..9162e848bd 100644 --- a/spring/namespace/src/test/resources/META-INF/job/base.xml +++ b/spring/namespace/src/test/resources/META-INF/job/base.xml @@ -32,9 +32,9 @@ - + - +