protected int doTest(PolledAssertion p, TimeUnit timeUnit, long length) { return p.await(timeUnit, length); }
public int await(float seconds) { return await(TimeUnit.MILLISECONDS, (int)(seconds * 1000)); }
/** * Wait for the assertions to pass for the duration of the timeout period * * Validation will be attempted and errors handled silently until the timeout period expires after which assertion * errors will be propagated and will cause test failure */ public int await() { return await(getTimeoutSeconds()); }
@Override public boolean waitForClientConnection(String clientName) { if ( isRunning.get() ) { PolledAssertion polledAssertion = new PolledAssertion() { @Override protected void validate() throws Exception { if ( ! alignedClients.contains(clientName)) { boolean connected = connectedClients.contains(clientName); String message = connected ? "connect" : "finish publishing steps (send steps aligned)"; throw new ChorusException("Client " + clientName + " did not " + message); } } }; boolean result = true; try { polledAssertion.await(TimeUnit.SECONDS, webSocketsConfig.getClientConnectTimeoutSeconds()); } catch (AssertionError assertionError) { result = false; } return result; } else { throw new ChorusException("Web Socket Server is not running"); } }