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

Changes to prepare for version 1.4.x beta

上级 d63384b6
......@@ -11,7 +11,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
import org.h2.util.Task;
......
......@@ -11,7 +11,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
/**
......
......@@ -35,9 +35,9 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletContext;
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
import org.h2.api.ErrorCode;
import org.h2.engine.Constants;
import org.h2.engine.SysProperties;
import org.h2.server.web.WebServlet;
import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase;
......
......@@ -18,7 +18,7 @@ import java.sql.SQLException;
import java.sql.Savepoint;
import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.engine.Constants;
import org.h2.engine.Database;
import org.h2.jdbc.JdbcConnection;
......
......@@ -31,7 +31,8 @@ import java.util.Calendar;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.jdbc.JdbcConnection;
import org.h2.store.FileLister;
import org.h2.store.fs.FileUtils;
......
......@@ -10,7 +10,8 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
import org.h2.test.utils.FilePathUnstable;
......
......@@ -15,7 +15,7 @@ import java.sql.Statement;
import java.util.ArrayList;
import java.util.Random;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase;
import org.h2.test.utils.SelfDestructor;
......
......@@ -16,7 +16,8 @@ import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase;
import org.h2.util.New;
......
......@@ -10,7 +10,8 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
import org.h2.test.utils.FilePathDebug;
......
......@@ -13,7 +13,8 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Random;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
import org.h2.test.utils.FilePathDebug;
import org.h2.util.New;
......
......@@ -9,7 +9,8 @@ package org.h2.test.synth;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.constant.SysProperties;
import org.h2.engine.SysProperties;
import org.h2.store.fs.FileUtils;
import org.h2.test.TestAll;
import org.h2.test.TestBase;
......
......@@ -12,7 +12,7 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.api.DatabaseEventListener;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
import org.h2.tools.Server;
......
......@@ -25,7 +25,7 @@ public class TestClearReferences extends TestBase {
private static final String[] KNOWN_REFRESHED = {
"org.h2.compress.CompressLZF.cachedHashTable",
"org.h2.constant.DbSettings.defaultSettings",
"org.h2.engine.DbSettings.defaultSettings",
"org.h2.engine.SessionRemote.sessionFactory",
"org.h2.jdbcx.JdbcDataSourceFactory.cachedTraceSystem",
"org.h2.store.RecoverTester.instance",
......
......@@ -8,7 +8,8 @@ package org.h2.test.unit;
import java.sql.Connection;
import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
/**
......
......@@ -11,7 +11,8 @@ import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
import org.h2.util.Task;
......
......@@ -8,14 +8,18 @@ package org.h2.test.unit;
import java.io.File;
import java.util.Properties;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.engine.ConnectionInfo;
import org.h2.engine.SysProperties;
import org.h2.test.TestBase;
import org.h2.tools.DeleteDbFiles;
/**
* Test the ConnectionInfo class.
*
* @author Kerry Sainsbury
* @author Thomas Mueller Graf
*/
public class TestConnectionInfo extends TestBase {
......@@ -30,10 +34,24 @@ public class TestConnectionInfo extends TestBase {
@Override
public void test() throws Exception {
testImplicitRelativePath();
testConnectInitError();
testConnectionInfo();
testName();
}
private void testImplicitRelativePath() throws Exception {
if (SysProperties.IMPLICIT_RELATIVE_PATH) {
return;
}
assertThrows(ErrorCode.URL_RELATIVE_TO_CWD, this).
getConnection("jdbc:h2:test");
assertThrows(ErrorCode.URL_RELATIVE_TO_CWD, this).
getConnection("jdbc:h2:data/test");
getConnection("jdbc:h2:./testDatabase").close();
DeleteDbFiles.execute(".", "testDatabase", true);
}
private void testConnectInitError() throws Exception {
assertThrows(ErrorCode.SYNTAX_ERROR_2, this).
......@@ -69,7 +87,7 @@ public class TestConnectionInfo extends TestBase {
private void testName() throws Exception {
char differentFileSeparator = File.separatorChar == '/' ? '\\' : '/';
ConnectionInfo connectionInfo = new ConnectionInfo("test" +
ConnectionInfo connectionInfo = new ConnectionInfo("./test" +
differentFileSeparator + "subDir");
File file = new File("test" + File.separatorChar + "subDir");
assertEquals(file.getCanonicalPath().replace('\\', '/'),
......
......@@ -50,7 +50,7 @@ import org.h2.value.ValueUuid;
public class TestDataPage extends TestBase implements DataHandler {
private boolean testPerformance;
private final CompareMode compareMode = CompareMode.getInstance(null, 0, false);
private final CompareMode compareMode = CompareMode.getInstance(null, 0);
/**
* Run just this test.
......
......@@ -14,8 +14,9 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
import org.h2.api.ErrorCode;
import org.h2.engine.SysProperties;
import org.h2.store.Data;
import org.h2.test.TestBase;
import org.h2.test.utils.AssertThrows;
......
......@@ -8,7 +8,8 @@ package org.h2.test.unit;
import java.io.File;
import java.sql.Connection;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.engine.Constants;
import org.h2.message.TraceSystem;
import org.h2.store.FileLock;
......
......@@ -15,7 +15,7 @@ import java.sql.Statement;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.jdbc.JdbcConnection;
import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase;
......
......@@ -9,7 +9,8 @@ package org.h2.test.unit;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import org.h2.constant.SysProperties;
import org.h2.engine.SysProperties;
import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase;
import org.h2.util.IOUtils;
......
......@@ -18,7 +18,8 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.Properties;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
import org.h2.tools.Server;
......
......@@ -19,7 +19,7 @@ import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
import org.h2.api.DatabaseEventListener;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.result.Row;
import org.h2.store.Page;
import org.h2.store.fs.FileUtils;
......
......@@ -11,7 +11,8 @@ import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.engine.Constants;
import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase;
......
......@@ -33,18 +33,18 @@ public class TestPattern extends TestBase {
private void testCompareModeReuse() {
CompareMode mode1, mode2;
mode1 = CompareMode.getInstance(null, 0, false);
mode2 = CompareMode.getInstance(null, 0, false);
mode1 = CompareMode.getInstance(null, 0);
mode2 = CompareMode.getInstance(null, 0);
assertTrue(mode1 == mode2);
mode1 = CompareMode.getInstance("DE", Collator.SECONDARY, false);
mode1 = CompareMode.getInstance("DE", Collator.SECONDARY);
assertFalse(mode1 == mode2);
mode2 = CompareMode.getInstance("DE", Collator.SECONDARY, false);
mode2 = CompareMode.getInstance("DE", Collator.SECONDARY);
assertTrue(mode1 == mode2);
}
private void testPattern() {
CompareMode mode = CompareMode.getInstance(null, 0, false);
CompareMode mode = CompareMode.getInstance(null, 0);
CompareLike comp = new CompareLike(mode, "\\", null, null, null, false);
test(comp, "B", "%_");
test(comp, "A", "A%");
......
......@@ -9,7 +9,8 @@ package org.h2.test.unit;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Properties;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.engine.ConnectionInfo;
import org.h2.engine.Constants;
import org.h2.engine.Database;
......
......@@ -176,7 +176,7 @@ public class TestSecurity extends TestBase {
}
private void testBlockCiphers() {
for (String algorithm : new String[] { "AES", "XTEA", "FOG" }) {
for (String algorithm : new String[] { "AES", "FOG" }) {
byte[] test = new byte[4096];
BlockCipher cipher = CipherFactory.getBlockCipher(algorithm);
cipher.setKey("abcdefghijklmnop".getBytes());
......
......@@ -22,7 +22,7 @@ import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.server.web.DbStarter;
import org.h2.test.TestBase;
import org.h2.util.New;
......
......@@ -35,8 +35,8 @@ import java.sql.Types;
import java.util.ArrayList;
import java.util.Random;
import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties;
import org.h2.api.ErrorCode;
import org.h2.engine.SysProperties;
import org.h2.store.FileLister;
import org.h2.store.fs.FileUtils;
import org.h2.test.TestBase;
......@@ -79,6 +79,7 @@ public class TestTools extends TestBase {
if (config.networked) {
return;
}
DeleteDbFiles.execute(getBaseDir(), null, true);
org.h2.Driver.load();
testSimpleResultSet();
testTcpServerWithoutPort();
......@@ -192,6 +193,8 @@ public class TestTools extends TestBase {
createClassProxy(rs.getClass());
assertThrows(IllegalStateException.class, rs).
addColumn(null, 0, 0, 0);
assertEquals(ResultSet.TYPE_FORWARD_ONLY, rs.getType());
rs.next();
assertEquals(1, rs.getInt(1));
assertEquals("1", rs.getString(1));
......@@ -219,6 +222,8 @@ public class TestTools extends TestBase {
assertEquals(1, rs.getColumnCount());
rs = new SimpleResultSet();
rs.setAutoClose(false);
rs.addColumn("a", Types.BIGINT, 0, 0);
rs.addColumn("b", Types.BINARY, 0, 0);
rs.addColumn("c", Types.BOOLEAN, 0, 0);
......@@ -421,9 +426,10 @@ public class TestTools extends TestBase {
}
assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection());
assertEquals(0, rs.getFetchSize());
assertEquals(ResultSet.TYPE_FORWARD_ONLY, rs.getType());
assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType());
assertTrue(rs.getStatement() == null);
assertFalse(rs.isClosed());
rs.beforeFirst();
assertEquals(0, rs.getRow());
assertTrue(rs.next());
......@@ -433,8 +439,10 @@ public class TestTools extends TestBase {
assertFalse(rs.next());
assertThrows(ErrorCode.NO_DATA_AVAILABLE, (ResultSet) rs).
getInt(1);
assertTrue(rs.isClosed());
assertEquals(0, rs.getRow());
assertFalse(rs.isClosed());
rs.close();
assertTrue(rs.isClosed());
}
private void testJdbcDriverUtils() {
......@@ -835,7 +843,7 @@ public class TestTools extends TestBase {
conn.close();
Script.main("-url", url, "-user", user, "-password", password,
"-script", fileName, "-options", "nodata", "compression",
"lzf", "cipher", "xtea", "password", "'123'", "charset",
"lzf", "cipher", "aes", "password", "'123'", "charset",
"'utf-8'");
Script.main("-url", url, "-user", user, "-password", password,
"-script", fileName + ".txt");
......@@ -843,7 +851,7 @@ public class TestTools extends TestBase {
"-quiet");
RunScript.main("-url", url, "-user", user, "-password", password,
"-script", fileName, "-options", "compression", "lzf",
"cipher", "xtea", "password", "'123'", "charset", "'utf-8'");
"cipher", "aes", "password", "'123'", "charset", "'utf-8'");
conn = getConnection(
"jdbc:h2:" + getBaseDir() + "/testScriptRunscript", "sa", "abc");
ResultSet rs = conn.createStatement()
......@@ -906,13 +914,13 @@ public class TestTools extends TestBase {
String url = "jdbc:h2:" + dir;
DeleteDbFiles.execute(dir, "testChangeFileEncryption", true);
Connection conn = getConnection(url +
"/testChangeFileEncryption;CIPHER=XTEA", "sa", "abc 123");
"/testChangeFileEncryption;CIPHER=AES", "sa", "abc 123");
Statement stat = conn.createStatement();
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, DATA CLOB) "
+ "AS SELECT X, SPACE(3000) FROM SYSTEM_RANGE(1, 300)");
conn.close();
String[] args = { "-dir", dir, "-db", "testChangeFileEncryption",
"-cipher", "XTEA", "-decrypt", "abc", "-quiet" };
"-cipher", "AES", "-decrypt", "abc", "-quiet" };
ChangeFileEncryption.main(args);
args = new String[] { "-dir", dir, "-db", "testChangeFileEncryption",
"-cipher", "AES", "-encrypt", "def", "-quiet" };
......
......@@ -15,7 +15,8 @@ import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.UUID;
import org.h2.constant.ErrorCode;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
import org.h2.test.utils.AssertThrows;
import org.h2.tools.SimpleResultSet;
......@@ -119,6 +120,7 @@ public class TestValue extends TestBase {
private void testValueResultSet() throws SQLException {
SimpleResultSet rs = new SimpleResultSet();
rs.setAutoClose(false);
rs.addColumn("ID", Types.INTEGER, 0, 0);
rs.addColumn("NAME", Types.VARCHAR, 255, 0);
rs.addRow(1, "Hello");
......
......@@ -31,7 +31,7 @@ import org.h2.value.ValueInt;
*/
public class TestValueHashMap extends TestBase implements DataHandler {
CompareMode compareMode = CompareMode.getInstance(null, 0, false);
CompareMode compareMode = CompareMode.getInstance(null, 0);
/**
* Run just this test.
......
......@@ -165,7 +165,7 @@ public class ArchiveTool {
}
}
}
// int: metadata length
// byte: 0: directory, 1: file
// varLong: lastModified
......
......@@ -22,8 +22,8 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import org.h2.command.dml.BackupCommand;
import org.h2.constant.SysProperties;
import org.h2.engine.Constants;
import org.h2.engine.SysProperties;
import org.h2.message.DbException;
import org.h2.store.fs.FileUtils;
import org.h2.util.IOUtils;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论