You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by lb...@apache.org on 2019/10/28 11:06:47 UTC

[camel-quarkus] branch master updated (bf2e3e1 -> 14b9085)

This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git.


    from bf2e3e1  core(test): reduce noisy logging in platform-http component tests
     new 1a4c361  main: fire start event before context post processor is fired
     new 14b9085  main: wrap MainListener with a RuntimeValue

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../core/deployment/CamelMainListenerBuildItem.java   |  7 ++++---
 .../java/org/apache/camel/quarkus/core/CamelMain.java |  6 +-----
 .../apache/camel/quarkus/core/CamelMainRecorder.java  |  4 ++--
 .../runtime/support/deployment/SupportBuildStep.java  | 10 ++++++----
 .../quarkus/core/runtime/support/SupportListener.java | 16 +++++++++++++---
 .../quarkus/core/runtime/support/SupportRecorder.java | 19 ++++++++-----------
 .../java/org/apache/camel/quarkus/core/CamelTest.java |  4 ++--
 7 files changed, 36 insertions(+), 30 deletions(-)
 copy extensions/bean/deployment/src/main/java/org/apache/camel/quarkus/component/bean/deployment/BeanProcessor.java => integration-tests/core-main/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/SupportRecorder.java (69%)


[camel-quarkus] 01/02: main: fire start event before context post processor is fired

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 1a4c361eff4b6b8a18cd2c3b10ffd152638d347c
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Sun Oct 27 19:43:11 2019 +0100

    main: fire start event before context post processor is fired
---
 .../java/org/apache/camel/quarkus/core/CamelMain.java    |  6 +-----
 .../quarkus/core/runtime/support/SupportListener.java    | 16 +++++++++++++---
 .../java/org/apache/camel/quarkus/core/CamelTest.java    |  4 ++--
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelMain.java b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelMain.java
index 7e5c7f9..147dc6e 100644
--- a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelMain.java
+++ b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelMain.java
@@ -38,16 +38,12 @@ public class CamelMain extends BaseMainSupport implements CamelContextAware {
     }
 
     @Override
