Not serialized java object value test enabled.

上级 3570ae00
......@@ -395,7 +395,7 @@ public class SysProperties {
* defensive copy himself before storing, or ensure that the value object is
* immutable.
*/
public static final boolean SERIALIZE_JAVA_OBJECT = Utils.getProperty("h2.serializeJavaObject", true);
public static boolean SERIALIZE_JAVA_OBJECT = Utils.getProperty("h2.serializeJavaObject", true);
private static final String H2_BASE_DIR = "h2.baseDir";
......
......@@ -612,7 +612,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new TestCancel().runTest(this);
new TestDatabaseEventListener().runTest(this);
new TestDriver().runTest(this);
// new TestJavaObject().runTest(this);
new TestJavaObject().runTest(this);
new TestLimitUpdates().runTest(this);
new TestLobApi().runTest(this);
new TestManyJdbcObjects().runTest(this);
......
......@@ -17,6 +17,7 @@ import java.sql.Timestamp;
import java.sql.Types;
import java.util.Arrays;
import java.util.UUID;
import org.h2.constant.SysProperties;
import org.h2.test.TestAll;
import org.h2.test.TestBase;
......@@ -34,7 +35,7 @@ public class TestJavaObject extends TestBase {
* @param a ignored
*/
public static void main(String... a) throws Exception {
System.setProperty("h2.serializeJavaObject", "false");
// System.setProperty("h2.serializeJavaObject", "false");
TestAll conf = new TestAll();
conf.traceTest = true;
......@@ -45,16 +46,21 @@ public class TestJavaObject extends TestBase {
@Override
public void test() throws Exception {
trace("Test Java Object");
startServerIfRequired();
doTest(Arrays.asList(UUID.randomUUID(), null), Arrays.asList(UUID.randomUUID(), UUID.randomUUID()), true);
doTest(new Timestamp(System.currentTimeMillis()), new Timestamp(System.currentTimeMillis() + 10000), false);
doTest(200, 100, false);
doTest(200, 100L, true);
doTest(new Date(System.currentTimeMillis() + 1000), new Date(System.currentTimeMillis()), false);
doTest(new java.util.Date(System.currentTimeMillis() + 1000), new java.util.Date(System.currentTimeMillis()), false);
doTest(new Time(System.currentTimeMillis() + 1000), new Date(System.currentTimeMillis()), false);
doTest(new Time(System.currentTimeMillis() + 1000), new Timestamp(System.currentTimeMillis()), false);
SysProperties.SERIALIZE_JAVA_OBJECT = false;
try {
trace("Test Java Object");
startServerIfRequired();
doTest(Arrays.asList(UUID.randomUUID(), null), Arrays.asList(UUID.randomUUID(), UUID.randomUUID()), true);
doTest(new Timestamp(System.currentTimeMillis()), new Timestamp(System.currentTimeMillis() + 10000), false);
doTest(200, 100, false);
doTest(200, 100L, true);
doTest(new Date(System.currentTimeMillis() + 1000), new Date(System.currentTimeMillis()), false);
doTest(new java.util.Date(System.currentTimeMillis() + 1000), new java.util.Date(System.currentTimeMillis()), false);
doTest(new Time(System.currentTimeMillis() + 1000), new Date(System.currentTimeMillis()), false);
doTest(new Time(System.currentTimeMillis() + 1000), new Timestamp(System.currentTimeMillis()), false);
} finally {
SysProperties.SERIALIZE_JAVA_OBJECT = true;
}
}
private void doTest(Object o1, Object o2, boolean hash) throws SQLException {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论