diff options
Diffstat (limited to 'java/test/controller/src')
-rw-r--r-- | java/test/controller/src/main/java/Test/Common/ControllerServer.java | 11 | ||||
-rw-r--r-- | java/test/controller/src/main/slice/Controller.ice | 10 |
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); }; }; |