提交 29dc32d9 authored 作者: Thomas Mueller's avatar Thomas Mueller

All tests should now have a main method.

上级 d1516da3
...@@ -33,6 +33,8 @@ import org.h2.util.IOUtils; ...@@ -33,6 +33,8 @@ import org.h2.util.IOUtils;
*/ */
public class TestFunctions extends TestBase implements AggregateFunction { public class TestFunctions extends TestBase implements AggregateFunction {
static int count;
/** /**
* Run just this test. * Run just this test.
* *
...@@ -44,6 +46,7 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -44,6 +46,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
public void test() throws Exception { public void test() throws Exception {
deleteDb("functions"); deleteDb("functions");
testDeterministic();
testTransactionId(); testTransactionId();
testPrecision(); testPrecision();
testVarArgs(); testVarArgs();
...@@ -53,6 +56,32 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -53,6 +56,32 @@ public class TestFunctions extends TestBase implements AggregateFunction {
deleteDb("functions"); deleteDb("functions");
} }
private void testDeterministic() throws SQLException {
Connection conn = getConnection("functions");
Statement stat = conn.createStatement();
ResultSet rs;
stat.execute("create alias getCount for \""+getClass().getName()+".getCount\"");
setCount(0);
rs = stat.executeQuery("select getCount() from system_range(1, 2)");
rs.next();
assertEquals(0, rs.getInt(1));
rs.next();
assertEquals(1, rs.getInt(1));
stat.execute("drop alias getCount");
stat.execute("create alias getCount deterministic for \""+getClass().getName()+".getCount\"");
setCount(0);
rs = stat.executeQuery("select getCount() from system_range(1, 2)");
rs.next();
assertEquals(0, rs.getInt(1));
rs.next();
assertEquals(0, rs.getInt(1));
stat.execute("drop alias getCount");
conn.close();
}
private void testTransactionId() throws SQLException { private void testTransactionId() throws SQLException {
if (config.memory) { if (config.memory) {
return; return;
...@@ -516,6 +545,19 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -516,6 +545,19 @@ public class TestFunctions extends TestBase implements AggregateFunction {
return dec; return dec;
} }
/**
* This method is called via reflection from the database.
*
* @return the count
*/
public static int getCount() {
return count++;
}
private static void setCount(int newCount) {
count = newCount;
}
/** /**
* This method is called via reflection from the database. * This method is called via reflection from the database.
* *
......
...@@ -25,6 +25,15 @@ public class TestIndex extends TestBase { ...@@ -25,6 +25,15 @@ public class TestIndex extends TestBase {
private Statement stat; private Statement stat;
private Random random = new Random(); private Random random = new Random();
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testDescIndex(); testDescIndex();
testHashIndex(); testHashIndex();
......
...@@ -29,6 +29,15 @@ public class TestListener extends TestBase implements DatabaseEventListener { ...@@ -29,6 +29,15 @@ public class TestListener extends TestBase implements DatabaseEventListener {
start = last = System.currentTimeMillis(); start = last = System.currentTimeMillis();
} }
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
if (config.networked || config.cipher != null) { if (config.networked || config.cipher != null) {
return; return;
......
...@@ -21,6 +21,15 @@ import org.h2.tools.MultiDimension; ...@@ -21,6 +21,15 @@ import org.h2.tools.MultiDimension;
*/ */
public class TestMultiDimension extends TestBase { public class TestMultiDimension extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
Random rand = new Random(10); Random rand = new Random(10);
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
...@@ -37,11 +46,12 @@ public class TestMultiDimension extends TestBase { ...@@ -37,11 +46,12 @@ public class TestMultiDimension extends TestBase {
conn = getConnection("multiDimension"); conn = getConnection("multiDimension");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("CREATE ALIAS MAP FOR \"" + getClass().getName() + ".interleave\""); stat.execute("CREATE ALIAS MAP FOR \"" + getClass().getName() + ".interleave\"");
stat stat.execute("CREATE TABLE TEST(X INT NOT NULL, Y INT NOT NULL, Z INT NOT NULL, " +
.execute("CREATE TABLE TEST(X INT NOT NULL, Y INT NOT NULL, Z INT NOT NULL, XYZ BIGINT AS MAP(X, Y, Z), DATA VARCHAR)"); "XYZ BIGINT AS MAP(X, Y, Z), DATA VARCHAR)");
stat.execute("CREATE INDEX IDX_X ON TEST(X, Y, Z)"); stat.execute("CREATE INDEX IDX_X ON TEST(X, Y, Z)");
stat.execute("CREATE INDEX IDX_XYZ ON TEST(XYZ)"); stat.execute("CREATE INDEX IDX_XYZ ON TEST(XYZ)");
PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST(X, Y, Z, DATA) VALUES(?, ?, ?, ?)"); PreparedStatement prep = conn.prepareStatement(
"INSERT INTO TEST(X, Y, Z, DATA) VALUES(?, ?, ?, ?)");
// a reasonable max value to see the performance difference is 60; the // a reasonable max value to see the performance difference is 60; the
// higher the bigger the difference // higher the bigger the difference
int max = getSize(10, 20); int max = getSize(10, 20);
...@@ -69,8 +79,9 @@ public class TestMultiDimension extends TestBase { ...@@ -69,8 +79,9 @@ public class TestMultiDimension extends TestBase {
} }
} }
stat.execute("ANALYZE SAMPLE_SIZE 10000"); stat.execute("ANALYZE SAMPLE_SIZE 10000");
PreparedStatement prepRegular = conn.prepareStatement("SELECT * FROM TEST WHERE X BETWEEN ? AND ? " PreparedStatement prepRegular = conn.prepareStatement(
+ "AND Y BETWEEN ? AND ? AND Z BETWEEN ? AND ? ORDER BY X, Y, Z"); "SELECT * FROM TEST WHERE X BETWEEN ? AND ? " +
"AND Y BETWEEN ? AND ? AND Z BETWEEN ? AND ? ORDER BY X, Y, Z");
MultiDimension multi = MultiDimension.getInstance(); MultiDimension multi = MultiDimension.getInstance();
String sql = multi.generatePreparedQuery("TEST", "XYZ", new String[] { "X", "Y", "Z" }); String sql = multi.generatePreparedQuery("TEST", "XYZ", new String[] { "X", "Y", "Z" });
sql += " ORDER BY X, Y, Z"; sql += " ORDER BY X, Y, Z";
......
...@@ -39,6 +39,15 @@ public class TestMultiThread extends TestBase implements Runnable { ...@@ -39,6 +39,15 @@ public class TestMultiThread extends TestBase implements Runnable {
stat = conn.createStatement(); stat = conn.createStatement();
} }
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
Connection conn = getConnection(); Connection conn = getConnection();
......
...@@ -23,6 +23,15 @@ import org.h2.test.TestBase; ...@@ -23,6 +23,15 @@ import org.h2.test.TestBase;
*/ */
public class TestReadOnly extends TestBase { public class TestReadOnly extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
if (config.memory) { if (config.memory) {
return; return;
......
...@@ -19,6 +19,15 @@ import org.h2.util.FileUtils; ...@@ -19,6 +19,15 @@ import org.h2.util.FileUtils;
*/ */
public class TestRunscript extends TestBase implements Trigger { public class TestRunscript extends TestBase implements Trigger {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
test(false); test(false);
test(true); test(true);
......
...@@ -22,6 +22,15 @@ public class TestSQLInjection extends TestBase { ...@@ -22,6 +22,15 @@ public class TestSQLInjection extends TestBase {
private Connection conn; private Connection conn;
private Statement stat; private Statement stat;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
deleteDb("sqlInjection"); deleteDb("sqlInjection");
reconnect("sqlInjection"); reconnect("sqlInjection");
......
...@@ -18,6 +18,15 @@ import org.h2.test.TestBase; ...@@ -18,6 +18,15 @@ import org.h2.test.TestBase;
*/ */
public class TestSequence extends TestBase { public class TestSequence extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testAlterSequenceColumn(); testAlterSequenceColumn();
testAlterSequence(); testAlterSequence();
......
...@@ -18,6 +18,15 @@ import org.h2.test.TestBase; ...@@ -18,6 +18,15 @@ import org.h2.test.TestBase;
*/ */
public class TestSessionsLocks extends TestBase { public class TestSessionsLocks extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
if (config.mvcc) { if (config.mvcc) {
return; return;
......
...@@ -18,6 +18,15 @@ import org.h2.test.TestBase; ...@@ -18,6 +18,15 @@ import org.h2.test.TestBase;
*/ */
public class TestSpaceReuse extends TestBase { public class TestSpaceReuse extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
if (config.memory) { if (config.memory) {
return; return;
......
...@@ -18,11 +18,14 @@ import org.h2.test.TestBase; ...@@ -18,11 +18,14 @@ import org.h2.test.TestBase;
*/ */
public class TestSpeed extends TestBase { public class TestSpeed extends TestBase {
// java -cp .;..\..\hsqldb\lib\hsqldb.jar -Xrunhprof:heap=sites,depth=6 /**
// org.h2.test.TestAll * Run just this test.
// java -Xrunhprof:heap=sites org.h2.test.TestAll *
* @param a ignored
// TODO test: here is more code, currently untested! */
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
......
...@@ -23,6 +23,15 @@ import org.h2.test.TestBase; ...@@ -23,6 +23,15 @@ import org.h2.test.TestBase;
*/ */
public class TestTransaction extends TestBase { public class TestTransaction extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testSetTransaction(); testSetTransaction();
testReferential(); testReferential();
......
...@@ -22,9 +22,17 @@ import org.h2.test.TestBase; ...@@ -22,9 +22,17 @@ import org.h2.test.TestBase;
public class TestTriggersConstraints extends TestBase implements Trigger { public class TestTriggersConstraints extends TestBase implements Trigger {
private static boolean mustNotCallTrigger; private static boolean mustNotCallTrigger;
private String triggerName; private String triggerName;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
deleteDb("trigger"); deleteDb("trigger");
testTriggerAlterTable(); testTriggerAlterTable();
......
...@@ -18,6 +18,16 @@ import org.h2.test.TestBase; ...@@ -18,6 +18,16 @@ import org.h2.test.TestBase;
* Tests for the two-phase-commit feature. * Tests for the two-phase-commit feature.
*/ */
public class TestTwoPhaseCommit extends TestBase { public class TestTwoPhaseCommit extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
if (config.memory || config.networked || config.logMode == 0) { if (config.memory || config.networked || config.logMode == 0) {
return; return;
......
...@@ -43,6 +43,15 @@ public class TestBatchUpdates extends TestBase { ...@@ -43,6 +43,15 @@ public class TestBatchUpdates extends TestBase {
private Statement stat; private Statement stat;
private PreparedStatement prep; private PreparedStatement prep;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testExecuteCall(); testExecuteCall();
testException(); testException();
......
...@@ -19,6 +19,15 @@ import org.h2.test.TestBase; ...@@ -19,6 +19,15 @@ import org.h2.test.TestBase;
*/ */
public class TestCallableStatement extends TestBase { public class TestCallableStatement extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
deleteDb("callableStatement"); deleteDb("callableStatement");
Connection conn = getConnection("preparedStatement"); Connection conn = getConnection("preparedStatement");
......
...@@ -22,6 +22,15 @@ public class TestDatabaseEventListener extends TestBase implements DatabaseEvent ...@@ -22,6 +22,15 @@ public class TestDatabaseEventListener extends TestBase implements DatabaseEvent
private boolean calledOpened, calledClosingDatabase, calledScan; private boolean calledOpened, calledClosingDatabase, calledScan;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testCalled(); testCalled();
testCloseLog0(false); testCloseLog0(false);
......
...@@ -55,6 +55,15 @@ public class TestNativeSQL extends TestBase { ...@@ -55,6 +55,15 @@ public class TestNativeSQL extends TestBase {
private Connection conn; private Connection conn;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
deleteDb("nativeSql"); deleteDb("nativeSql");
conn = getConnection("nativeSql"); conn = getConnection("nativeSql");
......
...@@ -29,6 +29,15 @@ public class TestPreparedStatement extends TestBase { ...@@ -29,6 +29,15 @@ public class TestPreparedStatement extends TestBase {
private static final int LOB_SIZE = 4000, LOB_SIZE_BIG = 512 * 1024; private static final int LOB_SIZE = 4000, LOB_SIZE_BIG = 512 * 1024;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
deleteDb("preparedStatement"); deleteDb("preparedStatement");
......
...@@ -18,6 +18,15 @@ public class TestTransactionIsolation extends TestBase { ...@@ -18,6 +18,15 @@ public class TestTransactionIsolation extends TestBase {
private Connection conn1, conn2; private Connection conn1, conn2;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
if (config.mvcc) { if (config.mvcc) {
// no tests yet // no tests yet
......
...@@ -27,6 +27,15 @@ import org.h2.test.TestBase; ...@@ -27,6 +27,15 @@ import org.h2.test.TestBase;
*/ */
public class TestUpdatableResultSet extends TestBase { public class TestUpdatableResultSet extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testUpdateLob(); testUpdateLob();
testScroll(); testScroll();
......
...@@ -20,6 +20,15 @@ import org.h2.test.TestBase; ...@@ -20,6 +20,15 @@ import org.h2.test.TestBase;
*/ */
public class TestZloty extends TestBase { public class TestZloty extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testZloty(); testZloty();
testModifyBytes(); testModifyBytes();
......
...@@ -19,6 +19,15 @@ import org.h2.test.TestBase; ...@@ -19,6 +19,15 @@ import org.h2.test.TestBase;
*/ */
public class TestConnectionPool extends TestBase { public class TestConnectionPool extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
deleteDb("connectionPool"); deleteDb("connectionPool");
testConnect(); testConnect();
......
...@@ -22,11 +22,21 @@ import org.h2.util.JdbcUtils; ...@@ -22,11 +22,21 @@ import org.h2.util.JdbcUtils;
* Basic XA tests. * Basic XA tests.
*/ */
public class TestXA extends TestBase { public class TestXA extends TestBase {
private static final String DB_NAME1 = "xadb1"; private static final String DB_NAME1 = "xadb1";
private static final String DB_NAME2 = "xadb2"; private static final String DB_NAME2 = "xadb2";
private static final String DB_URL1 = "jdbc:h2:file:" + baseDir + "/" + DB_NAME1; private static final String DB_URL1 = "jdbc:h2:file:" + baseDir + "/" + DB_NAME1;
private static final String DB_URL2 = "jdbc:h2:file:" + baseDir + "/" + DB_NAME2; private static final String DB_URL2 = "jdbc:h2:file:" + baseDir + "/" + DB_NAME2;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
testXAAutoCommit(); testXAAutoCommit();
deleteDb(baseDir, "xa"); deleteDb(baseDir, "xa");
......
...@@ -19,6 +19,15 @@ import org.h2.test.TestBase; ...@@ -19,6 +19,15 @@ import org.h2.test.TestBase;
*/ */
public class TestXASimple extends TestBase { public class TestXASimple extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
deleteDb("xaSimple1"); deleteDb("xaSimple1");
......
...@@ -23,6 +23,15 @@ public class TestMvcc1 extends TestBase { ...@@ -23,6 +23,15 @@ public class TestMvcc1 extends TestBase {
private Connection c1, c2; private Connection c1, c2;
private Statement s1, s2; private Statement s1, s2;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testSetMode(); testSetMode();
testCases(); testCases();
......
...@@ -22,6 +22,15 @@ public class TestMvcc2 extends TestBase { ...@@ -22,6 +22,15 @@ public class TestMvcc2 extends TestBase {
private static final String INSERT = "INSERT INTO EMPLOYEE (id, version, NAME) VALUES (1, 1, 'Jones')"; private static final String INSERT = "INSERT INTO EMPLOYEE (id, version, NAME) VALUES (1, 1, 'Jones')";
private static final String UPDATE = "UPDATE EMPLOYEE SET NAME = 'Miller' WHERE version = 1"; private static final String UPDATE = "UPDATE EMPLOYEE SET NAME = 'Miller' WHERE version = 1";
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
if (!config.mvcc) { if (!config.mvcc) {
return; return;
......
...@@ -18,6 +18,15 @@ import org.h2.test.TestBase; ...@@ -18,6 +18,15 @@ import org.h2.test.TestBase;
*/ */
public class TestMvcc3 extends TestBase { public class TestMvcc3 extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testCreateTableAsSelect(); testCreateTableAsSelect();
testSequence(); testSequence();
......
...@@ -17,6 +17,15 @@ import org.h2.test.TestBase; ...@@ -17,6 +17,15 @@ import org.h2.test.TestBase;
*/ */
public class TestMvccMultiThreaded extends TestBase { public class TestMvccMultiThreaded extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
if (!config.mvcc) { if (!config.mvcc) {
return; return;
......
...@@ -19,6 +19,15 @@ import org.h2.test.TestBase; ...@@ -19,6 +19,15 @@ import org.h2.test.TestBase;
*/ */
public class TestNestedLoop extends TestBase { public class TestNestedLoop extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
deleteDb("nestedLoop"); deleteDb("nestedLoop");
Connection conn = getConnection("nestedLoop"); Connection conn = getConnection("nestedLoop");
......
...@@ -22,6 +22,15 @@ import org.h2.tools.DeleteDbFiles; ...@@ -22,6 +22,15 @@ import org.h2.tools.DeleteDbFiles;
*/ */
public class TestBtreeIndex extends TestBase { public class TestBtreeIndex extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
Random random = new Random(); Random random = new Random();
while (true) { while (true) {
......
...@@ -57,6 +57,15 @@ public class TestCrashAPI extends TestBase { ...@@ -57,6 +57,15 @@ public class TestCrashAPI extends TestBase {
private int openCount; private int openCount;
private long callCount; private long callCount;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
private void deleteDb() { private void deleteDb() {
try { try {
deleteDb(baseDir + "/" + DIR, null); deleteDb(baseDir + "/" + DIR, null);
......
...@@ -31,6 +31,15 @@ public class TestJoin extends TestBase { ...@@ -31,6 +31,15 @@ public class TestJoin extends TestBase {
private int paramCount; private int paramCount;
private StringBuffer buff; private StringBuffer buff;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
String old = baseDir; String old = baseDir;
baseDir = TestBase.getTestDir("join"); baseDir = TestBase.getTestDir("join");
......
...@@ -30,6 +30,15 @@ public class TestKill extends TestBase { ...@@ -30,6 +30,15 @@ public class TestKill extends TestBase {
private int accounts = 10; private int accounts = 10;
private Random random = new Random(1); private Random random = new Random(1);
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
String connect = ""; String connect = "";
......
...@@ -33,6 +33,15 @@ public class TestRandomSQL extends TestBase { ...@@ -33,6 +33,15 @@ public class TestRandomSQL extends TestBase {
private Bnf bnf; private Bnf bnf;
private int success, total; private int success, total;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
private void processException(String sql, SQLException e) { private void processException(String sql, SQLException e) {
if (e.getSQLState().equals("HY000")) { if (e.getSQLState().equals("HY000")) {
TestBase.logError("new TestRandomSQL().init(test).testCase(" + seed + "); // FAIL: " + e.toString() + " sql: " + sql, e); TestBase.logError("new TestRandomSQL().init(test).testCase(" + seed + "); // FAIL: " + e.toString() + " sql: " + sql, e);
......
...@@ -24,6 +24,15 @@ public class TestSimpleIndex extends TestBase { ...@@ -24,6 +24,15 @@ public class TestSimpleIndex extends TestBase {
private Statement stat; private Statement stat;
private RandomGen random; private RandomGen random;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
deleteDb("simpleIndex"); deleteDb("simpleIndex");
conn = getConnection("simpleIndex"); conn = getConnection("simpleIndex");
......
...@@ -43,6 +43,15 @@ public class TestThreads extends TestBase implements Runnable { ...@@ -43,6 +43,15 @@ public class TestThreads extends TestBase implements Runnable {
this.table = table; this.table = table;
} }
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
deleteDb("threads"); deleteDb("threads");
Connection conn = getConnection("threads;MAX_LOG_SIZE=1"); Connection conn = getConnection("threads;MAX_LOG_SIZE=1");
......
...@@ -24,6 +24,15 @@ import org.h2.tools.DeleteDbFiles; ...@@ -24,6 +24,15 @@ import org.h2.tools.DeleteDbFiles;
*/ */
public class TestTimer extends TestBase { public class TestTimer extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
validateOld(); validateOld();
DeleteDbFiles.execute(baseDir, "timer", true); DeleteDbFiles.execute(baseDir, "timer", true);
......
...@@ -55,6 +55,15 @@ public class TestSynth extends TestBase { ...@@ -55,6 +55,15 @@ public class TestSynth extends TestBase {
private boolean stopImmediately; private boolean stopImmediately;
private int mode; private int mode;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
/** /**
* Check whether this database is of the specified type. * Check whether this database is of the specified type.
* *
......
...@@ -22,6 +22,15 @@ public class TestMulti extends TestBase { ...@@ -22,6 +22,15 @@ public class TestMulti extends TestBase {
*/ */
public volatile boolean stop; public volatile boolean stop;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
org.h2.Driver.load(); org.h2.Driver.load();
deleteDb(baseDir, "openClose"); deleteDb(baseDir, "openClose");
......
...@@ -17,6 +17,15 @@ import org.h2.tools.CompressTool; ...@@ -17,6 +17,15 @@ import org.h2.tools.CompressTool;
*/ */
public class TestCompress extends TestBase { public class TestCompress extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
if (config.big) { if (config.big) {
for (int i = 0; i < 100; i++) { for (int i = 0; i < 100; i++) {
......
...@@ -28,6 +28,15 @@ import org.h2.value.ValueString; ...@@ -28,6 +28,15 @@ import org.h2.value.ValueString;
*/ */
public class TestDataPage extends TestBase implements DataHandler { public class TestDataPage extends TestBase implements DataHandler {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testAll(); testAll();
} }
......
...@@ -23,6 +23,15 @@ import org.h2.value.Value; ...@@ -23,6 +23,15 @@ import org.h2.value.Value;
*/ */
public class TestFile extends TestBase implements DataHandler { public class TestFile extends TestBase implements DataHandler {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
doTest(false); doTest(false);
doTest(true); doTest(true);
......
...@@ -19,6 +19,15 @@ public class TestFtp extends TestBase implements FtpEventListener { ...@@ -19,6 +19,15 @@ public class TestFtp extends TestBase implements FtpEventListener {
private FtpEvent lastEvent; private FtpEvent lastEvent;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
test(baseDir); test(baseDir);
} }
......
...@@ -18,6 +18,15 @@ public class TestIntIntHashMap extends TestBase { ...@@ -18,6 +18,15 @@ public class TestIntIntHashMap extends TestBase {
private Random rand = new Random(); private Random rand = new Random();
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() { public void test() {
rand.setSeed(10); rand.setSeed(10);
test(true); test(true);
......
...@@ -23,6 +23,15 @@ public class TestMultiThreadedKernel extends TestBase implements Runnable { ...@@ -23,6 +23,15 @@ public class TestMultiThreadedKernel extends TestBase implements Runnable {
private TestMultiThreadedKernel master; private TestMultiThreadedKernel master;
private volatile boolean stop; private volatile boolean stop;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
if (config.networked || config.mvcc) { if (config.networked || config.mvcc) {
return; return;
......
...@@ -18,6 +18,15 @@ import org.h2.util.ScriptReader; ...@@ -18,6 +18,15 @@ import org.h2.util.ScriptReader;
*/ */
public class TestScriptReader extends TestBase { public class TestScriptReader extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testCommon(); testCommon();
testRandom(); testRandom();
......
...@@ -19,6 +19,15 @@ import org.h2.util.ByteUtils; ...@@ -19,6 +19,15 @@ import org.h2.util.ByteUtils;
*/ */
public class TestSecurity extends TestBase { public class TestSecurity extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testSHA(); testSHA();
testAES(); testAES();
......
...@@ -31,6 +31,15 @@ import org.h2.test.TestBase; ...@@ -31,6 +31,15 @@ import org.h2.test.TestBase;
*/ */
public class TestServlet extends TestBase { public class TestServlet extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
/** /**
* Minimum ServletContext implementation. * Minimum ServletContext implementation.
* Most methods are not implemented. * Most methods are not implemented.
......
...@@ -37,6 +37,15 @@ public class TestShell extends TestBase { ...@@ -37,6 +37,15 @@ public class TestShell extends TestBase {
private PipedInputStream testIn; private PipedInputStream testIn;
private LineNumberReader lineReader; private LineNumberReader lineReader;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws IOException { public void test() throws IOException {
testIn = new PipedInputStream(); testIn = new PipedInputStream();
PipedOutputStream out = new PipedOutputStream(testIn); PipedOutputStream out = new PipedOutputStream(testIn);
......
...@@ -20,6 +20,15 @@ import org.h2.test.TestBase; ...@@ -20,6 +20,15 @@ import org.h2.test.TestBase;
*/ */
public class TestStreams extends TestBase { public class TestStreams extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws IOException { public void test() throws IOException {
testLZFStreams(); testLZFStreams();
} }
......
...@@ -22,6 +22,15 @@ import org.h2.util.StringUtils; ...@@ -22,6 +22,15 @@ import org.h2.util.StringUtils;
*/ */
public class TestStringUtils extends TestBase { public class TestStringUtils extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws Exception { public void test() throws Exception {
testHex(); testHex();
testXML(); testXML();
......
...@@ -19,6 +19,15 @@ import org.h2.value.ValueUuid; ...@@ -19,6 +19,15 @@ import org.h2.value.ValueUuid;
*/ */
public class TestValue extends TestBase { public class TestValue extends TestBase {
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
testUUID(); testUUID();
testDouble(false); testDouble(false);
......
...@@ -31,6 +31,15 @@ public class TestValueHashMap extends TestBase implements DataHandler { ...@@ -31,6 +31,15 @@ public class TestValueHashMap extends TestBase implements DataHandler {
CompareMode compareMode = new CompareMode(null, null, 0); CompareMode compareMode = new CompareMode(null, null, 0);
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
ValueHashMap map = new ValueHashMap(this); ValueHashMap map = new ValueHashMap(this);
HashMap hash = new HashMap(); HashMap hash = new HashMap();
......
...@@ -57,6 +57,15 @@ public class TestValueMemory extends TestBase implements DataHandler { ...@@ -57,6 +57,15 @@ public class TestValueMemory extends TestBase implements DataHandler {
private Random random = new Random(1); private Random random = new Random(1);
private SmallLRUCache lobFileListCache = new SmallLRUCache(128); private SmallLRUCache lobFileListCache = new SmallLRUCache(128);
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException { public void test() throws SQLException {
for (int i = 0; i < Value.TYPE_COUNT; i++) { for (int i = 0; i < Value.TYPE_COUNT; i++) {
testType(i); testType(i);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论