You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/03/24 14:19:13 UTC

[camel] branch master updated (be6c78a -> 58300b8)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from be6c78a  CAMEL-14779: Polished
     new 23efbbe  CAMEL-14779: Move Main out of camel-spring due to osgi circular dependency issue
     new 58300b8  CAMEL-14779: Move Main out of camel-spring due to osgi circular dependency issue

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 apache-camel/src/main/descriptors/common-bin.xml   |  1 +
 components/camel-spring-main/pom.xml               | 86 ++++++++++++++++++++++
 .../services/org/apache/camel/other.properties     |  7 ++
 .../src/generated/resources/spring-main.json       | 14 ++++
 .../src/main/docs/spring-main.adoc                 |  4 +
 .../main/java/org/apache/camel/spring/Main.java    |  0
 .../camel-spring-main/src/test}/data/message1.xml  |  0
 .../camel-spring-main/src/test}/data/message2.xml  |  0
 .../java/org/apache/camel/spring/DummyBean.java    |  0
 .../org/apache/camel/spring/MainDummyTest.java     |  0
 .../org/apache/camel/spring/MainExampleTest.java   |  1 -
 .../java/org/apache/camel/spring}/MainIoCTest.java |  3 +-
 .../java/org/apache/camel/spring/MainTest.java     |  1 -
 .../java/org/apache/camel/spring/MainVetoTest.java |  0
 .../camel/spring}/MisspelledRouteRefTest.java      |  7 +-
 .../java/org/apache/camel/spring}/MyHelloBean.java |  2 +-
 .../camel/spring}/MyMainIoCRouteBuilder.java       |  2 +-
 .../java/org/apache/camel/spring/MyProcessor.java} | 30 ++++++--
 .../org/apache/camel/spring/MyRouteBuilder.java}   | 12 +--
 .../org/apache/camel/spring/MyVetoLifecycle.java   |  0
 .../spring}/SpringMainStartFailedIssueTest.java    |  9 +--
 .../resources/META-INF/spring/camel-context.xml    |  0
 .../src/test/resources/META-INF/spring/dummy.xml   |  0
 .../src/test/resources/log4j2.properties           | 28 +++++++
 .../org/apache/camel/spring/MainVetoTest.xml       |  0
 .../camel/spring}/MisspelledRouteRefTest.xml       |  2 +-
 .../spring}/SpringMainStartFailedIssueTest.xml     |  0
 .../apache/camel/spring/routingUsingProcessor.xml} |  8 +-
 components/pom.xml                                 |  1 +
 parent/pom.xml                                     |  5 ++
 tooling/maven/camel-maven-plugin/pom.xml           |  3 +-
 31 files changed, 193 insertions(+), 33 deletions(-)
 create mode 100644 components/camel-spring-main/pom.xml
 create mode 100644 components/camel-spring-main/src/generated/resources/META-INF/services/org/apache/camel/other.properties
 create mode 100644 components/camel-spring-main/src/generated/resources/spring-main.json
 create mode 100644 components/camel-spring-main/src/main/docs/spring-main.adoc
 rename components/{camel-spring => camel-spring-main}/src/main/java/org/apache/camel/spring/Main.java (100%)
 copy {tests/camel-itest-cdi/src => components/camel-spring-main/src/test}/data/message1.xml (100%)
 copy {tests/camel-itest-cdi/src => components/camel-spring-main/src/test}/data/message2.xml (100%)
 copy components/{camel-spring => camel-spring-main}/src/test/java/org/apache/camel/spring/DummyBean.java (100%)
 rename components/{camel-spring => camel-spring-main}/src/test/java/org/apache/camel/spring/MainDummyTest.java (100%)
 rename components/{camel-spring => camel-spring-main}/src/test/java/org/apache/camel/spring/MainExampleTest.java (97%)
 rename components/{camel-spring/src/test/java/org/apache/camel/spring/main => camel-spring-main/src/test/java/org/apache/camel/spring}/MainIoCTest.java (95%)
 rename components/{camel-spring => camel-spring-main}/src/test/java/org/apache/camel/spring/MainTest.java (97%)
 rename components/{camel-spring => camel-spring-main}/src/test/java/org/apache/camel/spring/MainVetoTest.java (100%)
 rename components/{camel-spring/src/test/java/org/apache/camel/spring/issues => camel-spring-main/src/test/java/org/apache/camel/spring}/MisspelledRouteRefTest.java (89%)
 copy components/{camel-spring/src/test/java/org/apache/camel/spring/main => camel-spring-main/src/test/java/org/apache/camel/spring}/MyHelloBean.java (96%)
 rename components/{camel-spring/src/test/java/org/apache/camel/spring/main => camel-spring-main/src/test/java/org/apache/camel/spring}/MyMainIoCRouteBuilder.java (96%)
 copy components/{camel-spring/src/test/java/org/apache/camel/spring/MyVetoLifecycle.java => camel-spring-main/src/test/java/org/apache/camel/spring/MyProcessor.java} (57%)
 rename components/{camel-spring/src/test/java/org/apache/camel/spring/main/MyHelloBean.java => camel-spring-main/src/test/java/org/apache/camel/spring/MyRouteBuilder.java} (78%)
 rename components/{camel-spring => camel-spring-main}/src/test/java/org/apache/camel/spring/MyVetoLifecycle.java (100%)
 rename components/{camel-spring/src/test/java/org/apache/camel/spring/issues => camel-spring-main/src/test/java/org/apache/camel/spring}/SpringMainStartFailedIssueTest.java (85%)
 copy components/{camel-spring => camel-spring-main}/src/test/resources/META-INF/spring/camel-context.xml (100%)
 copy components/{camel-spring => camel-spring-main}/src/test/resources/META-INF/spring/dummy.xml (100%)
 create mode 100644 components/camel-spring-main/src/test/resources/log4j2.properties
 copy components/{camel-spring => camel-spring-main}/src/test/resources/org/apache/camel/spring/MainVetoTest.xml (100%)
 rename components/{camel-spring/src/test/resources/org/apache/camel/spring/issues => camel-spring-main/src/test/resources/org/apache/camel/spring}/MisspelledRouteRefTest.xml (94%)
 rename components/{camel-spring/src/test/resources/org/apache/camel/spring/issues => camel-spring-main/src/test/resources/org/apache/camel/spring}/SpringMainStartFailedIssueTest.xml (100%)
 rename components/{camel-spring/src/test/resources/org/apache/camel/spring/MainVetoTest.xml => camel-spring-main/src/test/resources/org/apache/camel/spring/routingUsingProcessor.xml} (88%)


