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 29fa300  Use a custom NativeImageStartedNotifier for box native tests 
to work around #2830
29fa300 is described below

commit 29fa3000179eed3c0b3f98169ad7dad370907006
Author: James Netherton <jamesnether...@gmail.com>
AuthorDate: Wed Jun 23 12:41:37 2021 +0100

    Use a custom NativeImageStartedNotifier for box native tests to work around 
#2830
---
 integration-tests/box/pom.xml                      |  9 +++--
 .../box/src/main/resources/application.properties  |  2 ++
 .../CamelBoxNativeApplicationStartedNotifier.java  | 40 ++++++++++++++++++++++
 ....quarkus.test.common.NativeImageStartedNotifier |  1 +
 4 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/integration-tests/box/pom.xml b/integration-tests/box/pom.xml
index 9ae3cb6..ec52660 100644
--- a/integration-tests/box/pom.xml
+++ b/integration-tests/box/pom.xml
@@ -35,6 +35,10 @@
             <artifactId>camel-quarkus-box</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-direct</artifactId>
+        </dependency>
+        <dependency>
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-resteasy</artifactId>
         </dependency>
@@ -57,8 +61,9 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-direct</artifactId>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
         </dependency>
 
         <!-- The following dependencies guarantee that this module is built 
after them. You can update them by running `mvn process-resources -Pformat -N` 
from the source tree root directory -->
diff --git a/integration-tests/box/src/main/resources/application.properties 
b/integration-tests/box/src/main/resources/application.properties
index d8da800..a6cd55a 100644
--- a/integration-tests/box/src/main/resources/application.properties
+++ b/integration-tests/box/src/main/resources/application.properties
@@ -28,3 +28,5 @@ camel.component.box.userName = {{env:BOX_USER_NAME}}
 camel.component.box.userPassword = {{env:BOX_USER_PASSWORD}}
 camel.component.box.clientId = {{env:BOX_CLIENT_ID}}
 camel.component.box.clientSecret = {{env:BOX_CLIENT_SECRET}}
+
+quarkus.log.file.enable = true
diff --git 
a/integration-tests/box/src/test/java/org/apache/camel/quarkus/component/box/it/CamelBoxNativeApplicationStartedNotifier.java
 
b/integration-tests/box/src/test/java/org/apache/camel/quarkus/component/box/it/CamelBoxNativeApplicationStartedNotifier.java
new file mode 100644
index 0000000..655b900
--- /dev/null
+++ 
b/integration-tests/box/src/test/java/org/apache/camel/quarkus/component/box/it/CamelBoxNativeApplicationStartedNotifier.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.box.it;
+
+import java.nio.file.Paths;
+import java.util.concurrent.TimeUnit;
+
+import io.quarkus.bootstrap.util.IoUtils;
+import io.quarkus.test.common.NativeImageStartedNotifier;
+import org.awaitility.Awaitility;
+
+/**
+ * TODO: Investigate why the native app takes so long to start and eventually 
remove this
+ * https://github.com/apache/camel-quarkus/issues/2830
+ */
+public class CamelBoxNativeApplicationStartedNotifier implements 
NativeImageStartedNotifier {
+
+    @Override
+    public boolean isNativeImageStarted() {
+        Awaitility.await().pollDelay(1, TimeUnit.SECONDS).timeout(30, 
TimeUnit.SECONDS).until(() -> {
+            String log = IoUtils.readFile(Paths.get("target/quarkus.log"));
+            return log.contains("Installed features");
+        });
+        return true;
+    }
+}
diff --git 
a/integration-tests/box/src/test/resources/META-INF/services/io.quarkus.test.common.NativeImageStartedNotifier
 
b/integration-tests/box/src/test/resources/META-INF/services/io.quarkus.test.common.NativeImageStartedNotifier
new file mode 100644
index 0000000..efacdf3
--- /dev/null
+++ 
b/integration-tests/box/src/test/resources/META-INF/services/io.quarkus.test.common.NativeImageStartedNotifier
@@ -0,0 +1 @@
+org.apache.camel.quarkus.component.box.it.CamelBoxNativeApplicationStartedNotifier
\ No newline at end of file

Reply via email to