You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2020/03/26 08:39:50 UTC

[camel] branch master updated (1897bd7 -> b412d4a)

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

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


    from 1897bd7  CAMEL-14640: Upgrade to http client 4.x for testing.
     new 2ca46fe  [CAMEL-14712] Fix lightweight context wrt latest lifecycle changes
     new b412d4a  Fix amqp unit tests

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:
 .../apache/camel/component/amqp/AMQPComponent.java |  4 ++--
 .../camel/impl/lw/LightweightCamelContext.java     | 12 +++---------
 .../java/org/apache/camel/ContextTestSupport.java  | 22 ++++++----------------
 3 files changed, 11 insertions(+), 27 deletions(-)


[camel] 01/02: [CAMEL-14712] Fix lightweight context wrt latest lifecycle changes

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

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

commit 2ca46fec0b8764fb218771be8315ab5d5a1f1b3b
Author: gnodet <gn...@gmail.com>
AuthorDate: Thu Mar 26 09:38:57 2020 +0100

    [CAMEL-14712] Fix lightweight context wrt latest lifecycle changes
---
 .../camel/impl/lw/LightweightCamelContext.java     | 12 +++---------
 .../java/org/apache/camel/ContextTestSupport.java  | 22 ++++++----------------
 2 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java
index 21919db..5096769 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java
@@ -224,11 +224,6 @@ public class LightweightCamelContext implements ExtendedCamelContext, CatalogCam
     }
 
     @Override
-    public void init() {
-        delegate.init();
-    }
-
-    @Override
     public void suspend() {
         delegate.suspend();
     }
@@ -1658,12 +1653,11 @@ public class LightweightCamelContext implements ExtendedCamelContext, CatalogCam
     // Immutable
     //
 
-    public void makeImmutable() {
+    public void init() {
         if (delegate instanceof LightweightRuntimeCamelContext) {
-            throw new IllegalStateException();
+            return;
         }
-        delegate.setAutoStartup(false);
-        delegate.start();
+        delegate.init();
         for (Route route : delegate.getRoutes()) {
             clearModelReferences(route);
         }
diff --git a/core/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java b/core/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
index 49029e0..1f8a87d4 100644
--- a/core/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
+++ b/core/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
@@ -107,21 +107,22 @@ public abstract class ContextTestSupport extends TestSupport {
         }
         assertValidContext(context);
 
+        context.build();
+
+        template = context.createProducerTemplate();
+        consumer = context.createConsumerTemplate();
+
         if (isUseRouteBuilder()) {
             RouteBuilder[] builders = createRouteBuilders();
             for (RouteBuilder builder : builders) {
                 log.debug("Using created route builder: {}", builder);
                 context.addRoutes(builder);
             }
-            context.init();
         } else {
             log.debug("isUseRouteBuilder() is false");
         }
 
-
-        template = context.createProducerTemplate();
         template.start();
-        consumer = context.createConsumerTemplate();
         consumer.start();
 
         // create a default notifier when 1 exchange is done which is the most
@@ -183,18 +184,7 @@ public abstract class ContextTestSupport extends TestSupport {
         if (camelContextService != null) {
             camelContextService.start();
         } else {
-            if (context instanceof LightweightCamelContext) {
-                LightweightCamelContext ctx = (LightweightCamelContext) context;
-                Boolean autoStartup = ctx.isAutoStartup();
-                ctx.setAutoStartup(false);
-                ctx.start();
-                ctx.makeImmutable();
-                if (autoStartup != null && autoStartup) {
-                    ctx.startImmutable();
-                }
-            } else {
-                context.start();
-            }
+            context.start();
         }
     }
 


[camel] 02/02: Fix amqp unit tests

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

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

commit b412d4a179a0da594daec562cd24645e9c66db68
Author: gnodet <gn...@gmail.com>
AuthorDate: Thu Mar 26 09:39:12 2020 +0100

    Fix amqp unit tests
---
 .../src/main/java/org/apache/camel/component/amqp/AMQPComponent.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java
index d2ebf9f..5269a7e 100644
--- a/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java
+++ b/components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPComponent.java
@@ -72,7 +72,7 @@ public class AMQPComponent extends JmsComponent {
     // Life-cycle
 
     @Override
-    protected void doStart() throws Exception {
+    protected void doInit() throws Exception {
         Set<AMQPConnectionDetails> connectionDetails = getCamelContext().getRegistry().findByType(AMQPConnectionDetails.class);
         if (connectionDetails.size() == 1) {
             AMQPConnectionDetails details = connectionDetails.iterator().next();
@@ -82,7 +82,7 @@ public class AMQPComponent extends JmsComponent {
             }
             getConfiguration().setConnectionFactory(connectionFactory);
         }
-        super.doStart();
+        super.doInit();
     }
 
     @Override