CAMEL-10222: Added docs and examples and added a small fix to integration tests


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

Branch: refs/heads/master
Commit: 1e16019e39c151aed5aec0e6a50805bfb27f315e
Parents: a0cacd9
Author: Nicola Ferraro <ni.ferr...@gmail.com>
Authored: Tue Sep 20 14:48:10 2016 +0200
Committer: Nicola Ferraro <ni.ferr...@gmail.com>
Committed: Tue Sep 20 14:48:10 2016 +0200

----------------------------------------------------------------------
 components-starter/README.adoc                  | 27 ++++++++++++
 examples/camel-example-hystrix/client/pom.xml   |  4 +-
 examples/camel-example-hystrix/service1/pom.xml |  6 +--
 spring-boot-dm/README.adoc                      | 46 ++++++++++++++++++++
 .../springboot/util/ArquillianPackager.java     |  2 +-
 .../springboot/util/DependencyResolver.java     | 12 +++++
 6 files changed, 91 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1e16019e/components-starter/README.adoc
----------------------------------------------------------------------
diff --git a/components-starter/README.adoc b/components-starter/README.adoc
new file mode 100755
index 0000000..3016f8d
--- /dev/null
+++ b/components-starter/README.adoc
@@ -0,0 +1,27 @@
+= Camel Component Starters
+
+Starters are Apache Camel modules intended to be used in Spring Boot 
applications.
+There is a `camel-xxx-starter` module for each Camel component (with few 
exceptions listed below).
+
+Starters are created to meet the following requirements:
+
+* Allow the auto-configuration of the component through the native spring-boot 
configuration system (compatible with IDE tooling)
+* Manage transitive logging dependencies to better integrate with spring-boot 
logging system
+* Include additional dependencies and align transitive ones to minimize the 
effort of creating a working spring-boot application
+
+Each starter has its own integration test (in path 
`tests/camel-itest-spring-boot`) that verifies its compatibility with the 
current release of spring-boot.
+
+The following components do not have a starter because of compatibility issues:
+
+* **camel-blueprint**
+* **camel-cdi**
+* **camel-core-osgi**
+* **camel-ejb**
+* **camel-eventadmin**
+* **camel-ibatis** (`camel-mybatis-starter` is included)
+* **camel-jclouds**
+* **camel-mina** (`camel-mina2-starter` is included)
+* **camel-paxlogging**
+* **camel-quartz** (`camel-quartz2-starter` is included)
+* **camel-spark-rest**
+* **camel-swagger** (`camel-swagger-java-starter` is included)

http://git-wip-us.apache.org/repos/asf/camel/blob/1e16019e/examples/camel-example-hystrix/client/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-hystrix/client/pom.xml 
b/examples/camel-example-hystrix/client/pom.xml
index ae5164b..aa90a99 100644
--- a/examples/camel-example-hystrix/client/pom.xml
+++ b/examples/camel-example-hystrix/client/pom.xml
@@ -69,11 +69,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-http</artifactId>
+      <artifactId>camel-http-starter</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-hystrix</artifactId>
+      <artifactId>camel-hystrix-starter</artifactId>
     </dependency>
 
   </dependencies>

http://git-wip-us.apache.org/repos/asf/camel/blob/1e16019e/examples/camel-example-hystrix/service1/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-hystrix/service1/pom.xml 
b/examples/camel-example-hystrix/service1/pom.xml
index 344c83c..3b48a1a 100644
--- a/examples/camel-example-hystrix/service1/pom.xml
+++ b/examples/camel-example-hystrix/service1/pom.xml
@@ -69,15 +69,15 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-hystrix</artifactId>
+      <artifactId>camel-hystrix-starter</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-jetty</artifactId>
+      <artifactId>camel-jetty-starter</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-http</artifactId>
+      <artifactId>camel-http-starter</artifactId>
     </dependency>
 
   </dependencies>

http://git-wip-us.apache.org/repos/asf/camel/blob/1e16019e/spring-boot-dm/README.adoc
----------------------------------------------------------------------
diff --git a/spring-boot-dm/README.adoc b/spring-boot-dm/README.adoc
new file mode 100755
index 0000000..3af7326
--- /dev/null
+++ b/spring-boot-dm/README.adoc
@@ -0,0 +1,46 @@
+= Camel Spring-Boot Dependency Management
+
+The `spring-boot-dm` module include tools to generate a valid spring-boot BOM 
(bill of materials)
+that can be used in spring-boot applications.
+
+Using the generated BOM (`camel-spring-boot-dependencies`), together with the 
Spring framework's `spring-boot-dependencies`,
+ is the preferred way of configuring a Camel-based application running on 
Spring-Boot.
+
+The POM of a end user application should include both BOMs, as in the 
following example:
+
+[source,xml]
+.pom.xml
+----
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  ...
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-dependencies</artifactId>
+        <version>${spring-boot-version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-spring-boot-dependencies</artifactId>
+        <version>${project.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <!-- Include all needed camel-xxx-starter modules -->
+  </dependencies>
+
+  ...
+
+</project>
+----
+
+The `camel-spring-boot-dependencies` BOM includes Camel modules
+and all transitive dependencies that have no conflicts with the spring-boot 
BOM.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/1e16019e/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/ArquillianPackager.java
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/ArquillianPackager.java
 
b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/ArquillianPackager.java
index 6342204..d092753 100644
--- 
a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/ArquillianPackager.java
+++ 
b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/ArquillianPackager.java
@@ -472,7 +472,7 @@ public final class ArquillianPackager {
         Matcher m = propPattern.matcher(pom);
         while (m.find()) {
             String property = m.group();
-            String resolved = 
DependencyResolver.resolveParentProperty(property);
+            String resolved = 
DependencyResolver.resolveModuleOrParentProperty(new File(new 
File(config.getModuleBasePath()), "pom.xml"), property);
             resolvedProperties.put(property, resolved);
         }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1e16019e/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/DependencyResolver.java
----------------------------------------------------------------------
diff --git 
a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/DependencyResolver.java
 
b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/DependencyResolver.java
index c4b76f5..09311ae 100644
--- 
a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/DependencyResolver.java
+++ 
b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/DependencyResolver.java
@@ -77,6 +77,18 @@ public final class DependencyResolver {
         return dependencies;
     }
 
+    public static String resolveModuleOrParentProperty(File modulePom, String 
property) {
+        property = resolveProperty(modulePom, property, 0);
+        if (property != null && !isResolved(property)) {
+            property = resolveSpringBootParentProperty(property);
+        }
+        if (property != null && !isResolved(property)) {
+            property = resolveCamelParentProperty(property);
+        }
+
+        return property;
+    }
+
     public static String resolveParentProperty(String property) {
         property = resolveSpringBootParentProperty(property);
         if (property != null && !isResolved(property)) {

Reply via email to