Skip to content

Commit

Permalink
Refactor MySQLIncrementalDumperTest
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Nov 5, 2023
1 parent ff0e2b1 commit 1b69b7b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import com.zaxxer.hikari.HikariDataSource;
import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties;
import org.apache.shardingsphere.test.fixture.jdbc.MockedDriver;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import java.util.Collections;
Expand All @@ -27,6 +29,11 @@

class DataSourcePoolPropertiesValidatorTest {

@BeforeAll
static void setUp() throws ClassNotFoundException {
Class.forName(MockedDriver.class.getName());
}

@Test
void assertValidate() {
assertTrue(DataSourcePoolPropertiesValidator.validate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import org.apache.shardingsphere.data.pipeline.mysql.ingest.binlog.event.PlaceholderEvent;
import org.apache.shardingsphere.data.pipeline.mysql.ingest.binlog.event.UpdateRowsEvent;
import org.apache.shardingsphere.data.pipeline.mysql.ingest.binlog.event.WriteRowsEvent;
import org.apache.shardingsphere.test.fixture.jdbc.MockedDriver;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -78,6 +80,11 @@ class MySQLIncrementalDumperTest {

private PipelineTableMetaData pipelineTableMetaData;

@BeforeAll
static void init() throws ClassNotFoundException {
Class.forName(MockedDriver.class.getName());
}

@BeforeEach
void setUp() throws SQLException {
IncrementalDumperContext dumperContext = createDumperContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.util.YamlDatabaseConfigurationImportExecutor;
import org.apache.shardingsphere.test.fixture.jdbc.MockedDriver;
import org.apache.shardingsphere.test.mock.AutoMockExtension;
import org.apache.shardingsphere.test.mock.StaticMockSettings;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.internal.configuration.plugins.Plugins;
Expand All @@ -58,6 +60,11 @@ class ImportDatabaseConfigurationUpdaterTest {

private ImportDatabaseConfigurationUpdater importDatabaseConfigUpdater;

@BeforeAll
static void setUp() throws ClassNotFoundException {
Class.forName(MockedDriver.class.getName());
}

@Test
void assertImportDatabaseExecutorForSharding() throws SQLException {
assertExecute("sharding_db", "/conf/import/config-sharding.yaml");
Expand Down

This file was deleted.

0 comments on commit 1b69b7b

Please sign in to comment.