use of org.eclipse.wst.server.core.IServer.IOperationListener in project sling by apache.
the class SlingWstServer method waitForServerToStart.
public void waitForServerToStart(long duration, TimeUnit timeUnit) throws InterruptedException {
final CountDownLatch startLatch = new CountDownLatch(1);
final IStatus[] statusHolder = new IStatus[1];
server.start(ILaunchManager.RUN_MODE, new IOperationListener() {
@Override
public void done(IStatus result) {
statusHolder[0] = result;
startLatch.countDown();
}
});
boolean success = startLatch.await(duration, timeUnit);
assertThat("Server did not start in " + duration + " " + timeUnit, success, equalTo(true));
assertThat("Unexpected IStatus when starting server", statusHolder[0], IStatusIsOk.isOk());
}
Aggregations