Skip to content

Commit

Permalink
Fix empty sql in SQL E2E
Browse files Browse the repository at this point in the history
  • Loading branch information
RaigorJiang committed Oct 27, 2023
1 parent 937a557 commit e038a06
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import java.util.stream.Collectors;

/**
* Result set for show sharding table nodes.
* Show sharding table nodes executor.
*/
public final class ShowShardingTableNodesExecutor implements RQLExecutor<ShowShardingTableNodesStatement> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public interface RQLExecutor<T extends RQLStatement> extends TypedSPI {
/**
* Get query result rows.
*
* @param shardingSphereDatabase ShardingSphere database
* @param database database
* @param sqlStatement SQL statement
* @return query result rows
*/
Collection<LocalDataQueryResultRow> getRows(ShardingSphereDatabase shardingSphereDatabase, T sqlStatement);
Collection<LocalDataQueryResultRow> getRows(ShardingSphereDatabase database, T sqlStatement);

@Override
Class<T> getType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private void executeInitSQLs(final SingleE2EContainerComposer containerComposer,
if (null == containerComposer.getAssertion().getInitialSQL().getSql()) {
return;
}
for (String each : Splitter.on(";").trimResults().splitToList(containerComposer.getAssertion().getInitialSQL().getSql())) {
for (String each : Splitter.on(";").trimResults().omitEmptyStrings().splitToList(containerComposer.getAssertion().getInitialSQL().getSql())) {
try (PreparedStatement preparedStatement = connection.prepareStatement(each)) {
preparedStatement.executeUpdate();
}
Expand All @@ -159,7 +159,7 @@ private void executeDestroySQLs(final SingleE2EContainerComposer containerCompos
if (null == containerComposer.getAssertion().getDestroySQL().getSql()) {
return;
}
for (String each : Splitter.on(";").trimResults().splitToList(containerComposer.getAssertion().getDestroySQL().getSql())) {
for (String each : Splitter.on(";").trimResults().omitEmptyStrings().splitToList(containerComposer.getAssertion().getDestroySQL().getSql())) {
try (PreparedStatement preparedStatement = connection.prepareStatement(each)) {
preparedStatement.executeUpdate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private void executeInitSQLs(final SingleE2EContainerComposer containerComposer,
if (null == containerComposer.getAssertion().getInitialSQL().getSql()) {
return;
}
for (String each : Splitter.on(";").trimResults().splitToList(containerComposer.getAssertion().getInitialSQL().getSql())) {
for (String each : Splitter.on(";").trimResults().omitEmptyStrings().splitToList(containerComposer.getAssertion().getInitialSQL().getSql())) {
try (PreparedStatement preparedStatement = connection.prepareStatement(each)) {
preparedStatement.executeUpdate();
}
Expand All @@ -105,7 +105,7 @@ private void executeDestroySQLs(final SingleE2EContainerComposer containerCompos
if (null == containerComposer.getAssertion().getDestroySQL().getSql()) {
return;
}
for (String each : Splitter.on(";").trimResults().splitToList(containerComposer.getAssertion().getDestroySQL().getSql())) {
for (String each : Splitter.on(";").trimResults().omitEmptyStrings().splitToList(containerComposer.getAssertion().getDestroySQL().getSql())) {
try (PreparedStatement preparedStatement = connection.prepareStatement(each)) {
preparedStatement.executeUpdate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void executeInitSQLs(final SingleE2EContainerComposer containerComposer,
if (null == containerComposer.getAssertion().getInitialSQL() || null == containerComposer.getAssertion().getInitialSQL().getSql()) {
return;
}
for (String each : Splitter.on(";").trimResults().splitToList(containerComposer.getAssertion().getInitialSQL().getSql())) {
for (String each : Splitter.on(";").trimResults().omitEmptyStrings().splitToList(containerComposer.getAssertion().getInitialSQL().getSql())) {
try (PreparedStatement preparedStatement = connection.prepareStatement(each)) {
preparedStatement.executeUpdate();
Awaitility.await().pollDelay(2L, TimeUnit.SECONDS).until(() -> true);
Expand All @@ -111,7 +111,7 @@ private void executeDestroySQLs(final SingleE2EContainerComposer containerCompos
if (null == containerComposer.getAssertion().getDestroySQL().getSql()) {
return;
}
for (String each : Splitter.on(";").trimResults().splitToList(containerComposer.getAssertion().getDestroySQL().getSql())) {
for (String each : Splitter.on(";").trimResults().omitEmptyStrings().splitToList(containerComposer.getAssertion().getDestroySQL().getSql())) {
try (PreparedStatement preparedStatement = connection.prepareStatement(each)) {
preparedStatement.executeUpdate();
Awaitility.await().pollDelay(2L, TimeUnit.SECONDS).until(() -> true);
Expand Down

0 comments on commit e038a06

Please sign in to comment.