提交 8d88e36a authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 5176e546
......@@ -6,12 +6,14 @@
*/
package org.h2.test.server;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import org.h2.test.TestBase;
import org.h2.test.unit.SelfDestructor;
import org.h2.util.SortedProperties;
/**
......@@ -42,7 +44,10 @@ public class TestAutoServer extends TestBase {
String user = getUser(), password = getPassword();
Connection conn = getConnection(url, user, password);
conn.close();
String[] procDef = new String[] { "java", "-cp", "bin", TestAutoServer2.class.getName(), url, user, password };
String selfDestruct = SelfDestructor.getPropertyString(60);
String[] procDef = new String[] { "java", selfDestruct,
"-cp", "bin" + File.pathSeparator + ".",
TestAutoServer2.class.getName(), url, user, password };
// TestAutoServer2.main(new String[]{url, user, password});
Process proc = Runtime.getRuntime().exec(procDef);
......
......@@ -24,6 +24,7 @@ import org.h2.test.unit.SelfDestructor;
import org.h2.tools.Backup;
import org.h2.tools.DeleteDbFiles;
import org.h2.util.IOUtils;
import org.h2.util.StringUtils;
/**
* Tests database recovery by destroying a process that writes to the database.
......@@ -239,16 +240,17 @@ public abstract class TestHalt extends TestBase {
// String classPath = "-cp
// .;D:/data/java/hsqldb.jar;D:/data/java/derby.jar";
String selfDestruct = SelfDestructor.getPropertyString(60);
String classPath = "";
String[] command = {"java", selfDestruct, classPath, getClass().getName(), "" + operations, "" + flags, "" + value};
traceOperation("start: " + command);
Process p = Runtime.getRuntime().exec(command);
String[] procDef = new String[] { "java", selfDestruct,
"-cp", "bin" + File.pathSeparator + ".",
getClass().getName(), "" + operations, "" + flags, "" + value};
traceOperation("start: " + StringUtils.arrayCombine(procDef, ' '));
Process p = Runtime.getRuntime().exec(procDef);
InputStream in = p.getInputStream();
OutputCatcher catcher = new OutputCatcher(in);
catcher.start();
String s = catcher.readLine(5 * 60 * 1000);
if (s == null) {
throw new IOException("No reply from process, command: " + command);
throw new IOException("No reply from process, command: " + StringUtils.arrayCombine(procDef, ' '));
} else if (s.startsWith("READY")) {
traceOperation("got reply: " + s);
}
......
......@@ -6,6 +6,7 @@
*/
package org.h2.test.synth;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
......@@ -38,7 +39,10 @@ public class TestKill extends TestBase {
String user = getUser();
String password = getPassword();
String selfDestruct = SelfDestructor.getPropertyString(60);
String[] procDef = new String[] { "java", selfDestruct, "-cp", "bin", "org.h2.test.synth.TestKillProcess", url, user,
String[] procDef = new String[] {
"java", selfDestruct,
"-cp", "bin" + File.pathSeparator + ".",
"org.h2.test.synth.TestKillProcess", url, user,
password, baseDir, "" + accounts };
for (int i = 0;; i++) {
......
......@@ -6,6 +6,7 @@
*/
package org.h2.test.synth;
import java.io.File;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
......@@ -34,7 +35,9 @@ public class TestKillRestart extends TestBase {
// "killRestart;CACHE_SIZE=2048;WRITE_DELAY=0;STORAGE=TEXT", true);
String user = getUser(), password = getPassword();
String selfDestruct = SelfDestructor.getPropertyString(60);
String[] procDef = new String[] { "java", selfDestruct, "-cp", "bin", getClass().getName(), "-url", url, "-user", user,
String[] procDef = new String[] { "java", selfDestruct,
"-cp", "bin" + File.pathSeparator + ".",
getClass().getName(), "-url", url, "-user", user,
"-password", password };
int len = getSize(2, 15);
......
......@@ -6,6 +6,7 @@
*/
package org.h2.test.synth;
import java.io.File;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
......@@ -44,7 +45,9 @@ public class TestKillRestartMulti extends TestBase {
user = getUser();
password = getPassword();
String selfDestruct = SelfDestructor.getPropertyString(60);
String[] procDef = new String[] { "java", selfDestruct, "-cp", "bin", getClass().getName(), "-url", url, "-user", user,
String[] procDef = new String[] { "java", selfDestruct,
"-cp", "bin" + File.pathSeparator + ".",
getClass().getName(), "-url", url, "-user", user,
"-password", password };
deleteDb("killRestartMulti");
int len = getSize(3, 10);
......
......@@ -29,12 +29,11 @@ public class TestExit extends TestBase implements DatabaseEventListener {
if (config.codeCoverage || config.networked) {
return;
}
String classPath = "bin" + File.pathSeparator + ".";
deleteDb("exit");
String[] procDef;
String selfDestruct = SelfDestructor.getPropertyString(60);
procDef = new String[] { "java", selfDestruct, "-cp", classPath, getClass().getName(), "" + OPEN_WITH_CLOSE_ON_EXIT };
String[] procDef = new String[] { "java", selfDestruct,
"-cp", "bin" + File.pathSeparator + ".",
getClass().getName(), "" + OPEN_WITH_CLOSE_ON_EXIT };
Process proc = Runtime.getRuntime().exec(procDef);
while (true) {
int ch = proc.getErrorStream().read();
......@@ -55,7 +54,9 @@ public class TestExit extends TestBase implements DatabaseEventListener {
if (!getClosedFile().exists()) {
fail("did not close database");
}
procDef = new String[] { "java", "-cp", classPath, getClass().getName(), "" + OPEN_WITHOUT_CLOSE_ON_EXIT };
procDef = new String[] { "java",
"-cp", "bin" + File.pathSeparator + ".", getClass().getName(),
"" + OPEN_WITHOUT_CLOSE_ON_EXIT };
proc = Runtime.getRuntime().exec(procDef);
proc.waitFor();
Thread.sleep(100);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论