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 2021/02/10 10:54:51 UTC
[camel-quarkus] 03/08: add HazelcastReplicatedmapConsumer test
fixes #2095
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 a9d02ed702171d5275dd61daeecb46b6b322d719
Author: Zineb Bendhiba <be...@gmail.com>
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<String> 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<String> body = RestAssured.get("/deleted").then().extract().body().as(List.class);
+ return body.size() == 1 && body.contains("1");
+ });
+
}
}