You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by he...@apache.org on 2015/03/04 17:57:09 UTC
[1/2] camel git commit: [Spring Boot] Fixed routes collection.
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 <he...@gmail.com>
Authored: Wed Mar 4 16:25:43 2015 +0100
Committer: Henryk Konsek <he...@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
[2/2] camel git commit: [Spring Boot] Added @Component test.
Posted by he...@apache.org.
[Spring Boot] Added @Component test.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f3470575
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f3470575
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f3470575
Branch: refs/heads/master
Commit: f3470575496d7f60eb440fcfc8602d4725aef771
Parents: 2b0e1e2
Author: Henryk Konsek <he...@gmail.com>
Authored: Wed Mar 4 17:56:40 2015 +0100
Committer: Henryk Konsek <he...@gmail.com>
Committed: Wed Mar 4 17:56:58 2015 +0100
----------------------------------------------------------------------
.../boot/componentroute/ComponentRoute.java | 30 +++++++++++
.../boot/componentroute/ComponentRouteTest.java | 55 ++++++++++++++++++++
2 files changed, 85 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f3470575/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java
new file mode 100644
index 0000000..9dad981
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java
@@ -0,0 +1,30 @@
+/**
+ * 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.componentroute;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ComponentRoute extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+ from("direct:componentRoute").to("mock:componentRoute");
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/f3470575/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java
new file mode 100644
index 0000000..c950f1e
--- /dev/null
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRouteTest.java
@@ -0,0 +1,55 @@
+/**
+ * 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.componentroute;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.test.SpringApplicationConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootApplication
+@SpringApplicationConfiguration(classes = ComponentRouteTest.class)
+public class ComponentRouteTest extends Assert {
+
+ @EndpointInject(uri = "mock:componentRoute")
+ MockEndpoint mock;
+
+ @Autowired
+ ProducerTemplate producerTemplate;
+
+ @Test
+ public void shouldNotProvideConverter() throws InterruptedException {
+ // Given
+ String msg = "msg";
+ mock.expectedBodiesReceived(msg);
+
+ // When
+ producerTemplate.sendBody("direct:componentRoute", msg);
+
+ // Then
+ mock.assertIsSatisfied();
+ }
+
+}
+