You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2020/03/19 14:47:06 UTC
[camel-quarkus] branch master updated: Use Awaitility to poll for
Google calendar deletion
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new cd53178 Use Awaitility to poll for Google calendar deletion
cd53178 is described below
commit cd53178dbb212c553387334cf41226c64770fb7e
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Mar 19 13:14:17 2020 +0000
Use Awaitility to poll for Google calendar deletion
---
integration-tests/google/pom.xml | 11 +++++++++++
.../component/google/it/GoogleComponentsTest.java | 23 ++++++++++++++--------
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/integration-tests/google/pom.xml b/integration-tests/google/pom.xml
index 6abda8f..185f863 100644
--- a/integration-tests/google/pom.xml
+++ b/integration-tests/google/pom.xml
@@ -74,6 +74,17 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
<build>
diff --git a/integration-tests/google/src/test/java/org/apache/camel/quarkus/component/google/it/GoogleComponentsTest.java b/integration-tests/google/src/test/java/org/apache/camel/quarkus/component/google/it/GoogleComponentsTest.java
index cab11b3..2287945 100644
--- a/integration-tests/google/src/test/java/org/apache/camel/quarkus/component/google/it/GoogleComponentsTest.java
+++ b/integration-tests/google/src/test/java/org/apache/camel/quarkus/component/google/it/GoogleComponentsTest.java
@@ -17,10 +17,12 @@
package org.apache.camel.quarkus.component.google.it;
import java.util.UUID;
+import java.util.concurrent.TimeUnit;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
+import org.awaitility.Awaitility;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
@@ -34,7 +36,7 @@ import static org.hamcrest.Matchers.is;
class GoogleComponentsTest {
@Test
- public void testGoogleCalendarComponent() throws InterruptedException {
+ public void testGoogleCalendarComponent() {
String summary = "Camel Quarkus Google Calendar";
String eventText = summary += " Event";
@@ -103,13 +105,18 @@ class GoogleComponentsTest {
.statusCode(204);
// Wait for calendar deletion to occur
- Thread.sleep(1000);
-
- RestAssured.given()
- .queryParam("calendarId", calendarId)
- .get("/google-calendar/read")
- .then()
- .statusCode(404);
+ Awaitility.await()
+ .pollDelay(500, TimeUnit.MILLISECONDS)
+ .pollInterval(100, TimeUnit.MILLISECONDS)
+ .atMost(10, TimeUnit.SECONDS).until(() -> {
+ final int code = RestAssured.given()
+ .queryParam("calendarId", calendarId)
+ .post("/google-calendar/read")
+ .then()
+ .extract()
+ .statusCode();
+ return code != 404;
+ });
}
@Test