-    protected void doInit() throws Exception {
-        postProcessCamelContext(getCamelContext());
-    }
-
-    @Override
     protected void doStart() throws Exception {
         for (MainListener listener : listeners) {
             listener.beforeStart(this);
         }
 
+        postProcessCamelContext(getCamelContext());
         getCamelContext().start();
 
         for (MainListener listener : listeners) {
diff --git a/integration-tests/core-main/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/SupportListener.java b/integration-tests/core-main/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/SupportListener.java
index 81f3c41..975834e 100644
--- a/integration-tests/core-main/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/SupportListener.java
+++ b/integration-tests/core-main/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/SupportListener.java
@@ -28,9 +28,9 @@ public class SupportListener implements MainListener {
             context.addRoutes(new RouteBuilder() {
                 @Override
                 public void configure() throws Exception {
-                    from("timer:listener")
-                        .id("listener")
-                        .to("log:listener");
+                    from("timer:configure")
+                        .id("configure")
+                        .to("log:configure");
                 }
             });
         } catch (Exception e) {
@@ -40,6 +40,7 @@ public class SupportListener implements MainListener {
 
     @Override
     public void beforeStart(BaseMainSupport main) {
+        main.addRoutesBuilder(new MyBuilder());
     }
 
     @Override
@@ -53,4 +54,13 @@ public class SupportListener implements MainListener {
     @Override
     public void afterStop(BaseMainSupport main) {
     }
+
+    public static class MyBuilder extends RouteBuilder {
+        @Override
+        public void configure() throws Exception {
+            from("timer:beforeStart")
+                .id("beforeStart")
+                .to("log:beforeStart");
+        }
+    }
 }
diff --git a/integration-tests/core-main/test/src/test/java/org/apache/camel/quarkus/core/CamelTest.java b/integration-tests/core-main/test/src/test/java/org/apache/camel/quarkus/core/CamelTest.java
index 3d2a458..934b44c 100644
--- a/integration-tests/core-main/test/src/test/java/org/apache/camel/quarkus/core/CamelTest.java
+++ b/integration-tests/core-main/test/src/test/java/org/apache/camel/quarkus/core/CamelTest.java
@@ -73,9 +73,9 @@ public class CamelTest {
         assertThat(p.getList("listeners", String.class))
             .containsOnly(CamelMainEventDispatcher.class.getName(), SupportListener.class.getName());
         assertThat(p.getList("routeBuilders", String.class))
-            .containsOnly(CamelRoute.class.getName());
+            .containsOnly(CamelRoute.class.getName(), SupportListener.MyBuilder.class.getName());
         assertThat(p.getList("routes", String.class))
-            .containsOnly("keep-alive", "listener", "my-xml-route");
+            .containsOnly("keep-alive", "configure", "beforeStart", "my-xml-route");
 
         assertThat(p.getBoolean("autoConfigurationLogSummary")).isFalse();
 


[camel-quarkus] 02/02: main: wrap MainListener with a RuntimeValue

Posted by lb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 14b90854efdcf8a8574cb2350f67dd2fe999d9c8
Author: lburgazzoli <lb...@gmail.com>
AuthorDate: Sun Oct 27 21:35:46 2019 +0100

    main: wrap MainListener with a RuntimeValue
---
 .../deployment/CamelMainListenerBuildItem.java     |  7 ++++---
 .../camel/quarkus/core/CamelMainRecorder.java      |  4 ++--
 .../support/deployment/SupportBuildStep.java       | 10 ++++++----
 .../core/runtime/support/SupportRecorder.java      | 22 +++++++---------------
 4 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelMainListenerBuildItem.java b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelMainListenerBuildItem.java
index 188177e..0a09ccb 100644
--- a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelMainListenerBuildItem.java
+++ b/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelMainListenerBuildItem.java
@@ -17,6 +17,7 @@
 package org.apache.camel.quarkus.core.deployment;
 
 import io.quarkus.builder.item.MultiBuildItem;
+import io.quarkus.runtime.RuntimeValue;
 import org.apache.camel.main.MainListener;
 import org.apache.camel.quarkus.core.CamelMain;
 
@@ -24,13 +25,13 @@ import org.apache.camel.quarkus.core.CamelMain;
  * A {@link MultiBuildItem} holding {@link MainListener}s to add to {@link CamelMain}.
  */
 public final class CamelMainListenerBuildItem extends MultiBuildItem {
-    private final MainListener listener;
+    private final RuntimeValue<MainListener> listener;
 
-    public CamelMainListenerBuildItem(MainListener listener) {
+    public CamelMainListenerBuildItem(RuntimeValue<MainListener> listener) {
         this.listener = listener;
     }
 
-    public MainListener getListener() {
+    public RuntimeValue<MainListener> getListener() {
         return listener;
     }
 }
diff --git a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelMainRecorder.java b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelMainRecorder.java
index 001a0c7..d851671 100644
--- a/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelMainRecorder.java
+++ b/extensions/core/runtime/src/main/java/org/apache/camel/quarkus/core/CamelMainRecorder.java
@@ -78,8 +78,8 @@ public class CamelMainRecorder {
         }
     }
 
-    public void addListener(RuntimeValue<CamelMain> main, MainListener listener) {
-        main.getValue().addMainListener(listener);
+    public void addListener(RuntimeValue<CamelMain> main, RuntimeValue<MainListener> listener) {
+        main.getValue().addMainListener(listener.getValue());
     }
 
     public void setReactiveExecutor(RuntimeValue<CamelMain> main, RuntimeValue<ReactiveExecutor> executor) {
diff --git a/integration-tests/core-main/deployment/src/main/java/org/apache/camel/quarkus/core/runtime/support/deployment/SupportBuildStep.java b/integration-tests/core-main/deployment/src/main/java/org/apache/camel/quarkus/core/runtime/support/deployment/SupportBuildStep.java
index 3cc84f8..395a634 100644
--- a/integration-tests/core-main/deployment/src/main/java/org/apache/camel/quarkus/core/runtime/support/deployment/SupportBuildStep.java
+++ b/integration-tests/core-main/deployment/src/main/java/org/apache/camel/quarkus/core/runtime/support/deployment/SupportBuildStep.java
@@ -16,14 +16,16 @@
  */
 package org.apache.camel.quarkus.core.runtime.support.deployment;
 
-import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
 import org.apache.camel.quarkus.core.deployment.CamelMainListenerBuildItem;
-import org.apache.camel.quarkus.core.runtime.support.SupportListener;
+import org.apache.camel.quarkus.core.runtime.support.SupportRecorder;
 
 public class SupportBuildStep {
+    @Record(ExecutionTime.STATIC_INIT)
     @BuildStep
-    void listener(BuildProducer<CamelMainListenerBuildItem> listener) {
-        listener.produce(new CamelMainListenerBuildItem(new SupportListener()));
+    CamelMainListenerBuildItem listener(SupportRecorder recorder) {
+        return new CamelMainListenerBuildItem(recorder.createSupportListener());
     }
 }
diff --git a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelMainListenerBuildItem.java b/integration-tests/core-main/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/SupportRecorder.java
similarity index 62%
copy from extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelMainListenerBuildItem.java
copy to integration-tests/core-main/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/SupportRecorder.java
index 188177e..f9eaf3e 100644
--- a/extensions/core/deployment/src/main/java/org/apache/camel/quarkus/core/deployment/CamelMainListenerBuildItem.java
+++ b/integration-tests/core-main/runtime/src/main/java/org/apache/camel/quarkus/core/runtime/support/SupportRecorder.java
@@ -14,23 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.core.deployment;
+package org.apache.camel.quarkus.core.runtime.support;
 
-import io.quarkus.builder.item.MultiBuildItem;
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
 import org.apache.camel.main.MainListener;
-import org.apache.camel.quarkus.core.CamelMain;
 
-/**
- * A {@link MultiBuildItem} holding {@link MainListener}s to add to {@link CamelMain}.
- */
-public final class CamelMainListenerBuildItem extends MultiBuildItem {
-    private final MainListener listener;
-
-    public CamelMainListenerBuildItem(MainListener listener) {
-        this.listener = listener;
-    }
-
-    public MainListener getListener() {
-        return listener;
+@Recorder
+public class SupportRecorder {
+    public RuntimeValue<MainListener> createSupportListener() {
+        return new RuntimeValue<>(new SupportListener());
     }
 }