given().pollDelay(0, MILLISECONDS).and().ignoreExceptions().await().until(new Callable<Boolean>() { @Override public Boolean call() {
given().ignoreExceptions().untilAsserted(() -> assertThat( findServerMeter("UnaryCall", "requests", COUNT, "result", "success", "httpStatus", "200")) .contains(4.0)); given().ignoreExceptions().untilAsserted(() -> assertThat( findServerMeter("UnaryCall", "requests", COUNT, "result", "failure", "httpStatus", "200")) .contains(3.0)); given().ignoreExceptions().untilAsserted(() -> assertThat( findClientMeter("UnaryCall", "requests", COUNT, "result", "success")).contains(4.0)); given().ignoreExceptions().untilAsserted(() -> assertThat( findClientMeter("UnaryCall", "requests", COUNT, "result", "failure")).contains(3.0));
@Test public void unframed() throws Exception { makeUnframedRequest("world"); makeUnframedRequest("world"); makeUnframedRequest("space"); makeUnframedRequest("world"); makeUnframedRequest("space"); makeUnframedRequest("space"); makeUnframedRequest("world"); // Chance that get() returns NPE before the metric is first added, so ignore exceptions. given().ignoreExceptions().untilAsserted(() -> assertThat( findServerMeter("UnaryCall2", "requests", COUNT, "result", "success", "httpStatus", "200")) .contains(4.0)); given().ignoreExceptions().untilAsserted(() -> assertThat( findServerMeter("UnaryCall2", "requests", COUNT, "result", "failure", "httpStatus", "500")) .contains(3.0)); assertThat(findServerMeter("UnaryCall2", "responseLength", COUNT, "httpStatus", "200")).contains(4.0); assertThat(findServerMeter("UnaryCall2", "responseLength", COUNT, "httpStatus", "500")).contains(3.0); assertThat(findServerMeter("UnaryCall2", "responseLength", TOTAL, "httpStatus", "200")).contains(0.0); assertThat(findServerMeter("UnaryCall2", "responseLength", TOTAL, "httpStatus", "500")).contains(225.0); }
@Test(timeout = 2000) public void ignoredExceptionsAreAddedToExceptionHierarchy() { try { await().ignoreExceptions().atMost(200, TimeUnit.MILLISECONDS).until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { throw new Exception("Nested"); } }); fail(); } catch (ConditionTimeoutException e) { assertNotNull(e.getCause()); assertEquals("Nested", e.getCause().getMessage()); } }
@Test(timeout = 2000) public void exceptionsDuringEvaluationAreIgnoredUponRequest() { new Asynch(fakeRepository).perform(); await().atMost(1000, MILLISECONDS).and().ignoreExceptions().until(conditionsThatIsThrowingAnExceptionForATime(IllegalArgumentException.class)); }
@Test(timeout = 2000) public void throwablesDuringEvaluationAreIgnoredUponRequest() { new Asynch(fakeRepository).perform(); await().atMost(1000, MILLISECONDS).and().ignoreExceptions().until(conditionsThatIsThrowingAnExceptionForATime(AssertionError.class)); }
@BeforeClass public static void exceptionThrowingSetupStep() { new Asynch(fakeRepository).perform(); Awaitility .with().ignoreExceptions() .await().atMost(1000, TimeUnit.MILLISECONDS).until( conditionsThatIsThrowingAnExceptionForATime() ); }
@Override protected void before() throws Throwable { Awaitility.await() .ignoreExceptions() .atMost(waitDuration) .pollInterval(Duration.ONE_SECOND) .until(serversAreReady()); } };
private static void waitUntil(Callable<Boolean> condition) { Awaitility.await() .ignoreExceptions() .atMost(Duration.TWO_MINUTES) .pollInterval(Duration.TWO_SECONDS) .until(condition); }
/** * Tests that non-sticky sessions are not leading to stale data - that sessions are removed from * tomcat when the request is finished. */ @Test( enabled = true ) public void testNoStaleSessionsWithNonStickySessions() throws IOException, InterruptedException, HttpException { _tomcat1.getManager().setMaxInactiveInterval( 1 ); _tomcat2.getManager().setMaxInactiveInterval( 1 ); final String key = "foo"; final String value1 = "bar"; final String sessionId1 = post( _httpClient, TC_PORT_1, null, key, value1 ).getSessionId(); assertNotNull( sessionId1 ); await("session exists in memcached").ignoreExceptions().until(new Callable<Object>() { @Override public Object call() throws Exception { return _client.get( sessionId1 ); } }, notNullValue()); /* We modify the stored value with the next request which is served by tc2 */ final String value2 = "baz"; final String sessionId2 = post( _httpClient, TC_PORT_2, sessionId1, key, value2 ).getSessionId(); assertEquals( sessionId2, sessionId1 ); /* Check that tc1 reads the updated value */ final Response response = get( _httpClient, TC_PORT_1, sessionId1 ); assertEquals( response.getSessionId(), sessionId1 ); assertEquals( response.get( key ), value2 ); }
public void await(final Request request, Function<Response, Boolean> checker) { Awaitility.await() .atMost(30, TimeUnit.SECONDS) .ignoreExceptions() .until(() -> { try (Response response = httpClient.newCall(request).execute()) { return checker.apply(response); } }); } }
long localRevision() throws IOException { return await().ignoreExceptions().until(() -> { try (BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(new File(dataDir, "last_revision"))))) { return Long.parseLong(br.readLine()); } }, Objects::nonNull); }
private void waitForDiferenciaToBecomeHealthy() { try { given().ignoreExceptions() .await().atMost(10, TimeUnit.SECONDS).until(diferenciaClient::healthy); } catch (ConditionTimeoutException e) { throw new IllegalStateException(diferenciaExecutor.checkForFailure(), e); } }
public LogsTable hasValueInRow(int row, String content){ await() .ignoreExceptions() .until(() -> Arrays.stream(me().contents()[row]).anyMatch(c -> c.equals(content))); return this; }
private void waitForVideoCompleted(File video) { try { await().atMost(5, TimeUnit.SECONDS) .pollDelay(1, TimeUnit.SECONDS) .ignoreExceptions() .until(video::exists); } catch (ConditionTimeoutException ex) { throw new RecordingException(ex.getMessage()); } } }
private void waitForVideoCompleted(File video) { try { await().atMost(5, TimeUnit.SECONDS) .pollDelay(1, TimeUnit.SECONDS) .ignoreExceptions() .until(video::exists); } catch (ConditionTimeoutException ex) { throw new RecordingException(ex.getMessage()); } } }
public static void waitFor(final int timeout, final ThrowingRunnable condition) { Awaitility.await() .ignoreExceptions() .atMost(timeout, TimeUnit.SECONDS) .untilAsserted(condition); } }
public LogViewPanel importFiles() { LOGGER.info("Clicking import logs"); await().ignoreExceptions().until(() -> frame.button("OpenPanel.import").click()); return new LogViewPanel(frame, robot); }
public LogsTable waitForSelectedRow(int number){ await() .ignoreExceptions() .until(() -> me().requireSelectedRows(number)); return this; }
@Test(retryAnalyzer = RetryAnalyzer.class) public void processClipboardWithUnixCommand() { setClipboard("line1\nline2\nline3"); final MainFrame mainFrame = new MainFrame(robot()); final ParseClipboardDialog dialog = mainFrame.welcomeScreen().clickParseClipboard(); dialog.processingPattern().setText("sed s/line/entry/g | grep 1 | cut -c 5-6"); await().ignoreExceptions().until(() -> dialog.processedContent().text().equals("y1")); }