summaryrefslogtreecommitdiff
path: root/java/test
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2015-10-01 16:27:11 -0230
committerDwayne Boone <dwayne@zeroc.com>2015-10-01 16:27:11 -0230
commit36a9c67e6a0832a50d64f39f5bfd328beb56e989 (patch)
treeefbf378ddba4c84aad86d3306b61d3c8b22fab3e /java/test
parentFixed missing lib directory for RPATH on install of Py/Ruby/Php modules (diff)
downloadice-36a9c67e6a0832a50d64f39f5bfd328beb56e989.tar.bz2
ice-36a9c67e6a0832a50d64f39f5bfd328beb56e989.tar.xz
ice-36a9c67e6a0832a50d64f39f5bfd328beb56e989.zip
ICE-6767 Better handling of server start failure by test controller
Diffstat (limited to 'java/test')
-rw-r--r--java/test/controller/src/main/java/Test/Common/ControllerServer.java11
-rw-r--r--java/test/controller/src/main/slice/Controller.ice10
2 files changed, 16 insertions, 5 deletions
diff --git a/java/test/controller/src/main/java/Test/Common/ControllerServer.java b/java/test/controller/src/main/java/Test/Common/ControllerServer.java
index 508c27d90ae..6bb7d874993 100644
--- a/java/test/controller/src/main/java/Test/Common/ControllerServer.java
+++ b/java/test/controller/src/main/java/Test/Common/ControllerServer.java
@@ -26,6 +26,7 @@ public class ControllerServer extends Ice.Application
public ServerI(Process process, String name)
{
_process = process;
+ _processOutput = new StringBuffer();
_name = name;
_started = 0;
_terminated = false;
@@ -46,6 +47,11 @@ public class ControllerServer extends Ice.Application
String line = null;
while((line = reader.readLine()) != null)
{
+ if(_started == 0)
+ {
+ _processOutput.append(line + "\n");
+ }
+
if(line.matches(Pattern.quote("starting server...") + ".*ok") ||
line.matches(Pattern.quote("starting serveramd...") + ".*ok") ||
line.matches(Pattern.quote("starting servertie...") + ".*ok") ||
@@ -137,6 +143,7 @@ public class ControllerServer extends Ice.Application
}
public synchronized void waitForServer(Ice.Current current)
+ throws ServerFailedException
{
while(!_terminated)
{
@@ -156,12 +163,12 @@ public class ControllerServer extends Ice.Application
}
if(_terminated && _started == 0)
{
- // TODO: Add user exception instead of throwing a local exception.
- throw new RuntimeException("process failed to start");
+ throw new ServerFailedException(_processOutput.toString());
}
}
private Process _process;
+ private StringBuffer _processOutput;
private String _name;
private int _started;
private boolean _terminated;
diff --git a/java/test/controller/src/main/slice/Controller.ice b/java/test/controller/src/main/slice/Controller.ice
index 0508b4826da..7e4c2b95eda 100644
--- a/java/test/controller/src/main/slice/Controller.ice
+++ b/java/test/controller/src/main/slice/Controller.ice
@@ -13,10 +13,15 @@ module Test
module Common
{
+exception ServerFailedException
+{
+ string reason;
+};
+
interface Server
{
void waitTestSuccess();
- void waitForServer();
+ void waitForServer() throws ServerFailedException;
void terminate();
};
@@ -24,8 +29,7 @@ sequence<string> StringSeq;
interface Controller
{
- Server* runServer(string lang, string name, string protocol, string host, bool winrt,
- StringSeq options);
+ Server* runServer(string lang, string name, string protocol, string host, bool winrt, StringSeq options);
};
};