[camel] 01/02: CAMEL-14779: Move Main out of camel-spring due to osgi circular dependency issue

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 23efbbe11bbcb939f2791b3ec2d2028e46c7ae06
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 24 15:08:45 2020 +0100

    CAMEL-14779: Move Main out of camel-spring due to osgi circular dependency issue
---
 components/camel-spring-main/pom.xml               | 86 ++++++++++++++++++++++
 .../services/org/apache/camel/other.properties     |  7 ++
 .../src/generated/resources/spring-main.json       | 14 ++++
 .../src/main/docs/spring-main.adoc                 |  4 +
 .../main/java/org/apache/camel/spring/Main.java    |  0
 .../src/test/data/message1.xml}                    | 21 ++----
 .../src/test/data/message2.xml}                    | 21 ++----
 .../java/org/apache/camel/spring/DummyBean.java}   | 16 ++--
 .../org/apache/camel/spring/MainDummyTest.java     |  0
 .../org/apache/camel/spring/MainExampleTest.java   |  1 -
 .../java/org/apache/camel/spring}/MainIoCTest.java |  3 +-
 .../java/org/apache/camel/spring/MainTest.java     |  1 -
 .../java/org/apache/camel/spring/MainVetoTest.java |  0
 .../camel/spring}/MisspelledRouteRefTest.java      |  7 +-
 .../java/org/apache/camel/spring}/MyHelloBean.java |  2 +-
 .../camel/spring}/MyMainIoCRouteBuilder.java       |  2 +-
 .../java/org/apache/camel/spring/MyProcessor.java} | 30 ++++++--
 .../org/apache/camel/spring/MyRouteBuilder.java}   | 12 +--
 .../org/apache/camel/spring/MyVetoLifecycle.java   |  0
 .../spring}/SpringMainStartFailedIssueTest.java    |  9 +--
 .../resources/META-INF/spring/camel-context.xml}   | 42 +++++++++--
 .../src/test/resources/META-INF/spring/dummy.xml}  | 14 +---
 .../src/test/resources/log4j2.properties           | 28 +++++++
 .../org/apache/camel/spring/MainVetoTest.xml       |  0
 .../camel/spring}/MisspelledRouteRefTest.xml       |  2 +-
 .../spring}/SpringMainStartFailedIssueTest.xml     |  0
 .../apache/camel/spring/routingUsingProcessor.xml} |  8 +-
 components/pom.xml                                 |  1 +
 28 files changed, 244 insertions(+), 87 deletions(-)

