[camel-quarkus] 04/04: add HazelcastReplicatedmapConsumer test fixes #2095

2021-01-26 Thread github-bot
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch camel-master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 771155f27d330d824d7c057127b344051e882e6a
Author: Zineb Bendhiba 
AuthorDate: Mon Jan 25 10:31:56 2021 +0100

add HazelcastReplicatedmapConsumer test fixes #2095
---
 .../hazelcast/it/HazelcastReplicatedmapTest.java   | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java
 
b/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java
index 222e545..b134a2a 100644
--- 
a/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java
+++ 
b/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java
@@ -16,16 +16,20 @@
  */
 package org.apache.camel.quarkus.component.hazelcast.it;
 
+import java.util.Arrays;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.common.http.TestHTTPEndpoint;
 import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
 import 
org.apache.camel.quarkus.component.hazelcast.it.model.HazelcastMapRequest;
 import org.junit.jupiter.api.Test;
 
 import static io.restassured.RestAssured.given;
+import static org.awaitility.Awaitility.await;
 import static org.hamcrest.Matchers.equalTo;
 
 @QuarkusTest
@@ -89,7 +93,7 @@ public class HazelcastReplicatedmapTest {
 .then()
 .body(equalTo("true"));
 
-// verify that map doesn't contain value "val2"
+// verify that map doesn't contain value "val3"
 given()
 .contentType(ContentType.JSON)
 .when()
@@ -119,5 +123,17 @@ public class HazelcastReplicatedmapTest {
 .then()
 .statusCode(202);
 
+// verify that the consumer has received all added keys
+await().atMost(10L, TimeUnit.SECONDS).until(() -> {
+List body = 
RestAssured.get("/added").then().extract().body().as(List.class);
+return body.size() == 2 && body.containsAll(Arrays.asList("1", 
"2"));
+});
+
+// verify that the consumer has received all removed keys
+await().atMost(10L, TimeUnit.SECONDS).until(() -> {
+List body = 
RestAssured.get("/deleted").then().extract().body().as(List.class);
+return body.size() == 1 && body.contains("1");
+});
+
 }
 }



[camel-quarkus] 04/04: add HazelcastReplicatedmapConsumer test fixes #2095

2021-01-26 Thread jamesnetherton
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch camel-master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 4469e2223622a90409c71dd6ac5149868ead5109
Author: Zineb Bendhiba 
AuthorDate: Mon Jan 25 10:31:56 2021 +0100

add HazelcastReplicatedmapConsumer test fixes #2095
---
 .../hazelcast/it/HazelcastReplicatedmapTest.java   | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git 
a/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java
 
b/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java
index 222e545..b134a2a 100644
--- 
a/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java
+++ 
b/integration-tests/hazelcast/src/test/java/org/apache/camel/quarkus/component/hazelcast/it/HazelcastReplicatedmapTest.java
@@ -16,16 +16,20 @@
  */
 package org.apache.camel.quarkus.component.hazelcast.it;
 
+import java.util.Arrays;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 import io.quarkus.test.common.QuarkusTestResource;
 import io.quarkus.test.common.http.TestHTTPEndpoint;
 import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
 import 
org.apache.camel.quarkus.component.hazelcast.it.model.HazelcastMapRequest;
 import org.junit.jupiter.api.Test;
 
 import static io.restassured.RestAssured.given;
+import static org.awaitility.Awaitility.await;
 import static org.hamcrest.Matchers.equalTo;
 
 @QuarkusTest
@@ -89,7 +93,7 @@ public class HazelcastReplicatedmapTest {
 .then()
 .body(equalTo("true"));
 
-// verify that map doesn't contain value "val2"
+// verify that map doesn't contain value "val3"
 given()
 .contentType(ContentType.JSON)
 .when()
@@ -119,5 +123,17 @@ public class HazelcastReplicatedmapTest {
 .then()
 .statusCode(202);
 
+// verify that the consumer has received all added keys
+await().atMost(10L, TimeUnit.SECONDS).until(() -> {
+List body = 
RestAssured.get("/added").then().extract().body().as(List.class);
+return body.size() == 2 && body.containsAll(Arrays.asList("1", 
"2"));
+});
+
+// verify that the consumer has received all removed keys
+await().atMost(10L, TimeUnit.SECONDS).until(() -> {
+List body = 
RestAssured.get("/deleted").then().extract().body().as(List.class);
+return body.size() == 1 && body.contains("1");
+});
+
 }
 }