提交 422c8dc8 authored 作者: Thomas Mueller's avatar Thomas Mueller

Tests

上级 4cd69931
...@@ -776,7 +776,7 @@ the INIT property. Note that multiple commands may be passed to INIT, but the se ...@@ -776,7 +776,7 @@ the INIT property. Note that multiple commands may be passed to INIT, but the se
must be escaped, as in the example below. must be escaped, as in the example below.
</p> </p>
<pre> <pre>
String url = "jdbc:h2:mem;INIT=runscript from '~/create.sql'\\;runscript from '~/populate.sql'"; String url = "jdbc:h2:mem:test;INIT=runscript from '~/create.sql'\\;runscript from '~/populate.sql'";
</pre> </pre>
<p> <p>
Please note the double backslash is only required in a Java or properties file. Please note the double backslash is only required in a Java or properties file.
......
...@@ -54,6 +54,7 @@ MVTableEngine: ...@@ -54,6 +54,7 @@ MVTableEngine:
- maybe enable MVCC by default (but allow to disable it) - maybe enable MVCC by default (but allow to disable it)
- use StreamStore to avoid deadlocks - use StreamStore to avoid deadlocks
- config options for compression and page size (maybe combined) - config options for compression and page size (maybe combined)
- test with MVStore.ASSERT enabled
TransactionStore: TransactionStore:
...@@ -130,6 +131,8 @@ MVStore: ...@@ -130,6 +131,8 @@ MVStore:
and rolled back when opening - is this really needed? and rolled back when opening - is this really needed?
- compact* should also store uncommitted changes (if there are any) - compact* should also store uncommitted changes (if there are any)
- write a LSM-tree (log structured merge tree) utility on top of the MVStore - write a LSM-tree (log structured merge tree) utility on top of the MVStore
- improve memory calculation for transient and cache
specially for large pages (StreamStore)
*/ */
......
...@@ -695,7 +695,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1` ...@@ -695,7 +695,6 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new TestJavaObject().runTest(this); new TestJavaObject().runTest(this);
new TestJavaObjectSerializer().runTest(this); new TestJavaObjectSerializer().runTest(this);
new TestUrlJavaObjectSerializer().runTest(this); new TestUrlJavaObjectSerializer().runTest(this);
new TestLimitUpdates().runTest(this); new TestLimitUpdates().runTest(this);
new TestLobApi().runTest(this); new TestLobApi().runTest(this);
new TestManyJdbcObjects().runTest(this); new TestManyJdbcObjects().runTest(this);
......
...@@ -607,6 +607,9 @@ public class TestLob extends TestBase { ...@@ -607,6 +607,9 @@ public class TestLob extends TestBase {
} }
private void testLobCleanupSessionTemporaries() throws SQLException { private void testLobCleanupSessionTemporaries() throws SQLException {
if (config.mvStore) {
return;
}
deleteDb("lob"); deleteDb("lob");
Connection conn = getConnection("lob"); Connection conn = getConnection("lob");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
...@@ -740,25 +743,28 @@ public class TestLob extends TestBase { ...@@ -740,25 +743,28 @@ public class TestLob extends TestBase {
int rows = 0; int rows = 0;
Savepoint sp = null; Savepoint sp = null;
int len = getSize(100, 400); int len = getSize(100, 400);
// config.traceTest = true;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
switch (random.nextInt(10)) { switch (random.nextInt(10)) {
case 0: case 0:
trace("insert"); trace("insert " + i);
conn.createStatement().execute( conn.createStatement().execute(
"INSERT INTO TEST(DATA, DATA2) VALUES('" + i + "' || SPACE(" + spaceLen + "), '" + i + "')"); "INSERT INTO TEST(DATA, DATA2) VALUES('" + i + "' || SPACE(" + spaceLen + "), '" + i + "')");
rows++; rows++;
break; break;
case 1: case 1:
if (rows > 0) { if (rows > 0) {
trace("delete"); int x = random.nextInt(rows);
conn.createStatement().execute("DELETE FROM TEST WHERE ID=" + random.nextInt(rows)); trace("delete " + x);
conn.createStatement().execute("DELETE FROM TEST WHERE ID=" + x);
} }
break; break;
case 2: case 2:
if (rows > 0) { if (rows > 0) {
trace("update"); int x = random.nextInt(rows);
trace("update " + x);
conn.createStatement().execute( conn.createStatement().execute(
"UPDATE TEST SET DATA='x' || DATA, DATA2='x' || DATA2 WHERE ID=" + random.nextInt(rows)); "UPDATE TEST SET DATA='x' || DATA, DATA2='x' || DATA2 WHERE ID=" + x);
} }
break; break;
case 3: case 3:
...@@ -801,9 +807,10 @@ public class TestLob extends TestBase { ...@@ -801,9 +807,10 @@ public class TestLob extends TestBase {
} }
ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM TEST"); ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM TEST");
while (rs.next()) { while (rs.next()) {
int id = rs.getInt("ID");
String d1 = rs.getString("DATA").trim(); String d1 = rs.getString("DATA").trim();
String d2 = rs.getString("DATA2").trim(); String d2 = rs.getString("DATA2");
assertEquals(d1, d2); assertEquals("id:" + id, d2, d1);
} }
} }
...@@ -1183,6 +1190,9 @@ public class TestLob extends TestBase { ...@@ -1183,6 +1190,9 @@ public class TestLob extends TestBase {
prep = conn.prepareStatement("INSERT INTO TEST VALUES(1, ?)"); prep = conn.prepareStatement("INSERT INTO TEST VALUES(1, ?)");
String s = new String(getRandomChars(10000, 1)); String s = new String(getRandomChars(10000, 1));
byte[] data = s.getBytes("UTF-8"); byte[] data = s.getBytes("UTF-8");
// if we keep the string, debugging with Eclipse is not possible
// because Eclipse wants to display the large string and fails
s = "";
prep.setBinaryStream(1, new ByteArrayInputStream(data), 0); prep.setBinaryStream(1, new ByteArrayInputStream(data), 0);
prep.execute(); prep.execute();
......
...@@ -213,6 +213,7 @@ public class TestStreamStore extends TestBase { ...@@ -213,6 +213,7 @@ public class TestStreamStore extends TestBase {
store.setMaxBlockSize(100); store.setMaxBlockSize(100);
byte[] id = store.put(new ByteArrayInputStream(new byte[10000])); byte[] id = store.put(new ByteArrayInputStream(new byte[10000]));
InputStream in = store.get(id); InputStream in = store.get(id);
assertEquals(0, in.read(new byte[0]));
assertEquals(0, in.read()); assertEquals(0, in.read());
assertEquals(3, reads.get()); assertEquals(3, reads.get());
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论