aldettinger commented on code in PR #3919:
URL: https://github.com/apache/camel-quarkus/pull/3919#discussion_r940156333
##########
integration-tests/google-pubsub/src/test/java/org/apache/camel/quarkus/component/google/pubsub/it/GooglePubsubTest.java:
##########
@@ -56,6 +74,219 @@ public void jacksonSerializer() {
RestAssured.get("/google-pubsub/pojo")
.then()
.statusCode(200)
- .body("name", is(fruitName));
+ .body("name", Matchers.is(fruitName));
+
+ }
+
+ @Test
+ @Order(3)
+ public void testGrouped() throws Exception {
+ RestAssured.given()
+ .queryParam("toEndpoint",
GooglePubSubRoutes.GROUP_DIRECT_AGGREGATOR)
+ .body("body1")
+ .post("/google-pubsub/sendToEndpoint")
+ .then()
+ .statusCode(201);
+
+ RestAssured.given()
+
.get("/google-pubsub/receive/subscription/google-pubsub.grouped-subscription-name")
+ .then()
+ .statusCode(204);
+
+ RestAssured.given()
+ .queryParam("toEndpoint",
GooglePubSubRoutes.GROUP_DIRECT_AGGREGATOR)
+ .body("body2")
+ .post("/google-pubsub/sendToEndpoint")
+ .then()
+ .statusCode(201);
+
+ Set<String> results = new HashSet<>();
+ results.add(RestAssured.given()
+
.get("/google-pubsub/receive/subscription/google-pubsub.grouped-subscription-name")
+ .then()
+ .statusCode(200).extract().asString());
+
+ results.add(RestAssured.given()
+
.get("/google-pubsub/receive/subscription/google-pubsub.grouped-subscription-name")
+ .then()
+ .statusCode(200).extract().asString());
+
+ Assertions.assertTrue(results.contains("body1"));
+ Assertions.assertTrue(results.contains("body2"));
+
+ }
+
+ //Disabled on real account because of
https://issues.apache.org/jira/browse/CAMEL-18277
+ @DisabledIfEnvironmentVariable(named = "GOOGLE_APPLICATION_CREDENTIALS",
matches = ".+")
+ // https://github.com/apache/camel-quarkus/issues/3944
+ @DisabledIfEnvironmentVariable(named = "CI", matches = "true")
+ @Test
+ @Order(4)
+ public void testOrdering() throws Exception {
+ LOG.info("Start of the ordering test");
+ RestAssured.given()
+ .queryParam("toEndpoint",
GooglePubSubRoutes.ORDERING_DIRECT_IN)
+ .body("1")
+ .post("/google-pubsub/sendToEndpoint")
+ .then()
+ .statusCode(201);
+ RestAssured.given()
+ .queryParam("toEndpoint",
GooglePubSubRoutes.ORDERING_DIRECT_IN)
+ .body("2")
+ .post("/google-pubsub/sendToEndpoint")
+ .then()
+ .statusCode(201);
+ RestAssured.given()
+ .queryParam("toEndpoint",
GooglePubSubRoutes.ORDERING_DIRECT_IN)
+ .body("3")
+ .post("/google-pubsub/sendToEndpoint")
+ .then()
+ .statusCode(201);
+ RestAssured.given()
+ .queryParam("toEndpoint",
GooglePubSubRoutes.ORDERING_DIRECT_IN)
+ .body("4")
+ .post("/google-pubsub/sendToEndpoint")
+ .then()
+ .statusCode(201);
+ RestAssured.given()
+ .queryParam("toEndpoint",
GooglePubSubRoutes.ORDERING_DIRECT_IN)
+ .body("5")
+ .post("/google-pubsub/sendToEndpoint")
+ .then()
+ .statusCode(201);
+ RestAssured.given()
+ .queryParam("toEndpoint",
GooglePubSubRoutes.ORDERING_DIRECT_IN)
+ .body("6")
+ .post("/google-pubsub/sendToEndpoint")
+ .then()
+ .statusCode(201);
+ LOG.info("All messages were sent");
+
+ await().atMost(5, TimeUnit.SECONDS).until(() -> RestAssured.given()
+
.get("/google-pubsub/receive/subscriptionOrdering/google-pubsub.ordering-subscription-name")
+ .then()
+ .statusCode(200)
+ .statusCode(200).extract().asString(),
+ Matchers.is("1"));
+ LOG.info("Message \"1\" received.");
+ await().atMost(5, TimeUnit.SECONDS).until(() -> RestAssured.given()
+
.get("/google-pubsub/receive/subscriptionOrdering/google-pubsub.ordering-subscription-name")
+ .then()
+ .statusCode(200).extract().asString(),
+ Matchers.is("2"));
+ LOG.info("Message \"2\" received.");
+ await().atMost(5, TimeUnit.SECONDS).until(() -> RestAssured.given()
+
.get("/google-pubsub/receive/subscriptionOrdering/google-pubsub.ordering-subscription-name")
+ .then()
+ .statusCode(200)
+ .statusCode(200).extract().asString(),
+ Matchers.is("3"));
+ LOG.info("Message \"3\" received.");
+ await().atMost(5, TimeUnit.SECONDS).until(() -> RestAssured.given()
+
.get("/google-pubsub/receive/subscriptionOrdering/google-pubsub.ordering-subscription-name")
+ .then()
+ .statusCode(200)
+ .statusCode(200).extract().asString(),
+ Matchers.is("4"));
+ LOG.info("Message \"4\" received.");
+ await().atMost(5, TimeUnit.SECONDS).until(() -> RestAssured.given()
+
.get("/google-pubsub/receive/subscriptionOrdering/google-pubsub.ordering-subscription-name")
+ .then()
+ .statusCode(200)
+ .statusCode(200).extract().asString(),
+ Matchers.is("5"));
+ LOG.info("Message \"5\" received.");
+ await().atMost(5, TimeUnit.SECONDS).until(() -> RestAssured.given()
+
.get("/google-pubsub/receive/subscriptionOrdering/google-pubsub.ordering-subscription-name")
+ .then()
+ .statusCode(200)
+ .statusCode(200).extract().asString(),
+ Matchers.is("6"));
+ LOG.info("Message \"6\" received.");
+
+ }
+
+ @Test
+ @Order(5)
+ public void testAck() throws Exception {
+ LOG.info("Start of the acking test");
+ //enable ack
Review Comment:
The comments in the test are really helpful :+1:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]