提交 87792db5 authored 作者: Noel Grandin's avatar Noel Grandin

improve unit test cleanup

上级 7f3e1936
......@@ -245,6 +245,7 @@ public class TestFullText extends TestBase {
trace("Testing multithreaded " + prefix);
deleteDb("fullText");
ArrayList<Connection> connList = new ArrayList<Connection>();
try {
int len = 2;
Task[] task = new Task[len];
for (int i = 0; i < len; i++) {
......@@ -309,8 +310,10 @@ public class TestFullText extends TestBase {
t.get();
trace("done joining " + t);
}
} finally {
close(connList);
}
}
private void testStreamLob() throws SQLException {
deleteDb("fullText");
......
......@@ -64,7 +64,7 @@ public class TestRights extends TestBase {
private void testLinkedTableMeta() throws SQLException {
deleteDb("rights");
Connection conn = getConnection("rights");
try (Connection conn = getConnection("rights")) {
stat = conn.createStatement();
stat.execute("create user test password 'test'");
stat.execute("create linked table test" +
......@@ -100,7 +100,7 @@ public class TestRights extends TestBase {
conn2.close();
stat.execute("drop table test");
conn.close();
}
}
private void testGrantMore() throws SQLException {
......
......@@ -111,17 +111,16 @@ public class TestMVTableEngine extends TestBase {
private void testLobReuse() throws Exception {
deleteDb(getTestName());
Connection conn = getConnection(getTestName());
Statement stat = conn.createStatement();
Connection conn1 = getConnection(getTestName());
Statement stat = conn1.createStatement();
stat.execute("create table test(id identity primary key, lob clob)");
conn.close();
byte[] buffer = new byte[8192];
for (int i = 0; i < 20; i++) {
conn = getConnection(getTestName());
stat = conn.createStatement();
Connection conn2 = getConnection(getTestName());
stat = conn2.createStatement();
stat.execute("insert into test(lob) select space(1025) from system_range(1, 10)");
stat.execute("delete from test where random() > 0.5");
ResultSet rs = conn.createStatement().executeQuery(
ResultSet rs = conn2.createStatement().executeQuery(
"select lob from test");
while (rs.next()) {
InputStream is = rs.getBinaryStream(1);
......@@ -129,8 +128,9 @@ public class TestMVTableEngine extends TestBase {
// ignore
}
}
conn.close();
conn2.close();
}
conn1.close();
}
private void testShutdownDuringLobCreation() throws Exception {
......@@ -175,6 +175,7 @@ public class TestMVTableEngine extends TestBase {
stat.execute("shutdown immediately");
Exception ex = t.getException();
assertTrue(ex != null);
ex.printStackTrace();
try {
conn.close();
} catch (Exception e) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论