Skip to content

Commit

Permalink
remove assertion when use datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
JakimLi committed Mar 4, 2020
1 parent fa8a022 commit 3846a9c
Showing 1 changed file with 0 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public void executeSqlFromFile(String fileName) throws IOException {

@When("^db: ([^\" ]*) execute sql:$")
public void executeSqlByDb(String dbName, String sql) {
assertNotDefault(dbName);
databaseExecuteContext.statement(expressions.evaluate(sql));
databaseExecuteContext.dataSource(dataSources.dataSource(dbName));
databaseExecuteContext.execute();
Expand All @@ -106,17 +105,10 @@ public void executeSqlByDb(String dbName, String sql) {

@When("^db: ([^\" ]*) execute sql: ([^\"]*)$")
public void executeSqlFromFileByDb(String dbName, String fileName) throws IOException {
assertNotDefault(dbName);
String file = configuration.classpathFile(fileName);
databaseExecuteContext.dataSource(dataSources.dataSource(dbName));
databaseExecuteContext.statement(expressions.evaluate(read(file)));
databaseExecuteContext.execute();
wait.waitable(databaseExecuteContext);
}

private void assertNotDefault(String dbName) {
if (dbName.equalsIgnoreCase(DEFAULT)) {
throw new RuntimeException("default is a reserved datasource name");
}
}
}

0 comments on commit 3846a9c

Please sign in to comment.