diff --git a/components/camel-spring-main/pom.xml b/components/camel-spring-main/pom.xml
new file mode 100644
index 0000000..cdb66b9
--- /dev/null
+++ b/components/camel-spring-main/pom.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>components</artifactId>
+        <version>3.2.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-spring-main</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Spring Main</name>
+    <description>Camel Spring Main support</description>
+
+    <properties>
+        <firstVersion>3.2.0</firstVersion>
+        <label>spring</label>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-spring</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-main</artifactId>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-xpath</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-spring</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
diff --git a/components/camel-spring-main/src/generated/resources/META-INF/services/org/apache/camel/other.properties b/components/camel-spring-main/src/generated/resources/META-INF/services/org/apache/camel/other.properties
new file mode 100644
index 0000000..e462639
--- /dev/null
+++ b/components/camel-spring-main/src/generated/resources/META-INF/services/org/apache/camel/other.properties
@@ -0,0 +1,7 @@
+# Generated by camel build tools - do NOT edit this file!
+name=spring-main
+groupId=org.apache.camel
+artifactId=camel-spring-main
+version=3.2.0-SNAPSHOT
+projectName=Camel :: Spring Main
+projectDescription=Camel Spring Main support
diff --git a/components/camel-spring-main/src/generated/resources/spring-main.json b/components/camel-spring-main/src/generated/resources/spring-main.json
new file mode 100644
index 0000000..7427100
--- /dev/null
+++ b/components/camel-spring-main/src/generated/resources/spring-main.json
@@ -0,0 +1,14 @@
+{
+  "other": {
+    "kind": "other",
+    "name": "spring-main",
+    "title": "Spring Main",
+    "description": "Camel Spring Main support",
+    "deprecated": false,
+    "firstVersion": "3.2.0",
+    "label": "spring",
+    "groupId": "org.apache.camel",
+    "artifactId": "camel-spring-main",
+    "version": "3.2.0-SNAPSHOT"
+  }
+}
diff --git a/components/camel-spring-main/src/main/docs/spring-main.adoc b/components/camel-spring-main/src/main/docs/spring-main.adoc
new file mode 100644
index 0000000..58c43c8
--- /dev/null
+++ b/components/camel-spring-main/src/main/docs/spring-main.adoc
@@ -0,0 +1,4 @@
+[[SpringMain-SpringMain]]
+= Spring Main
+
+This module is used for running Spring standalone via a main class extended from `camel-main`.
diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/Main.java b/components/camel-spring-main/src/main/java/org/apache/camel/spring/Main.java
similarity index 100%
rename from components/camel-spring/src/main/java/org/apache/camel/spring/Main.java
rename to components/camel-spring-main/src/main/java/org/apache/camel/spring/Main.java
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml b/components/camel-spring-main/src/test/data/message1.xml
similarity index 60%
copy from components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml
copy to components/camel-spring-main/src/test/data/message1.xml
index 0d4dd0e..1a85d06 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml
+++ b/components/camel-spring-main/src/test/data/message1.xml
@@ -17,19 +17,8 @@
     limitations under the License.
 
 -->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-    ">
-
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
-        <route>
-            <from uri="xxx:unknown"/>
-            <to uri="mock:foo"/>
-        </route>
-
-    </camelContext>
-
-</beans>
+<person user="james">
+  <firstName>James</firstName>
+  <lastName>Strachan</lastName>
+  <city>London</city>
+</person>
\ No newline at end of file
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml b/components/camel-spring-main/src/test/data/message2.xml
similarity index 60%
copy from components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml
copy to components/camel-spring-main/src/test/data/message2.xml
index 0d4dd0e..73c88bf 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml
+++ b/components/camel-spring-main/src/test/data/message2.xml
@@ -17,19 +17,8 @@
     limitations under the License.
 
 -->
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-    ">
-
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
-        <route>
-            <from uri="xxx:unknown"/>
-            <to uri="mock:foo"/>
-        </route>
-
-    </camelContext>
-
-</beans>
+<person user="hiram">
+  <firstName>Hiram</firstName>
+  <lastName>Chirino</lastName>
+  <city>Tampa</city>
+</person>
\ No newline at end of file
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/main/MyHelloBean.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/DummyBean.java
similarity index 79%
copy from components/camel-spring/src/test/java/org/apache/camel/spring/main/MyHelloBean.java
copy to components/camel-spring-main/src/test/java/org/apache/camel/spring/DummyBean.java
index c65405f..ae773a5 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/main/MyHelloBean.java
+++ b/components/camel-spring-main/src/test/java/org/apache/camel/spring/DummyBean.java
@@ -14,15 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.spring.main;
+package org.apache.camel.spring;
 
