You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2017/09/13 16:20:43 UTC
[2/2] camel git commit: add spring-boot2 profile switch to itests
add spring-boot2 profile switch to itests
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e7de255f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e7de255f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e7de255f
Branch: refs/heads/boot2
Commit: e7de255f93cf88c7d8071baacdf8ff70667a6705
Parents: a9a2665
Author: Nicola Ferraro <ni...@gmail.com>
Authored: Wed Sep 13 17:54:02 2017 +0200
Committer: Nicola Ferraro <ni...@gmail.com>
Committed: Wed Sep 13 17:54:02 2017 +0200
----------------------------------------------------------------------
tests/camel-itest-spring-boot/pom.xml | 80 +++++++++++--
.../camel/itest/springboot/ITestConfig.java | 60 +++++-----
.../itest/springboot/ITestConfigBuilder.java | 19 ++++
.../springboot/util/ArquillianPackager.java | 3 +-
.../src/test/resources/application-pom-sb1.xml | 112 +++++++++++++++++++
.../src/test/resources/application-pom-sb2.xml | 112 +++++++++++++++++++
.../src/test/resources/application-pom.xml | 112 -------------------
7 files changed, 353 insertions(+), 145 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e7de255f/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 3d2ce97..b525928 100644
--- a/tests/camel-itest-spring-boot/pom.xml
+++ b/tests/camel-itest-spring-boot/pom.xml
@@ -38,17 +38,11 @@
<dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring-boot2-starter</artifactId>
- <version>${project.version}</version>
- </dependency>
-
<!-- Dependency needed to incorporate classes in main jar -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-loader</artifactId>
- <version>${spring-boot2-version}</version>
+ <version>${spring-boot-version}</version>
</dependency>
<!-- Test dependencies needed also at compile/unitTestEnabled time -->
@@ -206,4 +200,76 @@
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>spring-boot1</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-starter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>spring-boot2</id>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <childDelegation>false</childDelegation>
+ <forkedProcessTimeoutInSeconds>15000</forkedProcessTimeoutInSeconds>
+ <rerunFailingTestsCount>1</rerunFailingTestsCount>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ <systemProperties>
+ <!-- Test configuration -->
+ <!--
+ It is better disabling unit testing in surefire, as some of them fail for various reasons
+ (unrelated to spring-boot) when running in the arquillian jar.
+
+ Tests are enabled when running from IDE. See org.apache.camel.itest.springboot.ITestConfigBuilder
+ for property names and defaults values.
+ -->
+ <property>
+ <name>itest.springboot.unitTestEnabled</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>itest.springboot.includeTestDependencies</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>itest.springboot.mavenOfflineResolution</name>
+ <value>false</value>
+ </property>
+ <!-- Adding spring-boot version -->
+ <property>
+ <name>itest.springboot.springBootMajorVersion</name>
+ <value>2</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot2-starter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ </profile>
+ </profiles>
+
</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/e7de255f/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfig.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfig.java b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfig.java
index c4d332b..9c194e8 100644
--- a/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfig.java
+++ b/tests/camel-itest-spring-boot/src/main/java/org/apache/camel/itest/springboot/ITestConfig.java
@@ -71,6 +71,8 @@ public class ITestConfig implements Serializable {
private Map<String, String> testLibraryVersions;
+ private Integer springBootMajorVersion;
+
public ITestConfig() {
}
@@ -250,32 +252,40 @@ public class ITestConfig implements Serializable {
this.testLibraryVersions = testLibraryVersions;
}
+ public Integer getSpringBootMajorVersion() {
+ return springBootMajorVersion;
+ }
+
+ public void setSpringBootMajorVersion(Integer springBootMajorVersion) {
+ this.springBootMajorVersion = springBootMajorVersion;
+ }
+
@Override
public String toString() {
- final StringBuilder sb = new StringBuilder("ITestConfig{");
- sb.append("moduleName='").append(moduleName).append('\'');
- sb.append(", mavenGroup='").append(mavenGroup).append('\'');
- sb.append(", mavenVersion='").append(mavenVersion).append('\'');
- sb.append(", mavenOfflineResolution=").append(mavenOfflineResolution);
- sb.append(", modulesPath='").append(modulesPath).append('\'');
- sb.append(", moduleBasePath='").append(moduleBasePath).append('\'');
- sb.append(", includeTestDependencies=").append(includeTestDependencies);
- sb.append(", includeProvidedDependencies=").append(includeProvidedDependencies);
- sb.append(", unitTestEnabled=").append(unitTestEnabled);
- sb.append(", unitTestInclusionPattern='").append(unitTestInclusionPattern).append('\'');
- sb.append(", unitTestExclusionPattern='").append(unitTestExclusionPattern).append('\'');
- sb.append(", unitTestBasePackage='").append(unitTestBasePackage).append('\'');
- sb.append(", unitTestsExpectedNumber=").append(unitTestsExpectedNumber);
- sb.append(", resources=").append(resources);
- sb.append(", additionalDependencies=").append(additionalDependencies);
- sb.append(", mavenExclusions=").append(mavenExclusions);
- sb.append(", autoStartComponent=").append(autoStartComponent);
- sb.append(", jmxDisabledNames=").append(jmxDisabledNames);
- sb.append(", systemProperties=").append(systemProperties);
- sb.append(", useCustomLog=").append(useCustomLog);
- sb.append(", ignoreLibraryMismatch=").append(ignoreLibraryMismatch);
- sb.append(", testLibraryVersions=").append(testLibraryVersions);
- sb.append('}');
- return sb.toString();
+ return "ITestConfig{" +
+ "moduleName='" + moduleName + '\'' +
+ ", mavenGroup='" + mavenGroup + '\'' +
+ ", mavenVersion='" + mavenVersion + '\'' +
+ ", mavenOfflineResolution=" + mavenOfflineResolution +
+ ", modulesPath='" + modulesPath + '\'' +
+ ", moduleBasePath='" + moduleBasePath + '\'' +
+ ", includeTestDependencies=" + includeTestDependencies +
+ ", includeProvidedDependencies=" + includeProvidedDependencies +
+ ", unitTestEnabled=" + unitTestEnabled +
+ ", unitTestInclusionPattern='" + unitTestInclusionPattern + '\'' +
+ ", unitTestExclusionPattern='" + unitTestExclusionPattern + '\'' +
+ ", unitTestBasePackage='" + unitTestBasePackage + '\'' +
+ ", unitTestsExpectedNumber=" + unitTestsExpectedNumber +
+ ", resources=" + resources +
+ ", additionalDependencies=" + additionalDependencies +
+ ", mavenExclusions=" + mavenExclusions +
+ ", autoStartComponent=" + autoStartComponent +
+ ", jmxDisabledNames=" + jmxDisabledNames +
+ ", systemProperties=" + systemProperties +
+ ", useCustomLog=" + useCustomLog +
+ ", ignoreLibraryMismatch=" + ignoreLibraryMismatch +
+ ", testLibraryVersions=" + testLibraryVersions +
+ ", springBootMajorVersion=" + springBootMajorVersion +
+ '}';
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/e7de255f/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 647b8ef..614eac7 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
@@ -165,6 +165,11 @@ public class ITestConfigBuilder {
return this;
}
+ public ITestConfigBuilder springBootMajorVersion(Integer springBootMajorVersion) {
+ config.setSpringBootMajorVersion(springBootMajorVersion);
+ return this;
+ }
+
public ITestConfig build() {
// Checking conditions
@@ -253,6 +258,10 @@ public class ITestConfigBuilder {
config.setTestLibraryVersions(new HashMap<>());
}
+ if (config.getSpringBootMajorVersion() == null) {
+ config.setSpringBootMajorVersion(integerPropertyOr("springBootMajorVersion", 1));
+ }
+
return config;
}
@@ -277,4 +286,14 @@ public class ITestConfigBuilder {
return res;
}
+
+ private Integer integerPropertyOr(String name, Integer defaultVal) {
+ String prop = propertyOr(name, null);
+ Integer res = defaultVal;
+ if (prop != null) {
+ res = Integer.valueOf(prop);
+ }
+
+ return res;
+ }
}
http://git-wip-us.apache.org/repos/asf/camel/blob/e7de255f/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 0ef066c..56b89e6 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
@@ -462,7 +462,8 @@ public final class ArquillianPackager {
private static File createUserPom(ITestConfig config, List<String> cleanTestProvidedDependencies) throws Exception {
String pom;
- try (InputStream pomTemplate = ArquillianPackager.class.getResourceAsStream("/application-pom.xml")) {
+ String template = "/application-pom-sb" + config.getSpringBootMajorVersion() + ".xml";
+ try (InputStream pomTemplate = ArquillianPackager.class.getResourceAsStream(template)) {
pom = IOUtils.toString(pomTemplate);
}
http://git-wip-us.apache.org/repos/asf/camel/blob/e7de255f/tests/camel-itest-spring-boot/src/test/resources/application-pom-sb1.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/resources/application-pom-sb1.xml b/tests/camel-itest-spring-boot/src/test/resources/application-pom-sb1.xml
new file mode 100644
index 0000000..67eed1f
--- /dev/null
+++ b/tests/camel-itest-spring-boot/src/test/resources/application-pom-sb1.xml
@@ -0,0 +1,112 @@
+<?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>
+
+ <!-- The two BOMs -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring-boot-version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-dependencies</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>#{module}-starter</artifactId>
+ </dependency>
+
+ <!-- Required by the integration tests to run -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <!-- DEPENDENCIES -->
+
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>central</id>
+ <name>Maven Central</name>
+ <url>http://repo1.maven.org/maven2/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache-snapshots</id>
+ <name>Apache Snapshots</name>
+ <url>http://repository.apache.org/snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>atlassian-public</id>
+ <name>Atlassian Public</name>
+ <url>https://maven.atlassian.com/repository/public</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/e7de255f/tests/camel-itest-spring-boot/src/test/resources/application-pom-sb2.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/resources/application-pom-sb2.xml b/tests/camel-itest-spring-boot/src/test/resources/application-pom-sb2.xml
new file mode 100644
index 0000000..7aa6331
--- /dev/null
+++ b/tests/camel-itest-spring-boot/src/test/resources/application-pom-sb2.xml
@@ -0,0 +1,112 @@
+<?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>
+
+ <!-- The two BOMs -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring-boot2-version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-dependencies</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot2-starter</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>#{module}-starter</artifactId>
+ </dependency>
+
+ <!-- Required by the integration tests to run -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <!-- DEPENDENCIES -->
+
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>central</id>
+ <name>Maven Central</name>
+ <url>http://repo1.maven.org/maven2/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>apache-snapshots</id>
+ <name>Apache Snapshots</name>
+ <url>http://repository.apache.org/snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>atlassian-public</id>
+ <name>Atlassian Public</name>
+ <url>https://maven.atlassian.com/repository/public</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/e7de255f/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
deleted file mode 100644
index 7aa6331..0000000
--- a/tests/camel-itest-spring-boot/src/test/resources/application-pom.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-<?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>
-
- <!-- The two BOMs -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-dependencies</artifactId>
- <version>${spring-boot2-version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring-boot-dependencies</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring-boot2-starter</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>#{module}-starter</artifactId>
- </dependency>
-
- <!-- Required by the integration tests to run -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
-
- <!-- DEPENDENCIES -->
-
- </dependencies>
-
- <repositories>
- <repository>
- <id>central</id>
- <name>Maven Central</name>
- <url>http://repo1.maven.org/maven2/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>apache-snapshots</id>
- <name>Apache Snapshots</name>
- <url>http://repository.apache.org/snapshots/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>atlassian-public</id>
- <name>Atlassian Public</name>
- <url>https://maven.atlassian.com/repository/public</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
-</project>