提交 ba4ec6b7 authored 作者: Vitaly Dyachkov's avatar Vitaly Dyachkov

unit test for LOB recovery is adjusted to H2 approach

上级 35b408d6
...@@ -114,6 +114,7 @@ import org.h2.test.mvcc.TestMvcc3; ...@@ -114,6 +114,7 @@ import org.h2.test.mvcc.TestMvcc3;
import org.h2.test.mvcc.TestMvcc4; import org.h2.test.mvcc.TestMvcc4;
import org.h2.test.mvcc.TestMvccMultiThreaded; import org.h2.test.mvcc.TestMvccMultiThreaded;
import org.h2.test.poweroff.TestReorderWrites; import org.h2.test.poweroff.TestReorderWrites;
import org.h2.test.recover.RecoverLobTest;
import org.h2.test.rowlock.TestRowLocks; import org.h2.test.rowlock.TestRowLocks;
import org.h2.test.server.TestAutoServer; import org.h2.test.server.TestAutoServer;
import org.h2.test.server.TestInit; import org.h2.test.server.TestInit;
...@@ -858,6 +859,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -858,6 +859,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
addTest(new TestReader()); addTest(new TestReader());
addTest(new TestRecovery()); addTest(new TestRecovery());
addTest(new TestScriptReader()); addTest(new TestScriptReader());
addTest(new RecoverLobTest());
addTest(createTest("org.h2.test.unit.TestServlet")); addTest(createTest("org.h2.test.unit.TestServlet"));
addTest(new TestSecurity()); addTest(new TestSecurity());
addTest(new TestShell()); addTest(new TestShell());
...@@ -873,6 +875,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -873,6 +875,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
addTest(new TestValueHashMap()); addTest(new TestValueHashMap());
addTest(new TestWeb()); addTest(new TestWeb());
runAddedTests(); runAddedTests();
// serial // serial
......
package org.h2.test.recover; package org.h2.test.recover;
import static org.junit.Assert.*;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Statement; import java.sql.Statement;
...@@ -9,25 +7,27 @@ import java.sql.Statement; ...@@ -9,25 +7,27 @@ import java.sql.Statement;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.tools.DeleteDbFiles; import org.h2.tools.DeleteDbFiles;
import org.h2.tools.Recover; import org.h2.tools.Recover;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class RecoverLobTest extends TestBase { public class RecoverLobTest extends TestBase {
@Before public static void main(String... a) throws Exception {
public void setUp() throws Exception{ TestBase.createCaller().init().test();
init(); }
@Override
public TestBase init() throws Exception {
TestBase tb = super.init();
config.mvStore=false; config.mvStore=false;
return tb;
} }
@Override @Override
public void test() throws Exception { public void test() throws Exception {
testRecoverClob();
} }
@Test
public void testRecoverClob() throws Exception { public void testRecoverClob() throws Exception {
DeleteDbFiles.execute(getBaseDir(), "recovery", true); DeleteDbFiles.execute(getBaseDir(), "recovery", true);
Connection conn = getConnection("recovery"); Connection conn = getConnection("recovery");
...@@ -56,8 +56,8 @@ public class RecoverLobTest extends TestBase { ...@@ -56,8 +56,8 @@ public class RecoverLobTest extends TestBase {
int id = rs.getInt(1); int id = rs.getInt(1);
String data = rs.getString(2); String data = rs.getString(2);
Assert.assertNotNull(data); assertTrue(data != null);
Assert.assertTrue(data.length() == 10000 * id); assertTrue(data.length() == 10000 * id);
} }
rs.close(); rs.close();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论