CAMEL-10222: Tests passing
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/771c2399 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/771c2399 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/771c2399 Branch: refs/heads/master Commit: 771c23995b6535626f3a1576f188b660398b4f30 Parents: ad79eae Author: Nicola Ferraro <ni.ferr...@gmail.com> Authored: Thu Aug 11 18:57:16 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon Aug 15 09:27:23 2016 +0200 ---------------------------------------------------------------------- components-starter/camel-bam-starter/pom.xml | 8 ++ .../camel-cassandraql-starter/pom.xml | 4 + .../camel-core-xml-starter/pom.xml | 4 + components-starter/camel-jetty-starter/pom.xml | 4 + .../camel-netty4-http-starter/pom.xml | 5 + tests/camel-itest-spring-boot/pom.xml | 11 +- .../itest/springboot/ITestConfigBuilder.java | 2 +- .../camel/itest/springboot/CamelAhcWsTest.java | 4 +- .../camel/itest/springboot/CamelBamTest.java | 3 + .../itest/springboot/CamelCassandraqlTest.java | 2 +- .../itest/springboot/CamelChronicleTest.java | 48 ++++++++ .../itest/springboot/CamelCoreOsgiTest.java | 48 -------- .../camel/itest/springboot/CamelHbaseTest.java | 2 +- .../camel/itest/springboot/CamelHl7Test.java | 2 +- .../itest/springboot/CamelJcloudsTest.java | 4 +- .../camel/itest/springboot/CamelJcrTest.java | 2 +- .../camel/itest/springboot/CamelJetty9Test.java | 2 +- .../itest/springboot/CamelJohnzonTest.java | 48 ++++++++ .../itest/springboot/CamelKubernetesTest.java | 2 +- .../itest/springboot/CamelNetty4HttpTest.java | 2 +- .../camel/itest/springboot/CamelNettyTest.java | 2 +- .../itest/springboot/CamelRestletTest.java | 2 +- .../camel/itest/springboot/CamelRibbonTest.java | 48 ++++++++ .../itest/springboot/CamelSparkRestTest.java | 2 +- .../springboot/CamelSpringBootStarterTest.java | 48 -------- .../itest/springboot/CamelSpringDmTest.java | 1 + .../itest/springboot/CamelSpringRedisTest.java | 2 +- .../itest/springboot/CamelSpringWsTest.java | 4 +- .../itest/springboot/CamelSwaggerJavaTest.java | 2 +- .../itest/springboot/CamelUndertowTest.java | 2 +- .../itest/springboot/CamelXmljsonTest.java | 2 +- .../springboot/CamelZipkinStarterTest.java | 49 -------- .../springboot/util/ArquillianPackager.java | 86 +++++++++----- .../springboot/util/DependencyResolver.java | 4 + .../util/LibraryVersionMismatchTest.java | 113 +++++++++++++++++++ .../src/test/resources/application-pom.xml | 69 +++++++++++ .../maven/packaging/SpringBootStarterMojo.java | 49 ++++++-- ...ring-boot-additional-dependencies.properties | 14 --- .../spring-boot-fix-dependencies.properties | 24 ++++ 39 files changed, 511 insertions(+), 219 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/components-starter/camel-bam-starter/pom.xml ---------------------------------------------------------------------- diff --git a/components-starter/camel-bam-starter/pom.xml b/components-starter/camel-bam-starter/pom.xml index 6d7df9f..0f595c5 100644 --- a/components-starter/camel-bam-starter/pom.xml +++ b/components-starter/camel-bam-starter/pom.xml @@ -45,8 +45,16 @@ <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> + <exclusion> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-jpa_2.0_spec</artifactId> + </exclusion> </exclusions> </dependency> + <dependency> + <groupId>com.github.ben-manes.caffeine</groupId> + <artifactId>caffeine</artifactId> + </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/components-starter/camel-cassandraql-starter/pom.xml ---------------------------------------------------------------------- diff --git a/components-starter/camel-cassandraql-starter/pom.xml b/components-starter/camel-cassandraql-starter/pom.xml index b943a6a..f4351c6 100644 --- a/components-starter/camel-cassandraql-starter/pom.xml +++ b/components-starter/camel-cassandraql-starter/pom.xml @@ -41,6 +41,10 @@ <groupId>org.apache.camel</groupId> <artifactId>camel-cassandraql</artifactId> </dependency> + <dependency> + <groupId>com.github.ben-manes.caffeine</groupId> + <artifactId>caffeine</artifactId> + </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/components-starter/camel-core-xml-starter/pom.xml ---------------------------------------------------------------------- diff --git a/components-starter/camel-core-xml-starter/pom.xml b/components-starter/camel-core-xml-starter/pom.xml index 3fd7708..312d9b3 100644 --- a/components-starter/camel-core-xml-starter/pom.xml +++ b/components-starter/camel-core-xml-starter/pom.xml @@ -41,6 +41,10 @@ <groupId>org.apache.camel</groupId> <artifactId>camel-core-xml</artifactId> </dependency> + <dependency> + <groupId>com.github.ben-manes.caffeine</groupId> + <artifactId>caffeine</artifactId> + </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/components-starter/camel-jetty-starter/pom.xml ---------------------------------------------------------------------- diff --git a/components-starter/camel-jetty-starter/pom.xml b/components-starter/camel-jetty-starter/pom.xml index eda7484..d9a8dfd 100644 --- a/components-starter/camel-jetty-starter/pom.xml +++ b/components-starter/camel-jetty-starter/pom.xml @@ -41,6 +41,10 @@ <groupId>org.apache.camel</groupId> <artifactId>camel-jetty</artifactId> </dependency> + <dependency> + <groupId>com.github.ben-manes.caffeine</groupId> + <artifactId>caffeine</artifactId> + </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/components-starter/camel-netty4-http-starter/pom.xml ---------------------------------------------------------------------- diff --git a/components-starter/camel-netty4-http-starter/pom.xml b/components-starter/camel-netty4-http-starter/pom.xml index 23b0fe6..d5513a7 100644 --- a/components-starter/camel-netty4-http-starter/pom.xml +++ b/components-starter/camel-netty4-http-starter/pom.xml @@ -41,6 +41,11 @@ <groupId>org.apache.camel</groupId> <artifactId>camel-netty4-http</artifactId> </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-validator</artifactId> + <version>${hibernate-validator-version}</version> + </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/pom.xml ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/pom.xml b/tests/camel-itest-spring-boot/pom.xml index 09b65ff..19622bb 100644 --- a/tests/camel-itest-spring-boot/pom.xml +++ b/tests/camel-itest-spring-boot/pom.xml @@ -185,8 +185,17 @@ <value>false</value> </property> + <!-- Test dependencies required by modules --> + <property> + <name>version_bam_org.hibernate:hibernate-entitymanager</name> + <value>5.0.9.Final</value> + </property> + <property> + <name>version_org.apache.geronimo.specs:geronimo-jta_1.1_spec</name> + <value>${geronimo-jta-spec-version}</value> + </property> - <!-- Additional dependencies required by modules --> + <!-- Other dependencies needed before starters --> <property> <name>version_org.apache.camel:camel-core</name> <value>${project.version}</value> http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfigBuilder.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfigBuilder.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfigBuilder.java index 5f6caa9..cfbab09 100644 --- a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfigBuilder.java +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfigBuilder.java @@ -177,7 +177,7 @@ public class ITestConfigBuilder { } if (config.getIncludeProvidedDependencies() == null) { - config.setIncludeProvidedDependencies(booleanPropertyOr("includeProvidedDependencies", true)); + config.setIncludeProvidedDependencies(booleanPropertyOr("includeProvidedDependencies", false)); } if (config.getModulesPath() == null) { http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcWsTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcWsTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcWsTest.java index ef267ae..3c521bc 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcWsTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelAhcWsTest.java @@ -37,8 +37,8 @@ public class CamelAhcWsTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelAhcWsTest.class)) - .dependency(DependencyResolver.withVersion("org.glassfish.grizzly:grizzly-websockets")) - .dependency(DependencyResolver.withVersion("org.glassfish.grizzly:connection-pool")) + //.dependency(DependencyResolver.withVersion("org.glassfish.grizzly:grizzly-websockets")) + //.dependency(DependencyResolver.withVersion("org.glassfish.grizzly:connection-pool")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBamTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBamTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBamTest.java index a4a6067..7a31765 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBamTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBamTest.java @@ -17,6 +17,7 @@ package org.apache.camel.itest.springboot; import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.apache.camel.itest.springboot.util.DependencyResolver; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; @@ -37,6 +38,8 @@ public class CamelBamTest extends AbstractSpringBootTestSupport { .module(inferModuleName(CamelBamTest.class)) .resource("components/bam-persistence.xml", "META-INF/persistence.xml") .resource("components/bam-spring.xml", "META-INF/spring/spring.xml") + .dependency(DependencyResolver.withVersion("version_bam_", "org.hibernate:hibernate-entitymanager")) + .dependency(DependencyResolver.withVersion("org.apache.geronimo.specs:geronimo-jta_1.1_spec")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCassandraqlTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCassandraqlTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCassandraqlTest.java index 2b0c00e..0cde434 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCassandraqlTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCassandraqlTest.java @@ -36,7 +36,7 @@ public class CamelCassandraqlTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelCassandraqlTest.class)) - .dependency(DependencyResolver.withVersion("io.netty:netty-all")) + //.dependency(DependencyResolver.withVersion("io.netty:netty-all")) // .dependency(DependencyResolver.withVersion("io.dropwizard.metrics:metrics-core")) // .exclusion("com.codahale.metrics:*") .unitTestExclusionPattern(".*(\\.integration\\..*|IntegrationTest$|CassandraComponentProducerTest$|CassandraComponentBeanRefTest$|CassandraComponentConsumerTest$)") http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelChronicleTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelChronicleTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelChronicleTest.java new file mode 100644 index 0000000..e53a368 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelChronicleTest.java @@ -0,0 +1,48 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelChronicleTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelChronicleTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + this.runComponentTest(config, "chronicle-engine"); + this.runModuleUnitTestsIfEnabled(config); + } + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCoreOsgiTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCoreOsgiTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCoreOsgiTest.java deleted file mode 100644 index 53daca3..0000000 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCoreOsgiTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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.itest.springboot; - -import org.apache.camel.itest.springboot.util.ArquillianPackager; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.shrinkwrap.api.Archive; -import org.junit.Test; -import org.junit.runner.RunWith; - - -@RunWith(Arquillian.class) -public class CamelCoreOsgiTest extends AbstractSpringBootTestSupport { - - @Deployment - public static Archive<?> createSpringBootPackage() throws Exception { - return ArquillianPackager.springBootPackage(createTestConfig()); - } - - public static ITestConfig createTestConfig() { - return new ITestConfigBuilder() - .module(inferModuleName(CamelCoreOsgiTest.class)) - .build(); - } - - @Test - public void componentTests() throws Exception { - // no component test - this.runModuleUnitTestsIfEnabled(config); - } - - -} http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelHbaseTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelHbaseTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelHbaseTest.java index 5fe72c3..2060a3c 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelHbaseTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelHbaseTest.java @@ -36,7 +36,7 @@ public class CamelHbaseTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelHbaseTest.class)) - .dependency(DependencyResolver.withVersion("org.apache.hadoop:hadoop-hdfs")) + //.dependency(DependencyResolver.withVersion("org.apache.hadoop:hadoop-hdfs")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelHl7Test.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelHl7Test.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelHl7Test.java index f0b7b4e..6ceab93 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelHl7Test.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelHl7Test.java @@ -36,7 +36,7 @@ public class CamelHl7Test extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelHl7Test.class)) - .dependency(DependencyResolver.withVersion("org.apache.camel:camel-netty4")) + //.dependency(DependencyResolver.withVersion("org.apache.camel:camel-netty4")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJcloudsTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJcloudsTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJcloudsTest.java index be5c852..da82c81 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJcloudsTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJcloudsTest.java @@ -36,8 +36,8 @@ public class CamelJcloudsTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelJcloudsTest.class)) - .dependency(DependencyResolver.withVersion("com.google.inject:guice")) - .dependency(DependencyResolver.withVersion("com.google.guava:guava")) + //.dependency(DependencyResolver.withVersion("com.google.inject:guice")) + //.dependency(DependencyResolver.withVersion("com.google.guava:guava")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJcrTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJcrTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJcrTest.java index bcd3601..4193a10 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJcrTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJcrTest.java @@ -36,7 +36,7 @@ public class CamelJcrTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelJcrTest.class)) - .dependency(DependencyResolver.withVersion("org.apache.lucene:lucene-core")) + //.dependency(DependencyResolver.withVersion("org.apache.lucene:lucene-core")) // fails but the tests actually pass .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJetty9Test.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJetty9Test.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJetty9Test.java index 0c70bd8..15e64a3 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJetty9Test.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJetty9Test.java @@ -36,7 +36,7 @@ public class CamelJetty9Test extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelJetty9Test.class)) - .dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) + //.dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJohnzonTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJohnzonTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJohnzonTest.java new file mode 100644 index 0000000..9378ea6 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJohnzonTest.java @@ -0,0 +1,48 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelJohnzonTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelJohnzonTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + this.runDataformatTest(config, "json-johnzon"); + this.runModuleUnitTestsIfEnabled(config); + } + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelKubernetesTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelKubernetesTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelKubernetesTest.java index c59581d..513fdca 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelKubernetesTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelKubernetesTest.java @@ -36,7 +36,7 @@ public class CamelKubernetesTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelKubernetesTest.class)) - .dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) + //.dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelNetty4HttpTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelNetty4HttpTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelNetty4HttpTest.java index 92e6a74..bad15b5 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelNetty4HttpTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelNetty4HttpTest.java @@ -36,7 +36,7 @@ public class CamelNetty4HttpTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelNetty4HttpTest.class)) - .dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) + //.dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) .unitTestExclusionPattern(".*(\\.integration\\..*|IntegrationTest$|BaseNettyTest$|ManagedNettyEndpointTest$|NettyMixedCaseHttpPathTest$|NettyHttpContentTypeTest$)") // removed JMX check tests and tests that nof fail singularly .build(); http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelNettyTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelNettyTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelNettyTest.java index fd7d51b..8068b21 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelNettyTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelNettyTest.java @@ -36,7 +36,7 @@ public class CamelNettyTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelNettyTest.class)) - .dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) + //.dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) .unitTestExclusionPattern(".*(\\.integration\\..*|IntegrationTest$|BaseNettyTest$)") .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelRestletTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelRestletTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelRestletTest.java index 46846d1..cb21b04 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelRestletTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelRestletTest.java @@ -36,7 +36,7 @@ public class CamelRestletTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelRestletTest.class)) - .dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) + //.dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelRibbonTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelRibbonTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelRibbonTest.java new file mode 100644 index 0000000..bb39c17 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelRibbonTest.java @@ -0,0 +1,48 @@ +/** + * 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.itest.springboot; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.junit.Test; +import org.junit.runner.RunWith; + + +@RunWith(Arquillian.class) +public class CamelRibbonTest extends AbstractSpringBootTestSupport { + + @Deployment + public static Archive<?> createSpringBootPackage() throws Exception { + return ArquillianPackager.springBootPackage(createTestConfig()); + } + + public static ITestConfig createTestConfig() { + return new ITestConfigBuilder() + .module(inferModuleName(CamelRibbonTest.class)) + .build(); + } + + @Test + public void componentTests() throws Exception { + // no components + this.runModuleUnitTestsIfEnabled(config); + } + + +} http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSparkRestTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSparkRestTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSparkRestTest.java index 8d2baba..02cda23 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSparkRestTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSparkRestTest.java @@ -36,7 +36,7 @@ public class CamelSparkRestTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelSparkRestTest.class)) - .dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) + //.dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringBootStarterTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringBootStarterTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringBootStarterTest.java deleted file mode 100644 index f58e16a..0000000 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringBootStarterTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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.itest.springboot; - -import org.apache.camel.itest.springboot.util.ArquillianPackager; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.shrinkwrap.api.Archive; -import org.junit.Test; -import org.junit.runner.RunWith; - - -@RunWith(Arquillian.class) -public class CamelSpringBootStarterTest extends AbstractSpringBootTestSupport { - - @Deployment - public static Archive<?> createSpringBootPackage() throws Exception { - return ArquillianPackager.springBootPackage(createTestConfig()); - } - - public static ITestConfig createTestConfig() { - return new ITestConfigBuilder() - .module(inferModuleName(CamelSpringBootStarterTest.class)) - .build(); - } - - @Test - public void componentTests() throws Exception { - // no component test - this.runModuleUnitTestsIfEnabled(config); - } - - -} http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringDmTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringDmTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringDmTest.java index 9e1e311..af305e8 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringDmTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringDmTest.java @@ -35,6 +35,7 @@ public class CamelSpringDmTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelSpringDmTest.class)) + .unitTestExpectedNumber(0) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringRedisTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringRedisTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringRedisTest.java index 6ea8a98..35916ce 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringRedisTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringRedisTest.java @@ -36,7 +36,7 @@ public class CamelSpringRedisTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelSpringRedisTest.class)) - .dependency(DependencyResolver.withVersion("org.springframework.data:spring-data-redis")) + //.dependency(DependencyResolver.withVersion("org.springframework.data:spring-data-redis")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringWsTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringWsTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringWsTest.java index dcfd97e..82188dc 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringWsTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSpringWsTest.java @@ -36,8 +36,8 @@ public class CamelSpringWsTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelSpringWsTest.class)) - .dependency(DependencyResolver.withVersion("org.springframework.boot:spring-boot-starter-web")) - .dependency(DependencyResolver.withVersion("org.springframework:spring-webmvc")) + //.dependency(DependencyResolver.withVersion("org.springframework.boot:spring-boot-starter-web")) + //.dependency(DependencyResolver.withVersion("org.springframework:spring-webmvc")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSwaggerJavaTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSwaggerJavaTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSwaggerJavaTest.java index ef8a043..817ce03 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSwaggerJavaTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelSwaggerJavaTest.java @@ -36,7 +36,7 @@ public class CamelSwaggerJavaTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelSwaggerJavaTest.class)) - .dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) + //.dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelUndertowTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelUndertowTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelUndertowTest.java index a7d9e62..41c61b2 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelUndertowTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelUndertowTest.java @@ -36,7 +36,7 @@ public class CamelUndertowTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelUndertowTest.class)) - .dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) + //.dependency(DependencyResolver.withVersion("org.hibernate:hibernate-validator")) .unitTestExclusionPattern(".*(\\.integration\\..*|IntegrationTest$|BaseUndertowTest$|UndertowHttpsSpringTest$)") .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelXmljsonTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelXmljsonTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelXmljsonTest.java index ea7a3e4..2c805c2 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelXmljsonTest.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelXmljsonTest.java @@ -36,7 +36,7 @@ public class CamelXmljsonTest extends AbstractSpringBootTestSupport { public static ITestConfig createTestConfig() { return new ITestConfigBuilder() .module(inferModuleName(CamelXmljsonTest.class)) - .dependency(DependencyResolver.withVersion("xom:xom")) + //.dependency(DependencyResolver.withVersion("xom:xom")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelZipkinStarterTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelZipkinStarterTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelZipkinStarterTest.java deleted file mode 100644 index 5a73d25..0000000 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelZipkinStarterTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * 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.itest.springboot; - -import org.apache.camel.itest.springboot.util.ArquillianPackager; -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.shrinkwrap.api.Archive; -import org.junit.Test; -import org.junit.runner.RunWith; - - -@RunWith(Arquillian.class) -public class CamelZipkinStarterTest extends AbstractSpringBootTestSupport { - - @Deployment - public static Archive<?> createSpringBootPackage() throws Exception { - return ArquillianPackager.springBootPackage(createTestConfig()); - } - - public static ITestConfig createTestConfig() { - return new ITestConfigBuilder() - .module(inferModuleName(CamelZipkinStarterTest.class)) - .unitTestExpectedNumber(0) - .build(); - } - - @Test - public void componentTests() throws Exception { - // no component test - this.runModuleUnitTestsIfEnabled(config); - } - - -} http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/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 9313c28..f3623c6 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 @@ -17,8 +17,10 @@ package org.apache.camel.itest.springboot.util; import java.io.File; +import java.io.FileWriter; import java.io.FilenameFilter; import java.io.IOException; +import java.io.InputStream; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Arrays; @@ -30,12 +32,15 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TreeMap; +import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.camel.itest.springboot.ITestConfig; import org.apache.camel.itest.springboot.ITestConfigBuilder; import org.apache.camel.itest.springboot.arquillian.SpringBootZipExporterImpl; import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; import org.jboss.arquillian.container.se.api.ClassPath; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ArchivePath; @@ -148,9 +153,11 @@ public final class ArquillianPackager { // Module dependencies List<MavenDependency> moduleDependencies = new LinkedList<>(); - MavenCoordinate mainJar = MavenCoordinates.createCoordinate(config.getMavenGroup(), config.getModuleName(), version, PackagingType.JAR, null); - MavenDependency mainDep = MavenDependencies.createDependency(mainJar, ScopeType.COMPILE, false, commonExclutionArray); - moduleDependencies.add(mainDep); +// String mainArtifactId = config.getModuleName() + "-starter"; +// MavenCoordinate mainJar = MavenCoordinates.createCoordinate(config.getMavenGroup(), mainArtifactId, version, PackagingType.JAR, null); +// // Add exclusions only when not using the starters +// MavenDependency mainDep = MavenDependencies.createDependency(mainJar, ScopeType.COMPILE, false); +// moduleDependencies.add(mainDep); for (String canonicalForm : config.getAdditionalDependencies()) { MavenCoordinate coord = MavenCoordinates.createCoordinate(canonicalForm); @@ -168,10 +175,21 @@ public final class ArquillianPackager { scopes.add(ScopeType.PROVIDED); } - List<MavenResolvedArtifact> moduleArtifacts = Arrays.asList(resolver(config) - .loadPomFromFile(config.getModuleBasePath() + "/pom.xml") - .importDependencies(scopes.toArray(new ScopeType[]{})) - .resolve().withoutTransitivity().asResolvedArtifact()); + boolean failIfNoDependencies = false; + List<MavenResolvedArtifact> moduleArtifacts; + try { + moduleArtifacts = Arrays.asList(resolver(config) + .loadPomFromFile(config.getModuleBasePath() + "/pom.xml") + .importDependencies(scopes.toArray(new ScopeType[]{})) + .resolve().withoutTransitivity().asResolvedArtifact()); + } catch(IllegalArgumentException e) { + if(failIfNoDependencies) { + throw e; + } + + debug("Error while getting dependencies for scopes: " + scopes + ". Message=" + e.getMessage()); + moduleArtifacts = new LinkedList<>(); + } for (MavenResolvedArtifact art : moduleArtifacts) { @@ -199,9 +217,11 @@ public final class ArquillianPackager { } } + File moduleSpringBootPom = createUserPom(config); + List<File> dependencies = new LinkedList<>(); dependencies.addAll(Arrays.asList(resolver(config) - .loadPomFromFile("pom.xml") + .loadPomFromFile(moduleSpringBootPom) .importRuntimeDependencies() .addDependencies(moduleDependencies) .resolve() @@ -209,26 +229,8 @@ public final class ArquillianPackager { .asFile())); - boolean needsSpringTest = excludeDependencyRegex(dependencies, "^camel-test-spring3-.*"); - if (needsSpringTest) { - // Adding spring4 version of the test library - MavenDependency dep = MavenDependencies.createDependency("org.apache.camel:camel-test-spring:" + version, ScopeType.RUNTIME, false); - - dependencies = new LinkedList<>(); - dependencies.addAll(Arrays.asList(resolver(config) - .loadPomFromFile("pom.xml") - .importRuntimeDependencies() - .addDependencies(moduleDependencies) - .addDependencies(dep) - .resolve() - .withTransitivity() - .asFile())); - } - // The spring boot-loader dependency will be added to the main jar, so it should be excluded from the embedded ones excludeDependencyRegex(dependencies, "^spring-boot-loader-[0-9].*"); - excludeDependencyRegex(dependencies, "^camel-test-spring3-.*"); - // Add all dependencies as spring-boot nested jars ark = addDependencies(ark, dependencies); @@ -274,6 +276,36 @@ public final class ArquillianPackager { return external.build(); } + private static File createUserPom(ITestConfig config) throws Exception { + + String pom; + try (InputStream pomTemplate = ArquillianPackager.class.getResourceAsStream("/application-pom.xml")) { + pom = IOUtils.toString(pomTemplate); + } + + Map<String, String> resolvedProperties = new TreeMap<>(); + Pattern propPattern = Pattern.compile("(\\$\\{[^}]*\\})"); + Matcher m = propPattern.matcher(pom); + while (m.find()) { + String property = m.group(); + String resolved = DependencyResolver.resolveParentProperty(property); + resolvedProperties.put(property, resolved); + } + + for (String property : resolvedProperties.keySet()) { + pom = pom.replace(property, resolvedProperties.get(property)); + } + + pom = pom.replace("#{module}", config.getModuleName()); + + File pomFile = new File(config.getModuleBasePath() + "/target/itest-spring-boot-pom.xml"); + try (FileWriter fw = new FileWriter(pomFile)) { + IOUtils.write(pom, fw); + } + + return pomFile; + } + private static ConfigurableMavenResolverSystem resolver(ITestConfig config) { return Maven.configureResolver().workOffline(config.getMavenOfflineResolution()); } @@ -344,7 +376,7 @@ public final class ArquillianPackager { private static boolean excludeDependencyRegex(List<File> dependencies, String regex) { Pattern pattern = Pattern.compile(regex); int count = 0; - for (Iterator<File> it = dependencies.iterator(); it.hasNext();) { + for (Iterator<File> it = dependencies.iterator(); it.hasNext(); ) { File f = it.next(); if (pattern.matcher(f.getName()).matches()) { it.remove(); http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/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 3b9cda8..a5bf635 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 @@ -133,6 +133,10 @@ public final class DependencyResolver { return groupArtifact + ":" + version; } + public static String resolveParentProperty(String property) throws Exception { + return resolveProperty("../../parent/pom.xml", property, 0); + } + private static String resolveSurefireProperty(String property) throws Exception { property = getSurefirePropertyFromPom("pom.xml", property); if (property != null && !isResolved(property)) { http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/LibraryVersionMismatchTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/LibraryVersionMismatchTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/LibraryVersionMismatchTest.java new file mode 100644 index 0000000..212d5d9 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/LibraryVersionMismatchTest.java @@ -0,0 +1,113 @@ +package org.apache.camel.itest.springboot.util; + +import java.io.File; +import java.io.FileWriter; +import java.io.InputStream; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +import org.apache.camel.itest.springboot.util.ArquillianPackager; +import org.apache.camel.itest.springboot.util.DependencyResolver; +import org.apache.commons.io.IOUtils; +import org.jboss.shrinkwrap.resolver.api.maven.Maven; +import org.jboss.shrinkwrap.resolver.api.maven.MavenResolvedArtifact; +import org.jboss.shrinkwrap.resolver.api.maven.MavenResolverSystem; +import org.junit.Assert; +import org.junit.Test; + +/** + * Prints information about the libraries required by the module and what it gets at runtime in a spring-boot deployment. + */ +public class LibraryVersionMismatchTest { + + @Test + public void testAllComponents() throws Exception { + + List<String> components = Arrays.asList(new File("../../components-starter") + .list((d, f) -> f.startsWith("camel-") && (new File(d, f).isDirectory()))) + .stream() + .map(name -> name.replace("-starter", "")) + .sorted().collect(Collectors.toList()); + + boolean fail = false; + for(String moduleName : components) { + System.out.println("------------- " + moduleName + " -------------"); + boolean compFail = testLibrary(moduleName); + fail = fail || compFail; + } + + //Assert.assertFalse("Dependencies changed between original and user version", fail); + } + + + public boolean testLibrary(String moduleName) throws Exception { + + MavenResolverSystem resolver = Maven.resolver(); + + MavenResolvedArtifact[] original = resolver.resolve("org.apache.camel:" + moduleName + ":2.18-SNAPSHOT").withTransitivity().asResolvedArtifact(); + Map<String, String> originalMap = versionMap(original); + + File userPom = createUserPom(moduleName); + + MavenResolvedArtifact[] user = resolver.loadPomFromFile(userPom).importRuntimeDependencies().resolve().withTransitivity().asResolvedArtifact(); + Map<String, String> userMap = versionMap(user); + + boolean changed = false; + for (String dep : originalMap.keySet()) { + String originalVersion = originalMap.get(dep); + String userVersion = userMap.get(dep); + + if (userVersion == null) { + System.out.println("WARNING - " + moduleName + " - Library not present in user version: " + dep); + } else if (!originalVersion.equals(userVersion)) { + System.out.println("ERROR - " + moduleName + " - Version mismatch for " + dep + ": original=" + originalVersion + ", user=" + userVersion); + changed = true; + } + } + + return !changed; + } + + private Map<String, String> versionMap(MavenResolvedArtifact[] artifacts) { + Map<String, String> versions = new TreeMap<>(); + for (MavenResolvedArtifact art : artifacts) { + versions.put(art.getCoordinate().getGroupId() + ":" + art.getCoordinate().getArtifactId(), art.getCoordinate().getVersion()); + } + return versions; + } + + private static File createUserPom(String moduleName) throws Exception { + + String pom; + try (InputStream pomTemplate = ArquillianPackager.class.getResourceAsStream("/application-pom.xml")) { + pom = IOUtils.toString(pomTemplate); + } + + Map<String, String> resolvedProperties = new TreeMap<>(); + Pattern propPattern = Pattern.compile("(\\$\\{[^}]*\\})"); + Matcher m = propPattern.matcher(pom); + while (m.find()) { + String property = m.group(); + String resolved = DependencyResolver.resolveParentProperty(property); + resolvedProperties.put(property, resolved); + } + + for (String property : resolvedProperties.keySet()) { + pom = pom.replace(property, resolvedProperties.get(property)); + } + + pom = pom.replace("#{module}", moduleName); + + File pomFile = new File("target/library-version-mismatch-spring-boot-pom.xml"); + try (FileWriter fw = new FileWriter(pomFile)) { + IOUtils.write(pom, fw); + } + + return pomFile; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tests/camel-itest-spring-boot/src/test/resources/application-pom.xml ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/resources/application-pom.xml b/tests/camel-itest-spring-boot/src/test/resources/application-pom.xml new file mode 100644 index 0000000..9a61748 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/resources/application-pom.xml @@ -0,0 +1,69 @@ +<?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/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <groupId>com.company</groupId> + <artifactId>spring-boot-application</artifactId> + <version>1.0</version> + + <name>Spring-Boot Application</name> + <description>This a the base pom of spring-boot applications launched by the users</description> + + <dependencyManagement> + <dependencies> + <dependency> + <!-- First the dependency management from Spring Boot --> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring-boot-version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + <dependency> + <!-- Then use camel dependency management --> + <groupId>org.apache.camel</groupId> + <artifactId>camel-parent</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + </dependencies> + </dependencyManagement> + + <dependencies> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>#{module}-starter</artifactId> + <version>${project.version}</version> + </dependency> + + <!-- Required by the integration tests to run --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java index e163404..bfc5331 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootStarterMojo.java @@ -156,8 +156,8 @@ public class SpringBootStarterMojo extends AbstractMojo { Document pom = createBasePom(); // Apply changes to the starter pom - fixLoggingDependencies(pom); - includeAdditionalDependencies(pom); + fixExcludedDependencies(pom); + fixAdditionalDependencies(pom); // Write the starter pom File pomFile = new File(starterDir, "pom.xml"); @@ -184,12 +184,23 @@ public class SpringBootStarterMojo extends AbstractMojo { return SpringBootHelper.allStartersDir(baseDir); } - private void includeAdditionalDependencies(Document pom) throws Exception { + private void fixAdditionalDependencies(Document pom) throws Exception { Properties properties = new Properties(); - properties.load(getClass().getResourceAsStream("/spring-boot-additional-dependencies.properties")); + properties.load(getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties")); + + String artDeps = properties.getProperty(project.getArtifactId()); + String globalDeps = properties.getProperty("global"); + + String deps = artDeps; + if (globalDeps != null && globalDeps.trim().length() > 0) { + if (deps != null && deps.trim().length() > 0) { + deps = deps + "," + globalDeps; + } else { + deps = globalDeps; + } + } - String deps = properties.getProperty(project.getArtifactId()); if (deps != null && deps.trim().length() > 0) { getLog().debug("The following dependencies will be added to the starter: " + deps); @@ -225,7 +236,7 @@ public class SpringBootStarterMojo extends AbstractMojo { } - private void fixLoggingDependencies(Document pom) throws Exception { + private void fixExcludedDependencies(Document pom) throws Exception { Set<String> loggingImpl = new HashSet<>(); @@ -249,10 +260,26 @@ public class SpringBootStarterMojo extends AbstractMojo { loggingImpl.add("org.slf4j:slf4j-simple"); - Set<String> includedLibs = filterIncludedArtifacts(loggingImpl); + // excluded dependencies + Set<String> configExclusions = new HashSet<>(); + Properties properties = new Properties(); + properties.load(getClass().getResourceAsStream("/spring-boot-fix-dependencies.properties")); + String artExcl = properties.getProperty("exclude_" + project.getArtifactId()); + getLog().debug("Configured exclusions: " + artExcl); + if (artExcl != null && artExcl.trim().length() > 0) { + for (String dep : artExcl.split(",")) { + getLog().debug("Adding configured exclusion: " + dep); + configExclusions.add(dep); + } + } + + Set<String> libsToRemove = new TreeSet<>(); + libsToRemove.addAll(loggingImpl); + libsToRemove.addAll(configExclusions); + libsToRemove = filterIncludedArtifacts(libsToRemove); - if (includedLibs.size() > 0) { - getLog().info("Spring-Boot-Starter: the following dependencies will be removed from the starter: " + includedLibs); + if (libsToRemove.size() > 0) { + getLog().info("Spring-Boot-Starter: the following dependencies will be removed from the starter: " + libsToRemove); XPath xpath = XPathFactory.newInstance().newXPath(); Node dependency = ((NodeList) xpath.compile("/project/dependencies/dependency[artifactId/text() = '" + project.getArtifactId() + "']").evaluate(pom, XPathConstants.NODESET)).item(0); @@ -261,7 +288,7 @@ public class SpringBootStarterMojo extends AbstractMojo { dependency.appendChild(exclusions); - for (String lib : includedLibs) { + for (String lib : libsToRemove) { String groupIdStr = lib.split("\\:")[0]; String artifactIdStr = lib.split("\\:")[1]; @@ -323,7 +350,7 @@ public class SpringBootStarterMojo extends AbstractMojo { modules.removeChild(modules.getFirstChild()); } - for (File starterDir : Arrays.asList(allStartersDir().listFiles((f, n) -> f.isDirectory() && n.endsWith(SpringBootHelper.STARTER_SUFFIX))).stream().sorted().collect(Collectors.toList())) { + for (File starterDir : Arrays.asList(allStartersDir().listFiles((f, n) -> (new File(f, n)).isDirectory() && n.endsWith(SpringBootHelper.STARTER_SUFFIX))).stream().sorted().collect(Collectors.toList())) { Node module = pom.createElement("module"); module.setTextContent(starterDir.getName()); modules.appendChild(module); http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tooling/maven/camel-package-maven-plugin/src/main/resources/spring-boot-additional-dependencies.properties ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/spring-boot-additional-dependencies.properties b/tooling/maven/camel-package-maven-plugin/src/main/resources/spring-boot-additional-dependencies.properties deleted file mode 100644 index bc07fe1..0000000 --- a/tooling/maven/camel-package-maven-plugin/src/main/resources/spring-boot-additional-dependencies.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file contains additional dependencies needed by camel modules in a spring-boot deployment - -camel-guava-eventbus=com.google.guava:guava -camel-jetty9=org.hibernate:hibernate-validator:${hibernate-validator-version} -camel-jms=org.apache.geronimo.specs:geronimo-jms_1.1_spec -camel-jpa=org.apache.geronimo.specs:geronimo-jpa_2.0_spec -camel-kubernetes=org.hibernate:hibernate-validator:${hibernate-validator-version} -camel-netty4=org.hibernate:hibernate-validator:${hibernate-validator-version} -camel-sjms=org.apache.geronimo.specs:geronimo-jms_1.1_spec -camel-spark-rest=org.hibernate:hibernate-validator:${hibernate-validator-version} -camel-spring-ws=org.springframework.boot:spring-boot-starter-web:${spring-boot-version} -camel-restlet=org.hibernate:hibernate-validator:${hibernate-validator-version} -camel-swagger-java=org.hibernate:hibernate-validator:${hibernate-validator-version} -camel-undertow=org.hibernate:hibernate-validator:${hibernate-validator-version} http://git-wip-us.apache.org/repos/asf/camel/blob/771c2399/tooling/maven/camel-package-maven-plugin/src/main/resources/spring-boot-fix-dependencies.properties ---------------------------------------------------------------------- diff --git a/tooling/maven/camel-package-maven-plugin/src/main/resources/spring-boot-fix-dependencies.properties b/tooling/maven/camel-package-maven-plugin/src/main/resources/spring-boot-fix-dependencies.properties new file mode 100644 index 0000000..467cc99 --- /dev/null +++ b/tooling/maven/camel-package-maven-plugin/src/main/resources/spring-boot-fix-dependencies.properties @@ -0,0 +1,24 @@ +# This file contains additional dependencies needed by camel modules in a spring-boot deployment +# Use comma-separated values to include ultiple dependencies + +# Caffeine in in camel-core but it is not being exported transitively +# Adding the dependency here until we understand why +# Cassandra (and others) fail without this dependency +global=com.github.ben-manes.caffeine:caffeine + +camel-guava-eventbus=com.google.guava:guava +camel-jetty9=org.hibernate:hibernate-validator:${hibernate-validator-version} +camel-jms=org.apache.geronimo.specs:geronimo-jms_1.1_spec +camel-jpa=org.apache.geronimo.specs:geronimo-jpa_2.0_spec +camel-kubernetes=org.hibernate:hibernate-validator:${hibernate-validator-version} +camel-netty4=org.hibernate:hibernate-validator:${hibernate-validator-version} +camel-netty4-http=org.hibernate:hibernate-validator:${hibernate-validator-version} +camel-sjms=org.apache.geronimo.specs:geronimo-jms_1.1_spec +camel-spark-rest=org.hibernate:hibernate-validator:${hibernate-validator-version} +camel-spring-ws=org.springframework.boot:spring-boot-starter-web:${spring-boot-version} +camel-restlet=org.hibernate:hibernate-validator:${hibernate-validator-version} +camel-swagger-java=org.hibernate:hibernate-validator:${hibernate-validator-version} +camel-undertow=org.hibernate:hibernate-validator:${hibernate-validator-version} + +# Needs JPA 2.1 +exclude_camel-bam=org.apache.geronimo.specs:geronimo-jpa_2.0_spec \ No newline at end of file