Skip to content

Commit

Permalink
for apache#601, removed useless codes for StatementAdapterTest
Browse files Browse the repository at this point in the history
  • Loading branch information
haocao committed Aug 2, 2018
1 parent 1b36a4b commit 406e5b1
Showing 1 changed file with 11 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,11 @@ public void assertClose() throws SQLException {
@Test
public void assertSetPoolable() throws SQLException {
for (Map.Entry<DatabaseType, Statement> each : statements.entrySet()) {
if (DatabaseType.Oracle != each.getKey()) {
each.getValue().setPoolable(true);
each.getValue().executeQuery(sql);
assertPoolable((ShardingStatement) each.getValue(), true, each.getKey());
each.getValue().setPoolable(false);
assertPoolable((ShardingStatement) each.getValue(), false, each.getKey());
}
each.getValue().setPoolable(true);
each.getValue().executeQuery(sql);
assertPoolable((ShardingStatement) each.getValue(), true, each.getKey());
each.getValue().setPoolable(false);
assertPoolable((ShardingStatement) each.getValue(), false, each.getKey());
}
}

Expand All @@ -98,11 +96,7 @@ private void assertPoolable(final ShardingStatement actual, final boolean poolab
assertThat(actual.getRoutedStatements().size(), is(4));
for (Statement each : actual.getRoutedStatements()) {
// H2数据库未实现setPoolable方法
if (DatabaseType.H2 == type) {
assertFalse(each.isPoolable());
} else {
assertThat(each.isPoolable(), is(poolable));
}
assertFalse(each.isPoolable());
}
}

Expand Down Expand Up @@ -147,11 +141,7 @@ public void assertGetUpdateCount() throws SQLException {
String sql = "DELETE FROM t_order WHERE status = 'init'";
for (Map.Entry<DatabaseType, Statement> each : statements.entrySet()) {
each.getValue().execute(sql);
if (DatabaseType.Oracle == each.getKey()) {
assertThat(each.getValue().getUpdateCount(), is(-4));
} else {
assertThat(each.getValue().getUpdateCount(), is(4));
}
assertThat(each.getValue().getUpdateCount(), is(4));
}
}

Expand All @@ -160,11 +150,7 @@ public void assertGetUpdateCountNoData() throws SQLException {
String sql = "DELETE FROM t_order WHERE status = 'none'";
for (Map.Entry<DatabaseType, Statement> each : statements.entrySet()) {
each.getValue().execute(sql);
if (DatabaseType.Oracle == each.getKey()) {
assertThat(each.getValue().getUpdateCount(), is(-4));
} else {
assertThat(each.getValue().getUpdateCount(), is(0));
}
assertThat(each.getValue().getUpdateCount(), is(0));
}
}

Expand Down Expand Up @@ -361,11 +347,9 @@ public void assertGetQueryTimeoutWithRoutedStatements() throws SQLException {
@Test
public void assertSetQueryTimeout() throws SQLException {
for (Map.Entry<DatabaseType, Statement> each : statements.entrySet()) {
if (DatabaseType.PostgreSQL != each.getKey()) {
each.getValue().executeQuery(sql);
each.getValue().setQueryTimeout(10);
assertThat(each.getValue().getQueryTimeout(), is(10));
}
each.getValue().executeQuery(sql);
each.getValue().setQueryTimeout(10);
assertThat(each.getValue().getQueryTimeout(), is(10));
}
}

Expand Down

0 comments on commit 406e5b1

Please sign in to comment.