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

--no commit message

--no commit message
上级 cc172420
......@@ -60,6 +60,7 @@ import org.h2.test.jdbc.TestBatchUpdates;
import org.h2.test.jdbc.TestCallableStatement;
import org.h2.test.jdbc.TestCancel;
import org.h2.test.jdbc.TestDatabaseEventListener;
import org.h2.test.jdbc.TestDriver;
import org.h2.test.jdbc.TestManyJdbcObjects;
import org.h2.test.jdbc.TestMetaData;
import org.h2.test.jdbc.TestNativeSQL;
......@@ -276,37 +277,27 @@ java org.h2.test.TestAll timer
/*
download/local_temp_index.txt
test with 1.0
system_temp_lob.db leaks unencrypted data, even when I use
encrypted SCRIPT/RUNSCRIPT with an encrypted database.
Event on Re-Connect (DatabaseEventListener)
extend server protocol to keep stuff on client
(temporary linked tables, variables; identity)
merge join test case
osgi (derby, hsqldb)
support 'build test'
auto_reconnect
implemented:
- auto_server includes auto_reconnect
- works with server mode
- works with auto_server mode
- keep temporary linked tables, variables on client
- statements
- prepared statements
- small result sets (up to fetch size)
- throws an error when autocommit is false
- an error is thrown when the connection is lost
while looping over large result sets (larger than fetch size)
untested:
not implemented / not tested
- batch updates
- throw error in cluster mode
- ignored in embedded mode
not implemented / not tested
- keep temporary linked tables, variables on client
- keep temporary tables (including data) on client
- keep identity, getGeneratedKeys on client
- throw error when in cluster mode
......@@ -314,8 +305,6 @@ not implemented / not tested
Feature requests:
SCOPE_IDENTITY
test with system property h2.aliasColumnName.
document url parameter auto_server
document url parameter auto_reconnect
document url parameter open_new
......@@ -352,8 +341,6 @@ optimize where x not in (select):
SELECT c FROM color LEFT OUTER JOIN (SELECT c FROM TABLE(c
VARCHAR= ?)) p ON color.c = p.c WHERE p.c IS NULL;
Add where required // TODO: change in version 1.1
http://www.w3schools.com/sql/
*/
......@@ -550,6 +537,7 @@ http://www.w3schools.com/sql/
new TestCallableStatement().runTest(this);
new TestCancel().runTest(this);
new TestDatabaseEventListener().runTest(this);
new TestDriver().runTest(this);
new TestManyJdbcObjects().runTest(this);
new TestMetaData().runTest(this);
new TestNativeSQL().runTest(this);
......
......@@ -7,24 +7,29 @@
package org.h2.test.server;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import org.h2.api.DatabaseEventListener;
import org.h2.test.TestBase;
import org.h2.tools.Server;
/**
* Tests automatic embedded/server mode.
*/
public class TestAutoReconnect extends TestBase {
public class TestAutoReconnect extends TestBase implements DatabaseEventListener {
private String url;
private boolean autoServer;
private Server server;
private Connection connServer;
private Connection conn;
private String state;
/**
* Run just this test.
......@@ -66,9 +71,41 @@ public class TestAutoReconnect extends TestBase {
url = "jdbc:h2:tcp://localhost:8181/" + baseDir + "/autoReconnect;" +
"FILE_LOCK=SOCKET;AUTO_RECONNECT=TRUE";
}
Connection conn = DriverManager.getConnection(url);
restart();
// test the database event listener
conn = DriverManager.getConnection(url + ";DATABASE_EVENT_LISTENER='" + getClass().getName() + "'");
conn.close();
// test the database event listener object
Properties prop = new Properties();
state = null;
Driver postgreDriver = null;
try {
postgreDriver = DriverManager.getDriver("jdbc:postgresql:test");
if (postgreDriver != null) {
DriverManager.deregisterDriver(postgreDriver);
}
} catch (Exception e) {
// ignore
}
prop.put("DATABASE_EVENT_LISTENER_OBJECT", this);
conn = DriverManager.getConnection(url, prop);
assertEquals(null, state);
Statement stat = conn.createStatement();
stat.execute("DROP TABLE IF EXISTS TEST");
restart();
// the table is created in the database event listener
stat.execute("SELECT * FROM TEST");
assertEquals("state " + DatabaseEventListener.STATE_RECONNECTED, state);
conn.close();
if (postgreDriver != null) {
DriverManager.registerDriver(postgreDriver);
}
conn = DriverManager.getConnection(url);
restart();
stat = conn.createStatement();
restart();
stat.execute("create table test(id identity, name varchar)");
restart();
......@@ -146,4 +183,35 @@ public class TestAutoReconnect extends TestBase {
}
}
public void closingDatabase() {
// ignore
}
public void diskSpaceIsLow(long stillAvailable) throws SQLException {
// ignore
}
public void exceptionThrown(SQLException e, String sql) {
// ignore
}
public void init(String url) {
state = "init";
}
public void opened() {
state = "opened";
}
public void setProgress(int state, String name, int x, int max) {
this.state = "state " + state;
if (state == DatabaseEventListener.STATE_RECONNECTED) {
try {
conn.createStatement().execute("CREATE LOCAL TEMPORARY TABLE TEST(ID INT)");
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
}
......@@ -3383,7 +3383,7 @@ script NOPASSWORDS NOSETTINGS drop;
> CREATE FORCE TRIGGER S.TEST_TRIGGER BEFORE INSERT ON S.TEST QUEUE 1024 CALL "org.h2.test.db.TestTriggersConstraints";
> CREATE INDEX S.INDEX_ID ON S.TEST(ID);
> CREATE MEMORY TABLE S.TEST( ID INT );
> CREATE SCHEMA S AUTHORIZATION SA;
> CREATE SCHEMA IF NOT EXISTS S AUTHORIZATION SA;
> CREATE SEQUENCE S.SEQ START WITH 10;
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> DROP SEQUENCE IF EXISTS S.SEQ;
......
......@@ -3383,7 +3383,7 @@ script NOPASSWORDS NOSETTINGS drop;
> CREATE FORCE TRIGGER S.TEST_TRIGGER BEFORE INSERT ON S.TEST QUEUE 1024 CALL "org.h2.test.db.TestTriggersConstraints";
> CREATE INDEX S.INDEX_ID ON S.TEST(ID);
> CREATE MEMORY TABLE S.TEST( ID INT );
> CREATE SCHEMA S AUTHORIZATION SA;
> CREATE SCHEMA IF NOT EXISTS S AUTHORIZATION SA;
> CREATE SEQUENCE S.SEQ START WITH 10;
> CREATE USER IF NOT EXISTS SA PASSWORD '' ADMIN;
> DROP SEQUENCE IF EXISTS S.SEQ;
......
......@@ -174,6 +174,9 @@ public class Build extends BuildBase {
download("ext/slf4j-api-1.5.0.jar",
"http://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.5.0/slf4j-api-1.5.0.jar",
"b2df265d02350ecfe87b6c1773c7c4fab2b33505");
download("ext/org.osgi.core-1.2.0.jar",
"http://repo1.maven.org/maven2/org/apache/felix/org.osgi.core/1.2.0/org.osgi.core-1.2.0.jar",
"3006beb1ca6a83449def6127dad3c060148a0209");
}
private String getVersion() {
......@@ -410,6 +413,14 @@ public class Build extends BuildBase {
java("org.h2.build.doc.SpellChecker", null);
}
/**
* Compile and run all tests.
*/
public void test() {
compile();
java("org.h2.test.TestAll", null);
}
/**
* Build the h2console.war file.
*/
......
......@@ -562,4 +562,6 @@ monitoring razuna asset drag pekar devx dmitry fragments onmouseup nav
onmousedown olap valign army blitz backgammon knife abbreviate berger dhuse
strictly greg germany abbreviates frontends cleversafe payload cloneable
scripting jaks reconnected serverlist safes somewhere anzo war contacts helpful
implies looping cataloguing mapper frees javaw
implies looping cataloguing mapper frees javaw geographic borges grass
somehow marcio groove roy gis matt targeted brazil dig opt deregister
classname recaptcha
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论