camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hekon...@apache.org
Subject [1/2] camel git commit: [Spring Boot] Fixed routes collection.
Date Wed, 04 Mar 2015 16:57:09 GMT
Repository: camel
Updated Branches:
  refs/heads/master 7307c0f3d -> f34705754


[Spring Boot] Fixed routes collection.


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

Branch: refs/heads/master
Commit: 2b0e1e2daa6cc160c6b3fbd4880d6002cf90f02d
Parents: 7307c0f
Author: Henryk Konsek <hekonsek@gmail.com>
Authored: Wed Mar 4 16:25:43 2015 +0100
Committer: Henryk Konsek <hekonsek@gmail.com>
Committed: Wed Mar 4 17:56:57 2015 +0100

----------------------------------------------------------------------
 .../camel/spring/boot/RoutesCollector.java      | 10 ++--
 .../spring/boot/DuplicatedRouteIdTest.java      | 61 ++++++++++++++++++++
 2 files changed, 66 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2b0e1e2d/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
index 1d1c805..e5cc977 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/RoutesCollector.java
@@ -49,11 +49,6 @@ public class RoutesCollector implements BeanPostProcessor, PriorityOrdered
{
 
     @Override
     public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
{
-        return bean;
-    }
-
-    @Override
-    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
{
         if (bean instanceof CamelContext && beanName.equals("camelContext")) {
             CamelContext camelContext = (CamelContext) bean;
             LOG.debug("Post-processing CamelContext bean: {}", camelContext.getName());
@@ -76,6 +71,11 @@ public class RoutesCollector implements BeanPostProcessor, PriorityOrdered
{
     }
 
     @Override
+    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
{
+        return bean;
+    }
+
+    @Override
     public int getOrder() {
         return Ordered.LOWEST;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/2b0e1e2d/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/DuplicatedRouteIdTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/DuplicatedRouteIdTest.java
b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/DuplicatedRouteIdTest.java
new file mode 100644
index 0000000..eb5feb1
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/DuplicatedRouteIdTest.java
@@ -0,0 +1,61 @@
+/**
+ * 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.spring.boot;
+
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.factory.BeanCreationException;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+
+public class DuplicatedRouteIdTest extends Assert {
+
+    @Test(expected = BeanCreationException.class)
+    public void shouldDetectDuplicatedRouteId() {
+        new SpringApplication(DuplicatedRouteIdTestConfiguration.class).run();
+    }
+
+}
+
+@SpringBootApplication
+class DuplicatedRouteIdTestConfiguration {
+
+    @Bean
+    RoutesBuilder firstRoute() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("seda:first").routeId("foo").to("mock:first");
+            }
+        };
+    }
+
+    @Bean
+    RoutesBuilder secondRoute() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("seda:second").routeId("foo").to("mock:second");
+            }
+        };
+    }
+
+
+}
\ No newline at end of file


Mime
View raw message