You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2022/09/16 18:50:05 UTC
[shardingsphere] branch master updated: Add PrepareJobWithCheckPrivilegeFailedException (#21025)
This is an automated email from the ASF dual-hosted git repository.
wuweijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 58c0c9bcc0f Add PrepareJobWithCheckPrivilegeFailedException (#21025)
58c0c9bcc0f is described below
commit 58c0c9bcc0f7f98585a781c023c10aade7abe889
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Sep 17 02:49:45 2022 +0800
Add PrepareJobWithCheckPrivilegeFailedException (#21025)
* Add PrepareJobWithCheckPrivilegeFailedException
* Add PrepareJobWithCheckPrivilegeFailedException
* Add PrepareJobWithCheckPrivilegeFailedException
* Add PrepareJobWithInvalidConnectionException
---
.../user-manual/error-code/sql-error-code.cn.md | 2 ++
.../user-manual/error-code/sql-error-code.en.md | 2 ++
.../check/datasource/AbstractDataSourceChecker.java | 6 +++---
.../job/PipelineJobPrepareFailedException.java | 4 ----
... PrepareJobWithCheckPrivilegeFailedException.java} | 19 ++++++++++---------
... => PrepareJobWithInvalidConnectionException.java} | 19 ++++++++++---------
.../check/datasource/MySQLDataSourceChecker.java | 6 +++---
.../check/datasource/MySQLDataSourceCheckerTest.java | 6 +++---
.../check/datasource/OpenGaussDataSourceChecker.java | 4 ++--
.../check/datasource/PostgreSQLDataSourceChecker.java | 4 ++--
.../datasource/AbstractDataSourceCheckerTest.java | 4 ++--
11 files changed, 39 insertions(+), 37 deletions(-)
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.cn.md b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
index b485a76384b..696a8d68f2f 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.cn.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
@@ -100,6 +100,8 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| 01007 | 18085 | Source data source lacks %s privilege(s) |
| HY000 | 18086 | Source data source required \`%s = %s\`, now is \`%s\` |
| HY000 | 18087 | User \`%s\` does exist |
+| 08000 | 18088 | Check privileges failed on source data source, reason is: %s |
+| 08000 | 18089 | Data sources can not connect, reason is: %s |
| HY000 | 18090 | Importer job write data failed |
| HY000 | 18091 | Can not poll event because of binlog sync channel already closed |
| HY000 | 18092 | Task \`%s\` execute failed |
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.en.md b/docs/document/content/user-manual/error-code/sql-error-code.en.md
index 2472ef0f813..34e7a05e089 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.en.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.en.md
@@ -100,6 +100,8 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
| 01007 | 18085 | Source data source lacks %s privilege(s) |
| HY000 | 18086 | Source data source required \`%s = %s\`, now is \`%s\` |
| HY000 | 18087 | User \`%s\` does exist |
+| 08000 | 18088 | Check privileges failed on source data source, reason is: %s |
+| 08000 | 18089 | Data sources can not connect, reason is: %s |
| HY000 | 18090 | Importer job write data failed |
| HY000 | 18091 | Can not poll event because of binlog sync channel already closed |
| HY000 | 18092 | Task \`%s\` execute failed |
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/datasource/AbstractDataSourceChecker.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/datasource/AbstractDataSourceChecker.java
index 1cb1c72f28e..847cae0ac4e 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/datasource/AbstractDataSourceChecker.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/check/datasource/AbstractDataSourceChecker.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.data.pipeline.core.check.datasource;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.data.pipeline.api.config.TableNameSchemaNameMapping;
-import org.apache.shardingsphere.data.pipeline.core.exception.job.PipelineJobPrepareFailedException;
+import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithInvalidConnectionException;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithTargetTableNotEmptyException;
import org.apache.shardingsphere.data.pipeline.core.sqlbuilder.PipelineSQLBuilderFactory;
import org.apache.shardingsphere.data.pipeline.spi.check.datasource.DataSourceChecker;
@@ -46,7 +46,7 @@ public abstract class AbstractDataSourceChecker implements DataSourceChecker {
each.getConnection().close();
}
} catch (final SQLException ex) {
- throw new PipelineJobPrepareFailedException("Data sources can not connect.", ex);
+ throw new PrepareJobWithInvalidConnectionException(ex);
}
}
@@ -57,7 +57,7 @@ public abstract class AbstractDataSourceChecker implements DataSourceChecker {
checkEmpty(each, tableNameSchemaNameMapping, logicTableNames);
}
} catch (final SQLException ex) {
- throw new PipelineJobPrepareFailedException("Check target table failed.", ex);
+ throw new PrepareJobWithInvalidConnectionException(ex);
}
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PipelineJobPrepareFailedException.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PipelineJobPrepareFailedException.java
index fb90b7899d5..ceefc0c1a7f 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PipelineJobPrepareFailedException.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PipelineJobPrepareFailedException.java
@@ -24,10 +24,6 @@ public final class PipelineJobPrepareFailedException extends RuntimeException {
private static final long serialVersionUID = 1409505606319197767L;
- public PipelineJobPrepareFailedException(final String message) {
- super(message);
- }
-
public PipelineJobPrepareFailedException(final String message, final Throwable cause) {
super(message, cause);
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PipelineJobPrepareFailedException.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PrepareJobWithCheckPrivilegeFailedException.java
similarity index 58%
copy from shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PipelineJobPrepareFailedException.java
copy to shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PrepareJobWithCheckPrivilegeFailedException.java
index fb90b7899d5..4685cedbf9e 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PipelineJobPrepareFailedException.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PrepareJobWithCheckPrivilegeFailedException.java
@@ -17,18 +17,19 @@
package org.apache.shardingsphere.data.pipeline.core.exception.job;
+import org.apache.shardingsphere.data.pipeline.core.exception.PipelineSQLException;
+import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
+
+import java.sql.SQLException;
+
/**
- * Pipeline job prepare failed exception.
+ * Prepare job with check privilege failed exception.
*/
-public final class PipelineJobPrepareFailedException extends RuntimeException {
+public final class PrepareJobWithCheckPrivilegeFailedException extends PipelineSQLException {
- private static final long serialVersionUID = 1409505606319197767L;
-
- public PipelineJobPrepareFailedException(final String message) {
- super(message);
- }
+ private static final long serialVersionUID = -8462039913248251254L;
- public PipelineJobPrepareFailedException(final String message, final Throwable cause) {
- super(message, cause);
+ public PrepareJobWithCheckPrivilegeFailedException(final SQLException cause) {
+ super(XOpenSQLState.CONNECTION_EXCEPTION, 88, "Check privileges failed on source data source, reason is: %s", cause.getMessage());
}
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PipelineJobPrepareFailedException.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PrepareJobWithInvalidConnectionException.java
similarity index 59%
copy from shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PipelineJobPrepareFailedException.java
copy to shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PrepareJobWithInvalidConnectionException.java
index fb90b7899d5..b3147798751 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PipelineJobPrepareFailedException.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/exception/job/PrepareJobWithInvalidConnectionException.java
@@ -17,18 +17,19 @@
package org.apache.shardingsphere.data.pipeline.core.exception.job;
+import org.apache.shardingsphere.data.pipeline.core.exception.PipelineSQLException;
+import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
+
+import java.sql.SQLException;
+
/**
- * Pipeline job prepare failed exception.
+ * Prepare job with invalid connection exception.
*/
-public final class PipelineJobPrepareFailedException extends RuntimeException {
+public final class PrepareJobWithInvalidConnectionException extends PipelineSQLException {
- private static final long serialVersionUID = 1409505606319197767L;
-
- public PipelineJobPrepareFailedException(final String message) {
- super(message);
- }
+ private static final long serialVersionUID = 208040912786493973L;
- public PipelineJobPrepareFailedException(final String message, final Throwable cause) {
- super(message, cause);
+ public PrepareJobWithInvalidConnectionException(final SQLException cause) {
+ super(XOpenSQLState.CONNECTION_EXCEPTION, 89, "Data sources can not connect, reason is: %s", cause.getMessage());
}
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/check/datasource/MySQLDataSourceChecker.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/check/datasource/MySQLDataSourceChecker.java
index b9fbd8ec426..d2228cd6fa4 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/check/datasource/MySQLDataSourceChecker.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/check/datasource/MySQLDataSourceChecker.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.data.pipeline.mysql.check.datasource;
import org.apache.shardingsphere.data.pipeline.core.check.datasource.AbstractDataSourceChecker;
-import org.apache.shardingsphere.data.pipeline.core.exception.job.PipelineJobPrepareFailedException;
+import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithCheckPrivilegeFailedException;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithInvalidSourceDataSourceException;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithoutEnoughPrivilegeException;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
@@ -74,7 +74,7 @@ public final class MySQLDataSourceChecker extends AbstractDataSourceChecker {
}
}
} catch (final SQLException ex) {
- throw new PipelineJobPrepareFailedException("Source data source check privileges failed.", ex);
+ throw new PrepareJobWithCheckPrivilegeFailedException(ex);
}
throw new PrepareJobWithoutEnoughPrivilegeException(Arrays.asList("REPLICATION SLAVE", "REPLICATION CLIENT"));
}
@@ -96,7 +96,7 @@ public final class MySQLDataSourceChecker extends AbstractDataSourceChecker {
checkVariable(connection, entry.getKey(), entry.getValue());
}
} catch (final SQLException ex) {
- throw new PipelineJobPrepareFailedException("Source data source check variables failed.", ex);
+ throw new PrepareJobWithCheckPrivilegeFailedException(ex);
}
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/check/datasource/MySQLDataSourceCheckerTest.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/check/datasource/MySQLDataSourceCheckerTest.java
index f6da65307cf..e34dec61e30 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/check/datasource/MySQLDataSourceCheckerTest.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/test/java/org/apache/shardingsphere/data/pipeline/mysql/check/datasource/MySQLDataSourceCheckerTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.data.pipeline.mysql.check.datasource;
-import org.apache.shardingsphere.data.pipeline.core.exception.job.PipelineJobPrepareFailedException;
+import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithCheckPrivilegeFailedException;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithInvalidSourceDataSourceException;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithoutEnoughPrivilegeException;
import org.junit.Before;
@@ -80,7 +80,7 @@ public final class MySQLDataSourceCheckerTest {
new MySQLDataSourceChecker().checkPrivilege(dataSources);
}
- @Test(expected = PipelineJobPrepareFailedException.class)
+ @Test(expected = PrepareJobWithCheckPrivilegeFailedException.class)
public void assertCheckPrivilegeFailure() throws SQLException {
when(resultSet.next()).thenThrow(new SQLException(""));
new MySQLDataSourceChecker().checkPrivilege(dataSources);
@@ -101,7 +101,7 @@ public final class MySQLDataSourceCheckerTest {
new MySQLDataSourceChecker().checkVariable(dataSources);
}
- @Test(expected = PipelineJobPrepareFailedException.class)
+ @Test(expected = PrepareJobWithCheckPrivilegeFailedException.class)
public void assertCheckVariableFailure() throws SQLException {
when(resultSet.next()).thenThrow(new SQLException(""));
new MySQLDataSourceChecker().checkVariable(dataSources);
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/check/datasource/OpenGaussDataSourceChecker.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/check/datasource/OpenGaussDataSourceChecker.java
index 18a4d77280d..cffbaae4150 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/check/datasource/OpenGaussDataSourceChecker.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/check/datasource/OpenGaussDataSourceChecker.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.data.pipeline.opengauss.check.datasource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shardingsphere.data.pipeline.core.check.datasource.AbstractDataSourceChecker;
-import org.apache.shardingsphere.data.pipeline.core.exception.job.PipelineJobPrepareFailedException;
+import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithCheckPrivilegeFailedException;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithoutEnoughPrivilegeException;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithoutUserException;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
@@ -64,7 +64,7 @@ public final class OpenGaussDataSourceChecker extends AbstractDataSourceChecker
() -> new PrepareJobWithoutEnoughPrivilegeException(Collections.singleton("REPLICATION")));
}
} catch (final SQLException ex) {
- throw new PipelineJobPrepareFailedException("Source data source check privileges failed.", ex);
+ throw new PrepareJobWithCheckPrivilegeFailedException(ex);
}
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/check/datasource/PostgreSQLDataSourceChecker.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/check/datasource/PostgreSQLDataSourceChecker.java
index cfea7e8eba8..749d6feacbd 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/check/datasource/PostgreSQLDataSourceChecker.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/check/datasource/PostgreSQLDataSourceChecker.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.data.pipeline.postgresql.check.datasource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shardingsphere.data.pipeline.core.check.datasource.AbstractDataSourceChecker;
-import org.apache.shardingsphere.data.pipeline.core.exception.job.PipelineJobPrepareFailedException;
+import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithCheckPrivilegeFailedException;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithoutEnoughPrivilegeException;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithoutUserException;
import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
@@ -63,7 +63,7 @@ public class PostgreSQLDataSourceChecker extends AbstractDataSourceChecker {
() -> new PrepareJobWithoutEnoughPrivilegeException(Collections.singleton("REPLICATION")));
}
} catch (final SQLException ex) {
- throw new PipelineJobPrepareFailedException("Source data source check privileges failed.", ex);
+ throw new PrepareJobWithCheckPrivilegeFailedException(ex);
}
}
diff --git a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/check/datasource/AbstractDataSourceCheckerTest.java b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/check/datasource/AbstractDataSourceCheckerTest.java
index 01e9745fc5d..e59882160c2 100644
--- a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/check/datasource/AbstractDataSourceCheckerTest.java
+++ b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/core/check/datasource/AbstractDataSourceCheckerTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.data.pipeline.core.check.datasource;
import lombok.SneakyThrows;
import org.apache.shardingsphere.data.pipeline.api.config.TableNameSchemaNameMapping;
-import org.apache.shardingsphere.data.pipeline.core.exception.job.PipelineJobPrepareFailedException;
+import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithInvalidConnectionException;
import org.apache.shardingsphere.data.pipeline.core.exception.job.PrepareJobWithTargetTableNotEmptyException;
import org.junit.Before;
import org.junit.Test;
@@ -87,7 +87,7 @@ public final class AbstractDataSourceCheckerTest {
verify(dataSource).getConnection();
}
- @Test(expected = PipelineJobPrepareFailedException.class)
+ @Test(expected = PrepareJobWithInvalidConnectionException.class)
public void assertCheckConnectionFailed() throws SQLException {
when(dataSource.getConnection()).thenThrow(new SQLException("error"));
dataSourceChecker.checkConnection(dataSources);