Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless dependencies #2362

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/content/user-manual/usage/tracing/spring-namespace.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ chapter = true
<bean id="myJob" class="xxx.MyJob" />

<!-- 配置数据源 -->
<bean id="tracingDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<bean id="tracingDataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
<property name="driverClassName" value="${driver.class.name}" />
<property name="url" value="${url}" />
<property name="jdbcUrl" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
</bean>
Expand Down
4 changes: 2 additions & 2 deletions docs/content/user-manual/usage/tracing/spring-namespace.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ chapter = true
<bean id="myJob" class="xxx.MyJob" />

<!-- Configure DataSource -->
<bean id="tracingDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<bean id="tracingDataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
<property name="driverClassName" value="${driver.class.name}" />
<property name="url" value="${url}" />
<property name="jdbcUrl" value="${url}" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
</bean>
Expand Down
5 changes: 0 additions & 5 deletions ecosystem/tracing/rdb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> actualConnectionInitSql = (List<String>) 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;"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@

<elasticjob:snapshot id="jobSnapshot" registry-center-ref="regCenter" dump-port="9999" />

<bean id="elasticJobTracingDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<bean id="elasticJobTracingDataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
<property name="driverClassName" value="${event.rdb.driver}" />
<property name="url" value="${event.rdb.url}" />
<property name="jdbcUrl" value="${event.rdb.url}" />
<property name="username" value="${event.rdb.username}" />
<property name="password" value="${event.rdb.password}" />
</bean>
Expand Down
13 changes: 0 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@

<h2.version>2.2.224</h2.version>
<hikari-cp.version>4.0.3</hikari-cp.version>
<commons-dbcp2.version>2.10.0</commons-dbcp2.version>
<commons-pool2.version>2.11.1</commons-pool2.version>

<!-- Compile plugin versions -->
<maven-enforcer-plugin.version>3.2.1</maven-enforcer-plugin.version>
Expand Down Expand Up @@ -359,17 +357,6 @@
<artifactId>HikariCP</artifactId>
<version>${hikari-cp.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>${commons-dbcp2.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>${commons-pool2.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
5 changes: 0 additions & 5 deletions spring/namespace/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions spring/namespace/src/test/resources/META-INF/job/base.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<elasticjob:zookeeper id="regCenter" server-lists="${regCenter.serverLists}" namespace="${regCenter.namespace}" base-sleep-time-milliseconds="${regCenter.baseSleepTimeMilliseconds}"
max-sleep-time-milliseconds="${regCenter.maxSleepTimeMilliseconds}" max-retries="${regCenter.maxRetries}" />

<bean id="elasticJobTracingDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<bean id="elasticJobTracingDataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
<property name="driverClassName" value="org.h2.Driver" />
<property name="url" value="jdbc:h2:mem:job_event_storage" />
<property name="jdbcUrl" value="jdbc:h2:mem:job_event_storage" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
Expand Down