提交 b9de50b7 authored 作者: Thomas Mueller's avatar Thomas Mueller

Tests

上级 4825106c
......@@ -21,6 +21,7 @@ import java.util.List;
import java.util.Random;
import org.h2.api.ErrorCode;
import org.h2.engine.Constants;
import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase;
......@@ -932,20 +933,22 @@ public class TestCases extends TestBase {
ResultSet rs;
// test the default (SIGNED)
stat.execute("create table bin( x binary(1) );");
stat.execute("insert into bin(x) values (x'09'),(x'0a'),(x'99'),(x'aa');");
rs = stat.executeQuery("select * from bin order by x;");
rs.next();
assertEquals("99", rs.getString(1));
rs.next();
assertEquals("aa", rs.getString(1));
rs.next();
assertEquals("09", rs.getString(1));
rs.next();
assertEquals("0a", rs.getString(1));
if (Constants.VERSION_MINOR < 4) {
stat.execute("create table bin( x binary(1) );");
stat.execute("insert into bin(x) values (x'09'),(x'0a'),(x'99'),(x'aa');");
rs = stat.executeQuery("select * from bin order by x;");
rs.next();
assertEquals("99", rs.getString(1));
rs.next();
assertEquals("aa", rs.getString(1));
rs.next();
assertEquals("09", rs.getString(1));
rs.next();
assertEquals("0a", rs.getString(1));
stat.execute("drop table bin");
}
// test UNSIGNED mode
stat.execute("drop table bin");
stat.execute("SET BINARY_COLLATION UNSIGNED");
stat.execute("create table bin( x binary(1) );");
stat.execute("insert into bin(x) values (x'09'),(x'0a'),(x'99'),(x'aa');");
......
......@@ -155,6 +155,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
/**
* This method is called via reflection from the database.
*
* @param values the value array
* @return a result set
*/
public static ResultSet varArgsFunctionTable(int... values) throws SQLException {
......
......@@ -1126,7 +1126,7 @@ public class TestMVStore extends TestBase {
map.put(1, "Hi");
map.remove(2);
// access the old data (before incrementVersion)
// access the old data (before the commit)
MVMap<Integer, String> oldMap =
map.openVersion(oldVersion);
......
......@@ -713,7 +713,7 @@ public class TestMVTableEngine extends TestBase {
private void testExclusiveLock() throws Exception {
FileUtils.deleteRecursive(getBaseDir(), true);
String dbName = "mvstore;MV_STORE=TRUE";
String dbName = "mvstore;MV_STORE=TRUE;MVCC=FALSE";
Connection conn, conn2;
Statement stat, stat2;
conn = getConnection(dbName);
......@@ -943,7 +943,7 @@ public class TestMVTableEngine extends TestBase {
private void testLocking() throws Exception {
FileUtils.deleteRecursive(getBaseDir(), true);
String dbName = "mvstore;MV_STORE=TRUE";
String dbName = "mvstore;MV_STORE=TRUE;MVCC=FALSE";
Connection conn = getConnection(dbName);
Statement stat = conn.createStatement();
stat.execute("set lock_timeout 1000");
......
......@@ -79,8 +79,13 @@ public class TestJmx extends TestBase {
getAttribute(name, "Mode").toString());
assertEquals("false", mbeanServer.
getAttribute(name, "MultiThreaded").toString());
assertEquals("false", mbeanServer.
getAttribute(name, "Mvcc").toString());
if (config.mvStore) {
assertEquals("true", mbeanServer.
getAttribute(name, "Mvcc").toString());
} else {
assertEquals("false", mbeanServer.
getAttribute(name, "Mvcc").toString());
}
assertEquals("false", mbeanServer.
getAttribute(name, "ReadOnly").toString());
assertEquals("1", mbeanServer.
......@@ -100,7 +105,11 @@ public class TestJmx extends TestBase {
result = mbeanServer.invoke(name, "listSessions", null, null).toString();
assertTrue(result.indexOf("session id") >= 0);
assertTrue(result.indexOf("write lock") >= 0);
if (config.mvcc) {
assertTrue(result.indexOf("read lock") >= 0);
} else {
assertTrue(result.indexOf("write lock") >= 0);
}
assertEquals(2, info.getOperations().length);
assertTrue(info.getDescription().indexOf("database") >= 0);
......
......@@ -116,9 +116,6 @@ public class TestReopen extends TestBase implements Recorder {
p.setProperty("password", getPassword());
String url = "jdbc:h2:" + testDatabase +
";FILE_LOCK=NO;TRACE_LEVEL_FILE=0";
if (config.mvStore) {
url += ";MV_STORE=TRUE";
}
ConnectionInfo ci = new ConnectionInfo(url, p);
Database database = new Database(ci, null);
// close the database
......@@ -170,9 +167,6 @@ public class TestReopen extends TestBase implements Recorder {
// avoid using the Engine class to avoid deadlocks
Properties p = new Properties();
String url = "jdbc:h2:" + testDatabase + ";FILE_LOCK=NO";
if (config.mvStore) {
url += ";MV_STORE=TRUE";
}
ConnectionInfo ci = new ConnectionInfo(url, p);
Database database = new Database(ci, null);
// close the database
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论