-import org.springframework.stereotype.Component;
+public class DummyBean {
 
-@Component
-public class MyHelloBean {
+    private String name;
 
-    @Override
-    public String toString() {
-        return "I am hello bean";
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
     }
 }
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/MainDummyTest.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MainDummyTest.java
similarity index 100%
rename from components/camel-spring/src/test/java/org/apache/camel/spring/MainDummyTest.java
rename to components/camel-spring-main/src/test/java/org/apache/camel/spring/MainDummyTest.java
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/MainExampleTest.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MainExampleTest.java
similarity index 97%
rename from components/camel-spring/src/test/java/org/apache/camel/spring/MainExampleTest.java
rename to components/camel-spring-main/src/test/java/org/apache/camel/spring/MainExampleTest.java
index b4bfeaa..7dfaa3b 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/MainExampleTest.java
+++ b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MainExampleTest.java
@@ -17,7 +17,6 @@
 package org.apache.camel.spring;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.spring.example.MyProcessor;
 import org.junit.Assert;
 import org.junit.Test;
 
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/main/MainIoCTest.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MainIoCTest.java
similarity index 95%
rename from components/camel-spring/src/test/java/org/apache/camel/spring/main/MainIoCTest.java
rename to components/camel-spring-main/src/test/java/org/apache/camel/spring/MainIoCTest.java
index d45e817..6524671 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/main/MainIoCTest.java
+++ b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MainIoCTest.java
@@ -14,11 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.spring.main;
+package org.apache.camel.spring;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spring.Main;
 import org.junit.Assert;
 import org.junit.Test;
 
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/MainTest.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MainTest.java
similarity index 97%
rename from components/camel-spring/src/test/java/org/apache/camel/spring/MainTest.java
rename to components/camel-spring-main/src/test/java/org/apache/camel/spring/MainTest.java
index 998cbc7..85b9d0b 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/MainTest.java
+++ b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MainTest.java
@@ -22,7 +22,6 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spring.example.MyProcessor;
 import org.junit.Assert;
 import org.junit.Test;
 import org.slf4j.Logger;
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/MainVetoTest.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MainVetoTest.java
similarity index 100%
rename from components/camel-spring/src/test/java/org/apache/camel/spring/MainVetoTest.java
rename to components/camel-spring-main/src/test/java/org/apache/camel/spring/MainVetoTest.java
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MisspelledRouteRefTest.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MisspelledRouteRefTest.java
similarity index 89%
rename from components/camel-spring/src/test/java/org/apache/camel/spring/issues/MisspelledRouteRefTest.java
rename to components/camel-spring-main/src/test/java/org/apache/camel/spring/MisspelledRouteRefTest.java
index a1bf338..a93cf32 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/issues/MisspelledRouteRefTest.java
+++ b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MisspelledRouteRefTest.java
@@ -14,15 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.spring.issues;
+package org.apache.camel.spring;
 
 import org.apache.camel.CamelException;
 import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.spring.Main;
 import org.junit.Assert;
 import org.junit.Test;
 
-import static org.apache.camel.TestSupport.assertIsInstanceOf;
+import static org.apache.camel.test.junit4.TestSupport.assertIsInstanceOf;
 
 public class MisspelledRouteRefTest extends Assert {
 
@@ -30,7 +29,7 @@ public class MisspelledRouteRefTest extends Assert {
     public void testApplicationContextFailed() throws Exception {
         try {
             Main main = new Main(); 
-            main.setApplicationContextUri("org/apache/camel/spring/issues/MisspelledRouteRefTest.xml");
+            main.setApplicationContextUri("org/apache/camel/spring/MisspelledRouteRefTest.xml");
             main.start();
             fail("Should have thrown an exception");
         } catch (RuntimeCamelException e) {
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/main/MyHelloBean.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MyHelloBean.java
similarity index 96%
copy from components/camel-spring/src/test/java/org/apache/camel/spring/main/MyHelloBean.java
copy to components/camel-spring-main/src/test/java/org/apache/camel/spring/MyHelloBean.java
index c65405f..6297c1f 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/main/MyHelloBean.java
+++ b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MyHelloBean.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.spring.main;
+package org.apache.camel.spring;
 
 import org.springframework.stereotype.Component;
 
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/main/MyMainIoCRouteBuilder.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MyMainIoCRouteBuilder.java
similarity index 96%
rename from components/camel-spring/src/test/java/org/apache/camel/spring/main/MyMainIoCRouteBuilder.java
rename to components/camel-spring-main/src/test/java/org/apache/camel/spring/MyMainIoCRouteBuilder.java
index 86ae193..41d49c2 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/main/MyMainIoCRouteBuilder.java
+++ b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MyMainIoCRouteBuilder.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.spring.main;
+package org.apache.camel.spring;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.springframework.beans.factory.annotation.Autowired;
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/MyVetoLifecycle.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MyProcessor.java
similarity index 57%
copy from components/camel-spring/src/test/java/org/apache/camel/spring/MyVetoLifecycle.java
copy to components/camel-spring-main/src/test/java/org/apache/camel/spring/MyProcessor.java
index e575804..294737c 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/MyVetoLifecycle.java
+++ b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MyProcessor.java
@@ -16,15 +16,31 @@
  */
 package org.apache.camel.spring;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.VetoCamelContextStartException;
-import org.apache.camel.support.LifecycleStrategySupport;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
 
-public class MyVetoLifecycle extends LifecycleStrategySupport {
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
 
-    @Override
-    public void onContextStart(CamelContext context) throws VetoCamelContextStartException {
-        throw new VetoCamelContextStartException("We do not like this route", context, false);
+public class MyProcessor implements Processor {
+    private List<Exchange> exchanges = new CopyOnWriteArrayList<>();
+    private String name = "James";
+
+    public List<Exchange> getExchanges() {
+        return exchanges;
+    }
+
+    public String getName() {
+        return name;
     }
 
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public void process(Exchange exchange) {
+        exchange.getIn().setHeader("name", getName());
+        exchanges.add(exchange);
+    }
 }
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/main/MyHelloBean.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MyRouteBuilder.java
similarity index 78%
rename from components/camel-spring/src/test/java/org/apache/camel/spring/main/MyHelloBean.java
rename to components/camel-spring-main/src/test/java/org/apache/camel/spring/MyRouteBuilder.java
index c65405f..25530b9 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/main/MyHelloBean.java
+++ b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MyRouteBuilder.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.spring.main;
+package org.apache.camel.spring;
 
-import org.springframework.stereotype.Component;
+import org.apache.camel.builder.RouteBuilder;
 
-@Component
-public class MyHelloBean {
+public class MyRouteBuilder extends RouteBuilder {
 
     @Override
-    public String toString() {
-        return "I am hello bean";
+    public void configure() throws Exception {
+        from("direct:start").to("mock:result");
     }
+
 }
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/MyVetoLifecycle.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/MyVetoLifecycle.java
similarity index 100%
rename from components/camel-spring/src/test/java/org/apache/camel/spring/MyVetoLifecycle.java
rename to components/camel-spring-main/src/test/java/org/apache/camel/spring/MyVetoLifecycle.java
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.java b/components/camel-spring-main/src/test/java/org/apache/camel/spring/SpringMainStartFailedIssueTest.java
similarity index 85%
rename from components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.java
rename to components/camel-spring-main/src/test/java/org/apache/camel/spring/SpringMainStartFailedIssueTest.java
index be081ea..67f70f7 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.java
+++ b/components/camel-spring-main/src/test/java/org/apache/camel/spring/SpringMainStartFailedIssueTest.java
@@ -14,20 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.spring.issues;
+package org.apache.camel.spring;
 
 import org.apache.camel.FailedToCreateRouteException;
-import org.apache.camel.TestSupport;
-import org.apache.camel.spring.Main;
+import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-public class SpringMainStartFailedIssueTest extends TestSupport {
+public class SpringMainStartFailedIssueTest extends CamelTestSupport {
 
     @Test
     public void testStartupFailed() throws Exception {
         Main main = new Main();
 
-        String[] args = new String[]{"-ac", "org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml"};
+        String[] args = new String[]{"-ac", "org/apache/camel/spring/SpringMainStartFailedIssueTest.xml"};
         try {
             main.run(args);
             fail("Should have thrown an exception");
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/MainVetoTest.xml b/components/camel-spring-main/src/test/resources/META-INF/spring/camel-context.xml
similarity index 60%
copy from components/camel-spring/src/test/resources/org/apache/camel/spring/MainVetoTest.xml
copy to components/camel-spring-main/src/test/resources/META-INF/spring/camel-context.xml
index 310d0d1..926a842 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/MainVetoTest.xml
+++ b/components/camel-spring-main/src/test/resources/META-INF/spring/camel-context.xml
@@ -17,19 +17,49 @@
     limitations under the License.
 
 -->
+<!--
+
+  The default Application Context used by the org.apache.camel.spring.Main if there
+  is no /META-INF/sprint.xml
+
+ -->
+
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-    ">
-
-  <bean id="lifecycleStrategy" class="org.apache.camel.spring.MyVetoLifecycle"/>
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
   <camelContext xmlns="http://camel.apache.org/schema/spring">
     <route>
-      <from uri="direct:start"/>
-      <to uri="mock:result"/>
+      <from uri="direct:a.start"/>
+      <choice>
+        <when>
+          <xpath>$foo = 'bar'</xpath>
+          <to uri="mock:x"/>
+        </when>
+        <when>
+          <xpath>$foo = 'cheese'</xpath>
+          <to uri="mock:y"/>
+        </when>
+        <otherwise>
+          <to uri="mock:z"/>
+        </otherwise>
+      </choice>
+    </route>
+    <route>
+      <from uri="direct:b.start"/>
+      <filter>
+        <xpath>/person[@name='James']</xpath>
+        <to uri="mock:b.end"/>
+      </filter>
+    </route>
+    <route>
+      <from uri="direct:c.start"/>
+      <resequence>
+        <simple>${body}</simple>
+        <to uri="mock:c.end"/>
+      </resequence>
     </route>
   </camelContext>
 
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml b/components/camel-spring-main/src/test/resources/META-INF/spring/dummy.xml
similarity index 75%
copy from components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml
copy to components/camel-spring-main/src/test/resources/META-INF/spring/dummy.xml
index 0d4dd0e..d0160cd 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml
+++ b/components/camel-spring-main/src/test/resources/META-INF/spring/dummy.xml
@@ -20,16 +20,10 @@
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
-    ">
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-    <camelContext xmlns="http://camel.apache.org/schema/spring">
-        <route>
-            <from uri="xxx:unknown"/>
-            <to uri="mock:foo"/>
-        </route>
-
-    </camelContext>
+  <bean id="dummy" class="org.apache.camel.spring.DummyBean">
+    <property name="name" value="John Doe"/>
+  </bean>
 
 </beans>
diff --git a/components/camel-spring-main/src/test/resources/log4j2.properties b/components/camel-spring-main/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..a99fcf0
--- /dev/null
+++ b/components/camel-spring-main/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-spring-main-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d %-5p %c{1} - %m %n
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/MainVetoTest.xml b/components/camel-spring-main/src/test/resources/org/apache/camel/spring/MainVetoTest.xml
similarity index 100%
copy from components/camel-spring/src/test/resources/org/apache/camel/spring/MainVetoTest.xml
copy to components/camel-spring-main/src/test/resources/org/apache/camel/spring/MainVetoTest.xml
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/MisspelledRouteRefTest.xml b/components/camel-spring-main/src/test/resources/org/apache/camel/spring/MisspelledRouteRefTest.xml
similarity index 94%
rename from components/camel-spring/src/test/resources/org/apache/camel/spring/issues/MisspelledRouteRefTest.xml
rename to components/camel-spring-main/src/test/resources/org/apache/camel/spring/MisspelledRouteRefTest.xml
index 25967c9..eddb0be 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/MisspelledRouteRefTest.xml
+++ b/components/camel-spring-main/src/test/resources/org/apache/camel/spring/MisspelledRouteRefTest.xml
@@ -28,6 +28,6 @@
         <routeBuilder ref="xxxroute"/>
     </camelContext>
 
-    <bean id="route" class="org.apache.camel.spring.issues.MyRouteBuilder"/>
+    <bean id="route" class="org.apache.camel.spring.MyRouteBuilder"/>
 
 </beans>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml b/components/camel-spring-main/src/test/resources/org/apache/camel/spring/SpringMainStartFailedIssueTest.xml
similarity index 100%
rename from components/camel-spring/src/test/resources/org/apache/camel/spring/issues/SpringMainStartFailedIssueTest.xml
rename to components/camel-spring-main/src/test/resources/org/apache/camel/spring/SpringMainStartFailedIssueTest.xml
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/MainVetoTest.xml b/components/camel-spring-main/src/test/resources/org/apache/camel/spring/routingUsingProcessor.xml
similarity index 88%
rename from components/camel-spring/src/test/resources/org/apache/camel/spring/MainVetoTest.xml
rename to components/camel-spring-main/src/test/resources/org/apache/camel/spring/routingUsingProcessor.xml
index 310d0d1..4ca1a19 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/MainVetoTest.xml
+++ b/components/camel-spring-main/src/test/resources/org/apache/camel/spring/routingUsingProcessor.xml
@@ -24,13 +24,15 @@
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
 
-  <bean id="lifecycleStrategy" class="org.apache.camel.spring.MyVetoLifecycle"/>
-
+  <!-- START SNIPPET: example -->
   <camelContext xmlns="http://camel.apache.org/schema/spring">
     <route>
       <from uri="direct:start"/>
-      <to uri="mock:result"/>
+      <process ref="myProcessor"/>
     </route>
   </camelContext>
 
+  <bean id="myProcessor" class="org.apache.camel.spring.MyProcessor"/>
+  <!-- END SNIPPET: example -->
+
 </beans>
diff --git a/components/pom.xml b/components/pom.xml
index 96d6f3d..b61b480 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -71,6 +71,7 @@
         <module>camel-testcontainers-spring-junit5</module>
         <module>camel-blueprint</module>
         <module>camel-spring</module>
+        <module>camel-spring-main</module>
         <module>camel-groovy</module>
         <module>camel-attachments</module>
         <module>camel-http-base</module>


[camel] 02/02: CAMEL-14779: Move Main out of camel-spring due to osgi circular dependency issue

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 58300b87b1694f829b95db03712b8ab9ee4e4f73
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 24 15:11:33 2020 +0100

    CAMEL-14779: Move Main out of camel-spring due to osgi circular dependency issue
---
 apache-camel/src/main/descriptors/common-bin.xml | 1 +
 parent/pom.xml                                   | 5 +++++
 tooling/maven/camel-maven-plugin/pom.xml         | 3 ++-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index fa8cf91a..1c3aaba0 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -336,6 +336,7 @@
         <include>org.apache.camel:camel-spring-integration</include>
         <include>org.apache.camel:camel-spring-javaconfig</include>
         <include>org.apache.camel:camel-spring-ldap</include>
+        <include>org.apache.camel:camel-spring-main</include>
         <include>org.apache.camel:camel-spring-redis</include>
         <include>org.apache.camel:camel-spring-security</include>
         <include>org.apache.camel:camel-spring-ws</include>
diff --git a/parent/pom.xml b/parent/pom.xml
index 872b410..dafb2e4 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -2332,6 +2332,11 @@
       </dependency>
       <dependency>
         <groupId>org.apache.camel</groupId>
+        <artifactId>camel-spring-main</artifactId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel</groupId>
         <artifactId>camel-spring-batch</artifactId>
         <version>${project.version}</version>
       </dependency>
diff --git a/tooling/maven/camel-maven-plugin/pom.xml b/tooling/maven/camel-maven-plugin/pom.xml
index 7e8f78a..dac5ab7 100644
--- a/tooling/maven/camel-maven-plugin/pom.xml
+++ b/tooling/maven/camel-maven-plugin/pom.xml
@@ -77,9 +77,10 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-core</artifactId>
         </dependency>
+        <!-- camel-spring-main has Main class for running Spring -->
         <dependency>
             <groupId>org.apache.camel</groupId>
-            <artifactId>camel-spring</artifactId>
+            <artifactId>camel-spring-main</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>