Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 05BAF200B89 for ; Wed, 21 Sep 2016 09:19:24 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 02ABC160AE7; Wed, 21 Sep 2016 07:19:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F0FBF160ADB for ; Wed, 21 Sep 2016 09:19:21 +0200 (CEST) Received: (qmail 57022 invoked by uid 500); 21 Sep 2016 07:19:21 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 57013 invoked by uid 99); 21 Sep 2016 07:19:21 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Sep 2016 07:19:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D249CE05D9; Wed, 21 Sep 2016 07:19:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nferraro@apache.org To: commits@camel.apache.org Date: Wed, 21 Sep 2016 07:19:20 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [01/49] camel git commit: CAMEL-10222: Fixed some poms up to HBase archived-at: Wed, 21 Sep 2016 07:19:24 -0000 Repository: camel Updated Branches: refs/heads/master 712378ab3 -> 011e4ec57 http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/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 0f28e82..ad4f0bc 100644 --- a/tests/camel-itest-spring-boot/pom.xml +++ b/tests/camel-itest-spring-boot/pom.xml @@ -34,12 +34,6 @@ org.apache.camel camel-spring-boot-starter - - - org.springframework.boot - spring-boot-starter-logging - - @@ -49,12 +43,6 @@ ${spring-boot-version} - - org.springframework.boot - spring-boot-starter-log4j2 - ${spring-boot-version} - - org.jboss.shrinkwrap @@ -161,7 +149,95 @@ 15000 1 - **/*Test.java + + + org.apache.camel.itest.springboot.CamelNetty4Test + org.apache.camel.itest.springboot.CamelNettyHttpTest + org.apache.camel.itest.springboot.CamelNettyTest + org.apache.camel.itest.springboot.CamelOgnlTest + org.apache.camel.itest.springboot.CamelOlingo2Test + org.apache.camel.itest.springboot.CamelOpenshiftTest + org.apache.camel.itest.springboot.CamelOptaplannerTest + org.apache.camel.itest.springboot.CamelPahoTest + org.apache.camel.itest.springboot.CamelPdfTest + org.apache.camel.itest.springboot.CamelPgeventTest + org.apache.camel.itest.springboot.CamelPrinterTest + org.apache.camel.itest.springboot.CamelProtobufTest + org.apache.camel.itest.springboot.CamelQuartz2Test + org.apache.camel.itest.springboot.CamelQuartzTest + org.apache.camel.itest.springboot.CamelQuickfixTest + org.apache.camel.itest.springboot.CamelRabbitmqTest + org.apache.camel.itest.springboot.CamelRestletTest + org.apache.camel.itest.springboot.CamelRibbonTest + org.apache.camel.itest.springboot.CamelRmiTest + org.apache.camel.itest.springboot.CamelRouteboxTest + org.apache.camel.itest.springboot.CamelRssTest + org.apache.camel.itest.springboot.CamelRubyTest + org.apache.camel.itest.springboot.CamelRxTest + org.apache.camel.itest.springboot.CamelSalesforceTest + org.apache.camel.itest.springboot.CamelSapNetweaverTest + org.apache.camel.itest.springboot.CamelSaxonTest + org.apache.camel.itest.springboot.CamelScalaTest + org.apache.camel.itest.springboot.CamelSchematronTest + org.apache.camel.itest.springboot.CamelScriptTest + org.apache.camel.itest.springboot.CamelScrTest + org.apache.camel.itest.springboot.CamelServicenowTest + org.apache.camel.itest.springboot.CamelServletlistenerTest + org.apache.camel.itest.springboot.CamelServletTest + org.apache.camel.itest.springboot.CamelShiroTest + org.apache.camel.itest.springboot.CamelSipTest + org.apache.camel.itest.springboot.CamelSjmsTest + org.apache.camel.itest.springboot.CamelSlackTest + org.apache.camel.itest.springboot.CamelSmppTest + org.apache.camel.itest.springboot.CamelSnakeyamlTest + org.apache.camel.itest.springboot.CamelSnmpTest + org.apache.camel.itest.springboot.CamelSoapTest + org.apache.camel.itest.springboot.CamelSolrTest + org.apache.camel.itest.springboot.CamelSparkRestTest + org.apache.camel.itest.springboot.CamelSparkTest + org.apache.camel.itest.springboot.CamelSplunkTest + org.apache.camel.itest.springboot.CamelSpringBatchTest + org.apache.camel.itest.springboot.CamelSpringBootTest + org.apache.camel.itest.springboot.CamelSpringDmTest + org.apache.camel.itest.springboot.CamelSpringIntegrationTest + org.apache.camel.itest.springboot.CamelSpringJavaconfigTest + org.apache.camel.itest.springboot.CamelSpringLdapTest + org.apache.camel.itest.springboot.CamelSpringRedisTest + org.apache.camel.itest.springboot.CamelSpringSecurityTest + org.apache.camel.itest.springboot.CamelSpringTest + org.apache.camel.itest.springboot.CamelSpringWsTest + org.apache.camel.itest.springboot.CamelSqlTest + org.apache.camel.itest.springboot.CamelSshTest + org.apache.camel.itest.springboot.CamelStaxTest + org.apache.camel.itest.springboot.CamelStompTest + org.apache.camel.itest.springboot.CamelStreamTest + org.apache.camel.itest.springboot.CamelStringtemplateTest + org.apache.camel.itest.springboot.CamelSwaggerJavaTest + org.apache.camel.itest.springboot.CamelSyslogTest + org.apache.camel.itest.springboot.CamelTagsoupTest + org.apache.camel.itest.springboot.CamelTarfileTest + org.apache.camel.itest.springboot.CamelTelegramTest + org.apache.camel.itest.springboot.CamelTestngTest + org.apache.camel.itest.springboot.CamelTestTest + org.apache.camel.itest.springboot.CamelTwitterTest + org.apache.camel.itest.springboot.CamelUndertowTest + org.apache.camel.itest.springboot.CamelUnivocityParsersTest + org.apache.camel.itest.springboot.CamelUrlrewriteTest + org.apache.camel.itest.springboot.CamelVelocityTest + org.apache.camel.itest.springboot.CamelVertxTest + org.apache.camel.itest.springboot.CamelWeatherTest + org.apache.camel.itest.springboot.CamelWebsocketTest + org.apache.camel.itest.springboot.CamelXmlbeansTest + org.apache.camel.itest.springboot.CamelXmljsonTest + org.apache.camel.itest.springboot.CamelXmlrpcTest + org.apache.camel.itest.springboot.CamelXmlsecurityTest + org.apache.camel.itest.springboot.CamelXmppTest + org.apache.camel.itest.springboot.CamelXstreamTest + org.apache.camel.itest.springboot.CamelYammerTest + org.apache.camel.itest.springboot.CamelZipfileTest + org.apache.camel.itest.springboot.CamelZipkinTest + org.apache.camel.itest.springboot.CamelZookeeperTest + @@ -174,7 +250,7 @@ --> itest.springboot.unitTestEnabled - false + true itest.springboot.includeTestDependencies @@ -185,77 +261,6 @@ false - - - version_bam_org.hibernate:hibernate-entitymanager - 5.0.9.Final - - - version_org.apache.geronimo.specs:geronimo-jta_1.1_spec - ${geronimo-jta-spec-version} - - - - - version_org.apache.camel:camel-core - ${project.version} - - - version_org.apache.camel:camel-netty4 - ${project.version} - - - version_org.springframework.data:spring-data-redis - ${spring-data-redis-version} - - - version_org.hibernate:hibernate-validator - ${hibernate-validator-version} - - - version_xom:xom - ${xom-version} - - - version_org.springframework.boot:spring-boot-starter-web - ${spring-boot-version} - - - version_2.10_org.scala-lang:scala-library - ${scala-2.10-version} - - - version_org.springframework:spring-webmvc - ${spring-version} - - - version_org.apache.lucene:lucene-core - ${lucene3-version} - - - version_com.google.inject:guice - ${guice3-version} - - - version_com.google.guava:guava - ${google-guava-version} - - - version_org.apache.hadoop:hadoop-hdfs - ${hadoop2-version} - - - version_io.netty:netty-all - ${netty-version} - - - version_org.glassfish.grizzly:grizzly-websockets - ${grizzly-websockets-version} - - - version_org.glassfish.grizzly:connection-pool - ${grizzly-websockets-version} - http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java index 584f59b..f85bdb6 100644 --- a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java +++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestApplication.java @@ -18,7 +18,11 @@ package org.apache.camel.itest.springboot; import java.net.URL; -import org.apache.logging.log4j.core.config.Configurator; +import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.joran.JoranConfigurator; +import ch.qos.logback.core.joran.spi.JoranException; +import ch.qos.logback.core.util.StatusPrinter; + import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -36,6 +40,8 @@ import org.springframework.scheduling.annotation.EnableAsync; public class ITestApplication { public static void main(String[] args) throws Exception { + overrideLoggingConfig(); + SpringApplication.run(ITestApplication.class, args); } @@ -44,4 +50,26 @@ public class ITestApplication { // to tell source-check this is not a utility-class return "spring-boot-main"; } + + private static void overrideLoggingConfig() { + + URL logbackFile = ITestApplication.class.getResource("/spring-logback.xml"); + if (logbackFile != null) { + + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + + try { + JoranConfigurator configurator = new JoranConfigurator(); + configurator.setContext(context); + // Call context.reset() to clear any previous configuration, e.g. default + // configuration. For multi-step configuration, omit calling context.reset(). + context.reset(); + configurator.doConfigure(logbackFile); + } catch (JoranException je) { + // StatusPrinter will handle this + } + StatusPrinter.printInCaseOfErrorsOrWarnings(context); + } + + } } http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/converter/myconverter/StaticDummyFallbackConverter.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/converter/myconverter/StaticDummyFallbackConverter.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/converter/myconverter/StaticDummyFallbackConverter.java new file mode 100644 index 0000000..6bbef26 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/converter/myconverter/StaticDummyFallbackConverter.java @@ -0,0 +1,44 @@ +/** + * 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.converter.myconverter; + +import org.apache.camel.Converter; +import org.apache.camel.Exchange; +import org.apache.camel.FallbackConverter; +import org.apache.camel.spi.TypeConverterRegistry; + +import java.util.TimeZone; + + +/** + * Converter added here to overcome issue CAMEL-10060 in integration tests (Needed because some unit tests create new camel contexts from scratch). + */ +@Converter +public final class StaticDummyFallbackConverter { + + private StaticDummyFallbackConverter() { + } + + @FallbackConverter + public static Object convertTo(Class type, Exchange exchange, Object value, TypeConverterRegistry registry) { + if (TimeZone.class.isAssignableFrom(value.getClass())) { + return "Time talks"; + } + return null; + } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/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 7a31765..ff257c2 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 @@ -38,8 +38,7 @@ 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")) + .dependency("org.hibernate:hibernate-entitymanager:" + DependencyResolver.resolveSpringBootParentProperty("${hibernate-version}")) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBlueprintTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBlueprintTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBlueprintTest.java deleted file mode 100644 index c50fe47..0000000 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelBlueprintTest.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 CamelBlueprintTest extends AbstractSpringBootTestSupport { - - @Deployment - public static Archive createSpringBootPackage() throws Exception { - return ArquillianPackager.springBootPackage(createTestConfig()); - } - - public static ITestConfig createTestConfig() { - return new ITestConfigBuilder() - .module(inferModuleName(CamelBlueprintTest.class)) - .build(); - } - - @Test - public void componentTests() throws Exception { - // no component test - this.runModuleUnitTestsIfEnabled(config); - } - - -} http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/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 0cde434..2140194 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 @@ -40,7 +40,8 @@ public class CamelCassandraqlTest extends AbstractSpringBootTestSupport { // .dependency(DependencyResolver.withVersion("io.dropwizard.metrics:metrics-core")) // .exclusion("com.codahale.metrics:*") .unitTestExclusionPattern(".*(\\.integration\\..*|IntegrationTest$|CassandraComponentProducerTest$|CassandraComponentBeanRefTest$|CassandraComponentConsumerTest$)") - // excluded tests have been checked manually (they need to run on their own JDK) + //.unitTestInclusionPattern(".*NamedCassandraAggregationRepositoryTest$") + // excluded tests have been checked manually (they need to run on their own JVM) .build(); } http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCdiTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCdiTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCdiTest.java deleted file mode 100644 index 3178583..0000000 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelCdiTest.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 CamelCdiTest extends AbstractSpringBootTestSupport { - - @Deployment - public static Archive createSpringBootPackage() throws Exception { - return ArquillianPackager.springBootPackage(createTestConfig()); - } - - public static ITestConfig createTestConfig() { - return new ITestConfigBuilder() - .module(inferModuleName(CamelCdiTest.class)) - .unitTestExclusionPattern(".*Cdi12Test$") - .build(); - } - - @Test - public void componentTests() throws Exception { - // no component test - this.runModuleUnitTestsIfEnabled(config); - } - - -} http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelEjbTest.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelEjbTest.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelEjbTest.java deleted file mode 100644 index ec0c414..0000000 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelEjbTest.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 CamelEjbTest extends AbstractSpringBootTestSupport { - - @Deployment - public static Archive createSpringBootPackage() throws Exception { - return ArquillianPackager.springBootPackage(createTestConfig()); - } - - public static ITestConfig createTestConfig() { - return new ITestConfigBuilder() - .module(inferModuleName(CamelEjbTest.class)) - .build(); - } - - @Test - public void componentTests() throws Exception { - this.runComponentTest(config); - this.runModuleUnitTestsIfEnabled(config); - } - - -} http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/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 f3623c6..67e89a4 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 @@ -61,7 +61,6 @@ import org.jboss.shrinkwrap.impl.base.path.BasicPath; import org.jboss.shrinkwrap.resolver.api.maven.ConfigurableMavenResolverSystem; import org.jboss.shrinkwrap.resolver.api.maven.Maven; import org.jboss.shrinkwrap.resolver.api.maven.MavenResolvedArtifact; -import org.jboss.shrinkwrap.resolver.api.maven.PackagingType; import org.jboss.shrinkwrap.resolver.api.maven.ScopeType; import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinate; import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenCoordinates; @@ -107,7 +106,7 @@ public final class ArquillianPackager { } if (config.getUseCustomLog()) { - ark = ark.addAsResource("log4j2-spring.xml", CLASSES_FOLDER + "/log4j2.xml"); + ark = ark.addAsResource("spring-logback.xml", CLASSES_FOLDER + "/spring-logback.xml"); } for (Map.Entry res : config.getResources().entrySet()) { @@ -137,6 +136,10 @@ public final class ArquillianPackager { List commonExclusions = new LinkedList<>(); commonExclusions.add(MavenDependencies.createExclusion("org.slf4j", "slf4j-log4j12")); commonExclusions.add(MavenDependencies.createExclusion("log4j", "log4j")); + commonExclusions.add(MavenDependencies.createExclusion("log4j", "log4j-slf4j-impl")); + commonExclusions.add(MavenDependencies.createExclusion("org.apache.logging.log4j", "log4j")); + commonExclusions.add(MavenDependencies.createExclusion("org.apache.logging.log4j", "log4j-core")); + commonExclusions.add(MavenDependencies.createExclusion("org.apache.logging.log4j", "log4j-slf4j-impl")); commonExclusions.add(MavenDependencies.createExclusion("log4j", "apache-log4j-extras")); commonExclusions.add(MavenDependencies.createExclusion("org.slf4j", "slf4j-simple")); commonExclusions.add(MavenDependencies.createExclusion("org.slf4j", "slf4j-jdk14")); @@ -167,37 +170,60 @@ public final class ArquillianPackager { if (config.getIncludeProvidedDependencies() || config.getIncludeTestDependencies() || config.getUnitTestEnabled()) { + StringBuilder dependencies = new StringBuilder(); List scopes = new LinkedList<>(); if (config.getIncludeTestDependencies() || config.getUnitTestEnabled()) { + dependencies.append(DependencyResolver.getDependencies(config.getModuleBasePath() + "/pom.xml", ScopeType.TEST.toString())); scopes.add(ScopeType.TEST); } if (config.getIncludeProvidedDependencies()) { + dependencies.append(DependencyResolver.getDependencies(config.getModuleBasePath() + "/pom.xml", ScopeType.PROVIDED.toString())); scopes.add(ScopeType.PROVIDED); } + File resolverFile = createResolverPom(config, dependencies.toString()); + boolean failIfNoDependencies = false; List moduleArtifacts; try { moduleArtifacts = Arrays.asList(resolver(config) - .loadPomFromFile(config.getModuleBasePath() + "/pom.xml") - .importDependencies(scopes.toArray(new ScopeType[]{})) + .loadPomFromFile(resolverFile) + .importDependencies(scopes.toArray(new ScopeType[0])) .resolve().withoutTransitivity().asResolvedArtifact()); - } catch(IllegalArgumentException e) { - if(failIfNoDependencies) { + } catch (IllegalArgumentException e) { + if (failIfNoDependencies) { throw e; } - debug("Error while getting dependencies for scopes: " + scopes + ". Message=" + e.getMessage()); + debug("Error while getting dependencies for test or optional scopes. Message=" + e.getMessage()); moduleArtifacts = new LinkedList<>(); } + List coordinates = new LinkedList<>(); + // fill coordinates for (MavenResolvedArtifact art : moduleArtifacts) { - MavenCoordinate c = art.getCoordinate(); - if (!validTestDependency(config, c)) { + MavenCoordinate coord = art.getCoordinate(); + +// Set nonStarterModules = new HashSet<>(); +// nonStarterModules.add("camel-test"); +// +// // redirect reference from camel modules to camel starters in test scope +// if (art.getScope() == ScopeType.TEST && art.getCoordinate().getGroupId().equals("org.apache.camel") && art.getCoordinate().getArtifactId().startsWith("camel-") && !nonStarterModules +// .contains(art.getCoordinate().getArtifactId())) { +// coord = MavenCoordinates.createCoordinate(art.getCoordinate().getGroupId(), art.getCoordinate().getArtifactId() + "-starter", art.getCoordinate().getVersion(), art.getCoordinate +// ().getPackaging(), art.getCoordinate().getClassifier()); +// } + + if (!validTestDependency(config, coord)) { continue; } + coordinates.add(coord); + } + + for (MavenCoordinate c : coordinates) { + // Re-adding exclusions, as Arquillian resolver ignores them Set pomExclusions = DependencyResolver.getExclusions(config.getModuleBasePath() + "/pom.xml", c.getGroupId(), c.getArtifactId()); MavenDependencyExclusion[] artExclusions; @@ -242,9 +268,8 @@ public final class ArquillianPackager { ark = ark.addPackages(true, "org.apache.camel.itest.springboot"); ark = addSpringbootPackage(ark, "org.apache.camel.itest.springboot"); - // CAMEL-10060 is resolved since 2.18 but probably the package scanner should be adapted to Spring-boot 1.4.0.RELEASE new packaging structure -// ark = addSpringbootPackage(ark, "org.apache.camel.converter.myconverter"); // to overcome CAMEL-10060 -// ark = addSpringbootPackage(ark, "org.apache.camel.osgi.test"); // to overcome CAMEL-10060 + // CAMEL-10060 is resolved since 2.18 but some unit tests use custom (non spring-boot enabled) camel contexts + ark = ark.addPackages(true, "org.apache.camel.converter.myconverter"); ark = ark.addPackages(true, "org.springframework.boot.loader"); @@ -288,7 +313,7 @@ public final class ArquillianPackager { Matcher m = propPattern.matcher(pom); while (m.find()) { String property = m.group(); - String resolved = DependencyResolver.resolveParentProperty(property); + String resolved = DependencyResolver.resolveSpringBootParentProperty(property); resolvedProperties.put(property, resolved); } @@ -306,6 +331,36 @@ public final class ArquillianPackager { return pomFile; } + private static File createResolverPom(ITestConfig config, String dependencies) throws Exception { + + String pom; + try (InputStream pomTemplate = ArquillianPackager.class.getResourceAsStream("/dependency-resolver-pom.xml")) { + pom = IOUtils.toString(pomTemplate); + } + + pom = pom.replace("", dependencies); + + Map 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)); + } + + File pomFile = new File(config.getModuleBasePath() + "/target/itest-spring-boot-dependency-resolver-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()); } @@ -347,6 +402,8 @@ public final class ArquillianPackager { Pattern[] patterns = new Pattern[]{ Pattern.compile("^log4j$"), + Pattern.compile("^log4j-slf4j-impl$"), + Pattern.compile("^log4j-core$"), Pattern.compile("^slf4j-log4j12$"), Pattern.compile("^slf4j-simple$"), Pattern.compile("^slf4j-jdk14$"), http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/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 a5bf635..fa2adef 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 @@ -16,11 +16,17 @@ */ package org.apache.camel.itest.springboot.util; +import java.io.StringWriter; import java.util.Collections; import java.util.HashSet; import java.util.Set; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; @@ -46,6 +52,33 @@ public final class DependencyResolver { } /** + * Retrieves a list of dependencies of the given scope + */ + public static String getDependencies(String pom, String scope) throws Exception { + String expression = "/project/dependencies/dependency[scope='" + scope + "']"; + + DocumentBuilder builder = factory.newDocumentBuilder(); + Document doc = builder.parse(pom); + XPath xpath = xPathfactory.newXPath(); + XPathExpression expr = xpath.compile(expression); + + StringBuilder res = new StringBuilder(); + NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); + for(int i=0; i archive = ArquillianPackager.springBootPackage(new ITestConfigBuilder() - .module("camel-ahc-ws") + .module("camel-hbase") .build()); new ZipExporterImpl(archive).exportTo(new File("target/export.zip"), true); http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/LibraryVersionMismatchChecker.java ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/LibraryVersionMismatchChecker.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/LibraryVersionMismatchChecker.java index 7f97fd1..2827410 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/LibraryVersionMismatchChecker.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/LibraryVersionMismatchChecker.java @@ -106,7 +106,7 @@ public class LibraryVersionMismatchChecker { Matcher m = propPattern.matcher(pom); while (m.find()) { String property = m.group(); - String resolved = DependencyResolver.resolveParentProperty(property); + String resolved = DependencyResolver.resolveSpringBootParentProperty(property); resolvedProperties.put(property, resolved); } http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/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 index 9a61748..8fbb685 100644 --- a/tests/camel-itest-spring-boot/src/test/resources/application-pom.xml +++ b/tests/camel-itest-spring-boot/src/test/resources/application-pom.xml @@ -29,19 +29,11 @@ - - - org.springframework.boot - spring-boot-dependencies - ${spring-boot-version} - pom - import - org.apache.camel - camel-parent + camel-parent-spring-boot ${project.version} pom import @@ -55,7 +47,6 @@ org.apache.camel #{module}-starter - ${project.version} http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/tests/camel-itest-spring-boot/src/test/resources/dependency-resolver-pom.xml ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/resources/dependency-resolver-pom.xml b/tests/camel-itest-spring-boot/src/test/resources/dependency-resolver-pom.xml new file mode 100644 index 0000000..d8d94ab --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/resources/dependency-resolver-pom.xml @@ -0,0 +1,60 @@ + + + + + 4.0.0 + + com.company + spring-boot-dependency-resolver + 1.0 + + Spring-Boot Dependency Resolver + This POM is used to resolve test and optional dependencies required in integration tests + + + + + + + org.apache.camel + camel-parent-spring-boot + ${project.version} + pom + import + + + + + org.apache.camel + camel-parent + ${project.version} + pom + import + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/tests/camel-itest-spring-boot/src/test/resources/log4j2-spring.xml ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/resources/log4j2-spring.xml b/tests/camel-itest-spring-boot/src/test/resources/log4j2-spring.xml deleted file mode 100644 index fa9da00..0000000 --- a/tests/camel-itest-spring-boot/src/test/resources/log4j2-spring.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/tests/camel-itest-spring-boot/src/test/resources/spring-logback.xml ---------------------------------------------------------------------- diff --git a/tests/camel-itest-spring-boot/src/test/resources/spring-logback.xml b/tests/camel-itest-spring-boot/src/test/resources/spring-logback.xml new file mode 100644 index 0000000..41af398 --- /dev/null +++ b/tests/camel-itest-spring-boot/src/test/resources/spring-logback.xml @@ -0,0 +1,37 @@ + + + + + + + + %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/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 c829b3f..e154bb9 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 @@ -77,8 +77,11 @@ import org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNod public class SpringBootStarterMojo extends AbstractMojo { - private static final String[] IGNORE_MODULES = {/* OSGi -> */ "camel-core-osgi", "camel-eventadmin", "camel-paxlogging", /* deprecated (and not working perfectly) -> */"camel-swagger", - "camel-mina", /* others (not managed) -> */ "camel-zipkin"}; + private static final String[] IGNORE_MODULES = { + /* OSGi -> */ "camel-blueprint", "camel-core-osgi", "camel-eventadmin", "camel-paxlogging", + /* Java EE -> */ "camel-cdi", "camel-ejb", + /* deprecated (and not working perfectly) -> */ "camel-swagger", "camel-mina", + /* others (not managed) -> */ "camel-zipkin"}; private static final boolean IGNORE_TEST_MODULES = true; @@ -269,6 +272,7 @@ public class SpringBootStarterMojo extends AbstractMojo { loggingImpl.add("ch.qos.logback:logback-classic"); loggingImpl.add("org.apache.logging.log4j:log4j"); + loggingImpl.add("org.apache.logging.log4j:log4j-core"); loggingImpl.add("org.apache.logging.log4j:log4j-slf4j-impl"); loggingImpl.add("org.slf4j:slf4j-jcl"); http://git-wip-us.apache.org/repos/asf/camel/blob/5ca0fda0/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 index 5d742f9..6eaa9b2 100644 --- 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 @@ -22,26 +22,30 @@ # Global dependencies included in all modules (except the ones in the list) global=org.apache.camel:camel-core-starter,org.apache.camel:camel-spring-boot-starter - # 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 camel-core=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-github=org.eclipse.mylyn.github:org.eclipse.egit.github.core:${egit-github-core-version} +camel-guava-eventbus=com.google.guava:guava:${google-guava-version} +camel-jetty9=org.hibernate:hibernate-validator +camel-jms=org.apache.geronimo.specs:geronimo-jms_1.1_spec:${geronimo-jms-spec-version} +camel-jpa=org.apache.geronimo.specs:geronimo-jpa_2.0_spec:${geronimo-jpa2-spec-version} +camel-kubernetes=org.hibernate:hibernate-validator +camel-netty4=org.hibernate:hibernate-validator +camel-netty4-http=org.hibernate:hibernate-validator +camel-sjms=org.apache.geronimo.specs:geronimo-jms_1.1_spec:${geronimo-jms-spec-version} +camel-spark-rest=org.hibernate:hibernate-validator camel-spring-boot=org.apache.camel:camel-core-starter 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} +camel-restlet=org.hibernate:hibernate-validator +camel-swagger-java=org.hibernate:hibernate-validator +camel-undertow=org.hibernate:hibernate-validator + # Needs JPA 2.1 -exclude_camel-bam=org.apache.geronimo.specs:geronimo-jpa_2.0_spec \ No newline at end of file +exclude_camel-bam=org.apache.geronimo.specs:geronimo-jpa_2.0_spec + +# Existed for Netty 3 +exclude_camel-hbase=io.netty:netty