CAMEL-9789: Avoid starting services to soon during CamelContext startup, that 
can trigger circular dependencies issue with Spring and similar IoC frameworks.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/bd137a2e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/bd137a2e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/bd137a2e

Branch: refs/heads/master
Commit: bd137a2ede93e603fc4e28d85e45d88ea060798e
Parents: d81e4ee
Author: Claus Ibsen <davscl...@apache.org>
Authored: Wed Apr 6 16:52:20 2016 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Thu Apr 7 09:39:40 2016 +0200

----------------------------------------------------------------------
 .../GuavaEventBusConsumerConfigurationTest.java | 22 +++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bd137a2e/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java
 
b/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java
index 69e0b6b..7b091d4 100644
--- 
a/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java
+++ 
b/components/camel-guava-eventbus/src/test/java/org/apache/camel/component/guava/eventbus/GuavaEventBusConsumerConfigurationTest.java
@@ -18,15 +18,22 @@ package org.apache.camel.component.guava.eventbus;
 
 import com.google.common.eventbus.EventBus;
 import org.apache.camel.CamelContext;
+import org.apache.camel.FailedToCreateRouteException;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.SimpleRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class GuavaEventBusConsumerConfigurationTest {
+public class GuavaEventBusConsumerConfigurationTest extends CamelTestSupport {
 
-    @Test(expected = IllegalStateException.class)
-    public void shouldForwardMessageToCamel() throws Exception {
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void invalidConfiguration() throws Exception {
         // Given
         SimpleRegistry registry = new SimpleRegistry();
         registry.put("eventBus", new EventBus());
@@ -39,8 +46,13 @@ public class GuavaEventBusConsumerConfigurationTest {
             }
         });
 
-        // When
-        context.start();
+        try {
+            context.start();
+            fail("Should throw exception");
+        } catch (FailedToCreateRouteException e) {
+            IllegalStateException ise = 
assertIsInstanceOf(IllegalStateException.class, e.getCause());
+            assertEquals("You cannot set both 'eventClass' and 
'listenerInterface' parameters.", ise.getMessage());
+        }
     }
 
 }

Reply via email to