This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new de7d87c0bd Increase MockEndpoint assertion wait timeout for JMS
resequence test
de7d87c0bd is described below
commit de7d87c0bdc17fe9f0abf1f03c43613e0eed5aa4
Author: James Netherton <[email protected]>
AuthorDate: Tue Oct 15 13:53:32 2024 +0100
Increase MockEndpoint assertion wait timeout for JMS resequence test
Fixes #2957
---
.../messaging/it/MessagingCommonResource.java | 24 ++++++++++++++++------
.../messaging/it/AbstractMessagingTest.java | 17 ++++++---------
2 files changed, 24 insertions(+), 17 deletions(-)
diff --git
a/integration-tests/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/MessagingCommonResource.java
b/integration-tests/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/MessagingCommonResource.java
index 3b559b6ed0..f9fe4499fb 100644
---
a/integration-tests/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/MessagingCommonResource.java
+++
b/integration-tests/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/MessagingCommonResource.java
@@ -40,6 +40,7 @@ import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.apache.camel.CamelContext;
@@ -247,17 +248,28 @@ public class MessagingCommonResource {
topicResultB.assertIsSatisfied(5000);
}
- @Path("/mock/{name}/{count}/{timeout}")
+ @Path("/resequence")
+ @Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.APPLICATION_JSON)
- @GET
- public List<String> mock(@PathParam("name") String name,
@PathParam("count") int count, @PathParam("timeout") int timeout) {
- MockEndpoint mock = context.getEndpoint("mock:" + name,
MockEndpoint.class);
- mock.setExpectedMessageCount(count);
+ @POST
+ public List<String> resequence(@QueryParam("queueName") String queueName,
String payload) {
+ String[] messages = payload.split(",");
+ MockEndpoint mock = context.getEndpoint("mock:resequence",
MockEndpoint.class);
+ mock.setExpectedMessageCount(messages.length);
+ mock.setResultWaitTime(30000);
+
try {
- mock.assertIsSatisfied(timeout);
+ for (String message : messages) {
+ produceJmsQueueMessage(queueName, message);
+ }
+
+ mock.assertIsSatisfied(10000);
} catch (InterruptedException e1) {
Thread.currentThread().interrupt();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
+
return mock.getExchanges().stream().map(e ->
e.getMessage().getBody(String.class)).collect(Collectors.toList());
}
diff --git
a/integration-tests/messaging/common/src/test/java/org/apache/camel/quarkus/component/messaging/it/AbstractMessagingTest.java
b/integration-tests/messaging/common/src/test/java/org/apache/camel/quarkus/component/messaging/it/AbstractMessagingTest.java
index 04165ae9cd..5f2a25655c 100644
---
a/integration-tests/messaging/common/src/test/java/org/apache/camel/quarkus/component/messaging/it/AbstractMessagingTest.java
+++
b/integration-tests/messaging/common/src/test/java/org/apache/camel/quarkus/component/messaging/it/AbstractMessagingTest.java
@@ -32,7 +32,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
@@ -152,23 +151,19 @@ public abstract class AbstractMessagingTest {
.body(is("JMS Transaction Success"));
}
- @DisabledIfEnvironmentVariable(named = "CI", matches = "true",
disabledReason = "https://github.com/apache/camel-quarkus/issues/2957")
@Test
public void testResequence() {
final List<String> messages = Arrays.asList("a", "b", "c", "c", "d");
- for (String msg : messages) {
- RestAssured.given()
- .body(msg)
- .post("/messaging/{queueName}", queue)
- .then()
- .statusCode(201);
- }
- Collections.reverse(messages);
final List<String> actual = RestAssured.given()
- .get("/messaging/mock/resequence/5/10000")
+ .contentType(ContentType.TEXT)
+ .queryParam("queueName", queue)
+ .body(String.join(",", messages))
+ .post("/messaging/resequence")
.then()
.statusCode(200)
.extract().body().jsonPath().getList(".", String.class);
+
+ Collections.reverse(messages);
Assertions.assertEquals(messages, actual);
}