提交 9549cb57 authored 作者: Thomas Mueller's avatar Thomas Mueller

Improved MVStore tests.

上级 69799fc8
......@@ -31,7 +31,6 @@ import java.util.LinkedList;
import org.h2.jdbc.JdbcConnection;
import org.h2.message.DbException;
import org.h2.message.TraceSystem;
import org.h2.mvstore.db.MVTableEngine;
import org.h2.store.FileLock;
import org.h2.store.fs.FileUtils;
import org.h2.test.utils.ProxyCodeGenerator;
......@@ -266,8 +265,7 @@ public abstract class TestBase {
} else {
url = name;
}
int test;
// url = addOption(url, "DEFAULT_TABLE_ENGINE", MVTableEngine.class.getName());
// url = addOption(url, "DEFAULT_TABLE_ENGINE", "org.h2.mvstore.db.MVTableEngine");
if (!config.memory) {
if (config.smallLog && admin) {
url = addOption(url, "MAX_LOG_SIZE", "1");
......
......@@ -32,8 +32,8 @@ public class SequenceMap extends MVMap<Long, Long> {
super(null, null);
}
public void open(MVStore store, HashMap<String, String> config) {
super.open(store, config);
public void init(MVStore store, HashMap<String, String> config) {
super.init(store, config);
setReadOnly(true);
}
......
......@@ -40,6 +40,7 @@ public class TestMVStore extends TestBase {
public void test() throws Exception {
FileUtils.deleteRecursive(getBaseDir(), true);
testRecreateMap();
testRenameMapRollback();
testCustomMapType();
testCacheSize();
......@@ -72,6 +73,22 @@ public class TestMVStore extends TestBase {
testSimple();
}
private void testRecreateMap() {
String fileName = getBaseDir() + "/testRecreateMap.h3";
FileUtils.delete(fileName);
MVStore s = openStore(fileName);
MVMap<Integer, Integer> m = s.openMap("test");
m.put(1, 1);
s.store();
m.removeMap();
s.store();
s.close();
s = openStore(fileName);
m = s.openMap("test");
assertNull(m.get(1));
s.close();
}
private void testRenameMapRollback() {
MVStore s = openStore(null);
MVMap<Integer, Integer> map;
......@@ -546,6 +563,13 @@ public class TestMVStore extends TestBase {
mOld = m.openVersion(old3);
assertEquals("Hallo", mOld.get("1"));
assertEquals("Welt", mOld.get("2"));
try {
m.openVersion(-3);
fail();
} catch (IllegalArgumentException e) {
// expected
}
s.close();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论