提交 1aaf2dea 编写于 作者: T terrymanu

for #601: remove useless DbTestException

上级 f9f2dd5d
......@@ -17,6 +17,7 @@
package io.shardingjdbc.dbtest.asserts;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import io.shardingjdbc.core.api.MasterSlaveDataSourceFactory;
import io.shardingjdbc.core.api.ShardingDataSourceFactory;
......@@ -36,7 +37,6 @@ import io.shardingjdbc.dbtest.env.DatabaseTypeEnvironment;
import io.shardingjdbc.dbtest.env.EnvironmentPath;
import io.shardingjdbc.dbtest.env.datasource.DataSourceUtil;
import io.shardingjdbc.dbtest.env.schema.SchemaEnvironmentManager;
import io.shardingjdbc.dbtest.exception.DbTestException;
import io.shardingjdbc.test.sql.SQLCaseType;
import io.shardingjdbc.test.sql.SQLCasesLoader;
import lombok.AccessLevel;
......@@ -185,12 +185,8 @@ public final class AssertEngine {
Map<String, DatasetDefinition> mapDatasetDefinition = new HashMap<>();
Map<String, String> sqls = new HashMap<>();
getInitDatas(dataSourceNames, initDataFile, mapDatasetDefinition, sqls);
if (mapDatasetDefinition.isEmpty()) {
throw new DbTestException("Use cases cannot be parsed");
}
if (sqls.isEmpty()) {
throw new DbTestException("The use case cannot initialize the data");
}
Preconditions.checkState(!mapDatasetDefinition.isEmpty(), "Use cases cannot be parsed");
Preconditions.checkState(!sqls.isEmpty(), "The use case cannot initialize the data");
String expectedDataFile = rootPath + "asserts/dml/" + shardingRuleType + "/" + dmlDefinition.getExpectedDataFile();
if (!new File(expectedDataFile).exists()) {
expectedDataFile = rootPath + "asserts/dml/" + dmlDefinition.getExpectedDataFile();
......@@ -322,12 +318,8 @@ public final class AssertEngine {
Map<String, DatasetDefinition> mapDatasetDefinition = new HashMap<>();
Map<String, String> sqls = new HashMap<>();
getInitDatas(dataSourceNames, initDataFile, mapDatasetDefinition, sqls);
if (mapDatasetDefinition.isEmpty()) {
throw new DbTestException("Use cases cannot be parsed");
}
if (sqls.isEmpty()) {
throw new DbTestException("The use case cannot initialize the data");
}
Preconditions.checkState(!mapDatasetDefinition.isEmpty(), "Use cases cannot be parsed");
Preconditions.checkState(!sqls.isEmpty(), "The use case cannot initialize the data");
try {
initTableData(dataSourceMaps, sqls, mapDatasetDefinition);
String expectedDataFile = rootPath + "asserts/dql/" + shardingRuleType + "/" + dqlDefinition.getExpectedDataFile();
......
/*
* Copyright 1999-2015 dangdang.com.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* </p>
*/
package io.shardingjdbc.dbtest.exception;
public class DbTestException extends RuntimeException {
private static final long serialVersionUID = 8269224755642356888L;
public DbTestException(final String message) {
super(message);
}
public DbTestException(final Throwable cause) {
super(cause);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册