You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2021/06/14 07:43:00 UTC
[camel-quarkus] branch main updated: fix Unable to determine the
status of the running process in TimerIT without resteasy #2772
This is an automated email from the ASF dual-hosted git repository.
ppalaga 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 040da37 fix Unable to determine the status of the running process in TimerIT without resteasy #2772
040da37 is described below
commit 040da37ced33c76cda54639a889607dd1a90df8f
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Fri Jun 11 10:48:28 2021 -0400
fix Unable to determine the status of the running process in TimerIT without resteasy #2772
---
.../quarkus/component/timer/it/TimerProducers.java | 17 ++++++++++++++++-
.../camel/quarkus/component/timer/it/TimerTest.java | 2 +-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/integration-test-groups/foundation/timer/src/main/java/org/apache/camel/quarkus/component/timer/it/TimerProducers.java b/integration-test-groups/foundation/timer/src/main/java/org/apache/camel/quarkus/component/timer/it/TimerProducers.java
index 26e584d..e0e25d8 100644
--- a/integration-test-groups/foundation/timer/src/main/java/org/apache/camel/quarkus/component/timer/it/TimerProducers.java
+++ b/integration-test-groups/foundation/timer/src/main/java/org/apache/camel/quarkus/component/timer/it/TimerProducers.java
@@ -16,9 +16,12 @@
*/
package org.apache.camel.quarkus.component.timer.it;
+import java.util.Optional;
+
import javax.enterprise.context.ApplicationScoped;
import org.apache.camel.builder.LambdaRouteBuilder;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.jboss.logging.Logger;
@ApplicationScoped
@@ -26,10 +29,22 @@ public class TimerProducers {
private static final Logger LOG = Logger.getLogger(TimerProducers.class);
+ public static final String LOG_MESSAGE = "Lets's fool io.quarkus.test.common.LauncherUtil.CaptureListeningDataReader: Listening on: http://0.0.0.0:";
+ @ConfigProperty(name = "quarkus.http.test-port")
+ Optional<Integer> httpTestPort;
+ @ConfigProperty(name = "quarkus.http.port")
+ Optional<Integer> httpPort;
+
+ private int getEffectivePort() {
+ final boolean isNativeMode = "executable".equals(System.getProperty("org.graalvm.nativeimage.kind"));
+ Optional<Integer> portSource = isNativeMode ? httpPort : httpTestPort;
+ return portSource.isPresent() ? portSource.get().intValue() : 0;
+ }
+
@javax.enterprise.inject.Produces
public LambdaRouteBuilder lambdaRoute() {
return rb -> rb.from("timer:bar").routeId("bar")
- .process(e -> LOG.info("Hello from timer:bar"));
+ .process(e -> LOG.info(LOG_MESSAGE + getEffectivePort()));
}
}
diff --git a/integration-test-groups/foundation/timer/src/test/java/org/apache/camel/quarkus/component/timer/it/TimerTest.java b/integration-test-groups/foundation/timer/src/test/java/org/apache/camel/quarkus/component/timer/it/TimerTest.java
index 7ab0417..a88a61d 100644
--- a/integration-test-groups/foundation/timer/src/test/java/org/apache/camel/quarkus/component/timer/it/TimerTest.java
+++ b/integration-test-groups/foundation/timer/src/test/java/org/apache/camel/quarkus/component/timer/it/TimerTest.java
@@ -33,7 +33,7 @@ public class TimerTest {
public void timer() {
await().atMost(10L, TimeUnit.SECONDS).pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
String log = new String(Files.readAllBytes(Paths.get("target/quarkus.log")), StandardCharsets.UTF_8);
- return log.contains("keep-alive: I'm alive !") && log.contains("Hello from timer:bar");
+ return log.contains("keep-alive: I'm alive !") && log.contains(TimerProducers.LOG_MESSAGE);
});
}