提交 2869f880 authored 作者: Thomas Mueller's avatar Thomas Mueller

The API of the tools changed a bit.

上级 4a6e0d2d
......@@ -137,13 +137,17 @@ ShutdownHandler {
tcpStart = true;
pgStart = true;
}
SQLException startException = null;
boolean webRunning = false;
if (webStart) {
try {
web = Server.createWebServer(args);
web.setShutdownHandler(this);
web.start();
webRunning = true;
} catch (SQLException e) {
printProblem(e, web);
startException = e;
}
}
if (tcpStart) {
......@@ -152,6 +156,9 @@ ShutdownHandler {
tcp.start();
} catch (SQLException e) {
printProblem(e, tcp);
if (startException == null) {
startException = e;
}
}
}
if (pgStart) {
......@@ -160,10 +167,13 @@ ShutdownHandler {
pg.start();
} catch (SQLException e) {
printProblem(e, pg);
if (startException == null) {
startException = e;
}
}
}
//## AWT begin ##
if (toolStart && !GraphicsEnvironment.isHeadless()) {
if (toolStart && webRunning && !GraphicsEnvironment.isHeadless()) {
if (isWindows) {
font = new Font("Dialog", Font.PLAIN, 11);
} else {
......@@ -187,8 +197,8 @@ ShutdownHandler {
if (browserStart) {
StartBrowser.openURL(web.getURL());
}
if (!web.isRunning(true)) {
throw new SQLException("The web server is not running");
if (startException != null) {
throw startException;
}
}
......
......@@ -93,18 +93,18 @@ public class TestTools extends TestBase {
String result;
Connection conn;
result = runServer(new String[]{"-?"}, 1);
assertTrue(result.indexOf("Starts H2 Servers") >= 0);
result = runServer(new String[]{"-?"}, 0);
assertTrue(result.indexOf("Starts the H2 Console") >= 0);
assertTrue(result.indexOf("Unknown option") < 0);
result = runServer(new String[]{"-xy"}, 1);
assertTrue(result.indexOf("Starts H2 Servers") >= 0);
assertTrue(result.indexOf("Starts the H2 Console") >= 0);
assertTrue(result.indexOf("Unsupported option") >= 0);
result = runServer(new String[]{"-tcp", "-tcpPort", "9001", "-tcpPassword", "abc"}, 0);
assertTrue(result.indexOf("tcp://") >= 0);
assertTrue(result.indexOf(":9001") >= 0);
assertTrue(result.indexOf("only local") >= 0);
assertTrue(result.indexOf("Starts H2 Servers") < 0);
assertTrue(result.indexOf("Starts the H2 Console") < 0);
conn = DriverManager.getConnection("jdbc:h2:tcp://localhost:9001/mem:", "sa", "sa");
conn.close();
result = runServer(new String[]{"-tcpShutdown", "tcp://localhost:9001", "-tcpPassword", "abc", "-tcpShutdownForce"}, 0);
......@@ -114,7 +114,7 @@ public class TestTools extends TestBase {
assertTrue(result.indexOf("ssl://") >= 0);
assertTrue(result.indexOf(":9001") >= 0);
assertTrue(result.indexOf("others can") >= 0);
assertTrue(result.indexOf("Starts H2 Servers") < 0);
assertTrue(result.indexOf("Starts the H2 Console") < 0);
conn = DriverManager.getConnection("jdbc:h2:ssl://localhost:9001/mem:", "sa", "sa");
conn.close();
......@@ -130,7 +130,6 @@ public class TestTools extends TestBase {
result = runServer(new String[]{
"-web", "-webPort", "9002", "-webAllowOthers", "-webSSL",
"-pg", "-pgAllowOthers", "-pgPort", "9003",
"-ftp", "-ftpPort", "9004", "-ftpDir", ".", "-ftpRead", "guest", "-ftpWrite", "sa", "-ftpWritePassword", "sa", "-ftpTask",
"-tcp", "-tcpAllowOthers", "-tcpPort", "9006", "-tcpPassword", "abc"}, 0);
Server stop = server;
assertTrue(result.indexOf("https://") >= 0);
......@@ -139,8 +138,6 @@ public class TestTools extends TestBase {
assertTrue(result.indexOf(":9003") >= 0);
assertTrue(result.indexOf("others can") >= 0);
assertTrue(result.indexOf("only local") < 0);
assertTrue(result.indexOf("ftp://") >= 0);
assertTrue(result.indexOf(":9004") >= 0);
assertTrue(result.indexOf("tcp://") >= 0);
assertTrue(result.indexOf(":9006") >= 0);
......@@ -168,6 +165,7 @@ public class TestTools extends TestBase {
server.run(args);
} catch (SQLException e) {
result = 1;
e.printStackTrace(ps);
}
assertEquals(exitCode, result);
ps.flush();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论