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 2014/10/27 15:59:30 UTC
git commit: [CAMEL-7963] Added CamelContextConfiguration callback.
Repository: camel
Updated Branches:
refs/heads/master a5032cb9d -> c2c7d66da
[CAMEL-7963] Added CamelContextConfiguration callback.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c2c7d66d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c2c7d66d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c2c7d66d
Branch: refs/heads/master
Commit: c2c7d66da90323982f34ef8afb59915365ff642f
Parents: a5032cb
Author: Henryk Konsek <he...@gmail.com>
Authored: Mon Oct 27 15:59:24 2014 +0100
Committer: Henryk Konsek <he...@gmail.com>
Committed: Mon Oct 27 15:59:24 2014 +0100
----------------------------------------------------------------------
.../spring/boot/CamelAutoConfiguration.java | 7 ++++++
.../spring/boot/CamelContextConfiguration.java | 25 ++++++++++++++++++++
.../spring/boot/CamelAutoConfigurationTest.java | 16 +++++++++++++
3 files changed, 48 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c2c7d66d/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
index 38ab141..2c56a65 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
@@ -114,6 +114,9 @@ public class CamelAutoConfiguration {
@Autowired(required = false)
private RoutesBuilder[] routesBuilders;
+ @Autowired(required = false)
+ private CamelContextConfiguration camelContextConfiguration;
+
/**
* Spring-aware Camel context for the application. Auto-detects and loads all routes available in the Spring
* context.
@@ -132,6 +135,10 @@ public class CamelAutoConfiguration {
}
}
+ if (camelContextConfiguration != null) {
+ camelContextConfiguration.postConfiguration(camelContext);
+ }
+
return camelContext;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/c2c7d66d/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelContextConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelContextConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelContextConfiguration.java
new file mode 100644
index 0000000..bec420e
--- /dev/null
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelContextConfiguration.java
@@ -0,0 +1,25 @@
+/**
+ * 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.CamelContext;
+
+public interface CamelContextConfiguration {
+
+ void postConfiguration(CamelContext camelContext);
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/c2c7d66d/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
index b363b00..8efd6f6 100644
--- a/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
+++ b/components/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/CamelAutoConfigurationTest.java
@@ -32,6 +32,9 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
@RunWith(SpringJUnit4ClassRunner.class)
@EnableAutoConfiguration
@SpringApplicationConfiguration(classes = CamelAutoConfigurationTest.class)
@@ -46,6 +49,9 @@ public class CamelAutoConfigurationTest extends Assert {
CamelContext camelContext;
@Autowired
+ CamelContextConfiguration camelContextConfiguration;
+
+ @Autowired
ProducerTemplate producerTemplate;
@Autowired
@@ -59,6 +65,11 @@ public class CamelAutoConfigurationTest extends Assert {
String routeId = "testRoute";
@Bean
+ CamelContextConfiguration camelContextConfiguration() {
+ return mock(CamelContextConfiguration.class);
+ }
+
+ @Bean
RouteBuilder routeBuilder() {
return new RouteBuilder() {
@Override
@@ -125,4 +136,9 @@ public class CamelAutoConfigurationTest extends Assert {
assertEquals(hundred, convertedLong);
}
+ @Test
+ public void shouldCallCamelContextConfiguration() {
+ verify(camelContextConfiguration).postConfiguration(camelContext);
+ }
+
}