camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nferr...@apache.org
Subject [09/49] camel git commit: CAMEL-10222: Fixed resolution of wrong versions
Date Wed, 21 Sep 2016 07:19:28 GMT
CAMEL-10222: Fixed resolution of wrong versions


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

Branch: refs/heads/master
Commit: 7f351389f96ecccc2d424964cd4506ff776b1f6e
Parents: 2c8e289
Author: Nicola Ferraro <ni.ferraro@gmail.com>
Authored: Fri Sep 2 13:43:38 2016 +0200
Committer: Nicola Ferraro <ni.ferraro@gmail.com>
Committed: Tue Sep 20 00:38:04 2016 +0200

----------------------------------------------------------------------
 tests/camel-itest-spring-boot/pom.xml           | 174 +++++++++----------
 .../springboot/util/ArquillianPackager.java     | 116 +++++++++----
 .../itest/springboot/util/JarExporter.java      |   2 +-
 .../src/test/resources/application-pom.xml      |   2 +-
 .../test/resources/dependency-resolver-pom.xml  |  60 +++++++
 5 files changed, 230 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7f351389/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 ad4f0bc..fa02338 100644
--- a/tests/camel-itest-spring-boot/pom.xml
+++ b/tests/camel-itest-spring-boot/pom.xml
@@ -149,94 +149,94 @@
           <forkedProcessTimeoutInSeconds>15000</forkedProcessTimeoutInSeconds>
           <rerunFailingTestsCount>1</rerunFailingTestsCount>
           <includes>
-            <!--<include>**/*Test.java</include>-->
+            <include>**/*Test.java</include>
 
-            <include>org.apache.camel.itest.springboot.CamelNetty4Test</include>
-            <include>org.apache.camel.itest.springboot.CamelNettyHttpTest</include>
-            <include>org.apache.camel.itest.springboot.CamelNettyTest</include>
-            <include>org.apache.camel.itest.springboot.CamelOgnlTest</include>
-            <include>org.apache.camel.itest.springboot.CamelOlingo2Test</include>
-            <include>org.apache.camel.itest.springboot.CamelOpenshiftTest</include>
-            <include>org.apache.camel.itest.springboot.CamelOptaplannerTest</include>
-            <include>org.apache.camel.itest.springboot.CamelPahoTest</include>
-            <include>org.apache.camel.itest.springboot.CamelPdfTest</include>
-            <include>org.apache.camel.itest.springboot.CamelPgeventTest</include>
-            <include>org.apache.camel.itest.springboot.CamelPrinterTest</include>
-            <include>org.apache.camel.itest.springboot.CamelProtobufTest</include>
-            <include>org.apache.camel.itest.springboot.CamelQuartz2Test</include>
-            <include>org.apache.camel.itest.springboot.CamelQuartzTest</include>
-            <include>org.apache.camel.itest.springboot.CamelQuickfixTest</include>
-            <include>org.apache.camel.itest.springboot.CamelRabbitmqTest</include>
-            <include>org.apache.camel.itest.springboot.CamelRestletTest</include>
-            <include>org.apache.camel.itest.springboot.CamelRibbonTest</include>
-            <include>org.apache.camel.itest.springboot.CamelRmiTest</include>
-            <include>org.apache.camel.itest.springboot.CamelRouteboxTest</include>
-            <include>org.apache.camel.itest.springboot.CamelRssTest</include>
-            <include>org.apache.camel.itest.springboot.CamelRubyTest</include>
-            <include>org.apache.camel.itest.springboot.CamelRxTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSalesforceTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSapNetweaverTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSaxonTest</include>
-            <include>org.apache.camel.itest.springboot.CamelScalaTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSchematronTest</include>
-            <include>org.apache.camel.itest.springboot.CamelScriptTest</include>
-            <include>org.apache.camel.itest.springboot.CamelScrTest</include>
-            <include>org.apache.camel.itest.springboot.CamelServicenowTest</include>
-            <include>org.apache.camel.itest.springboot.CamelServletlistenerTest</include>
-            <include>org.apache.camel.itest.springboot.CamelServletTest</include>
-            <include>org.apache.camel.itest.springboot.CamelShiroTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSipTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSjmsTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSlackTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSmppTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSnakeyamlTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSnmpTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSoapTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSolrTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSparkRestTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSparkTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSplunkTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSpringBatchTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSpringBootTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSpringDmTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSpringIntegrationTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSpringJavaconfigTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSpringLdapTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSpringRedisTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSpringSecurityTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSpringTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSpringWsTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSqlTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSshTest</include>
-            <include>org.apache.camel.itest.springboot.CamelStaxTest</include>
-            <include>org.apache.camel.itest.springboot.CamelStompTest</include>
-            <include>org.apache.camel.itest.springboot.CamelStreamTest</include>
-            <include>org.apache.camel.itest.springboot.CamelStringtemplateTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSwaggerJavaTest</include>
-            <include>org.apache.camel.itest.springboot.CamelSyslogTest</include>
-            <include>org.apache.camel.itest.springboot.CamelTagsoupTest</include>
-            <include>org.apache.camel.itest.springboot.CamelTarfileTest</include>
-            <include>org.apache.camel.itest.springboot.CamelTelegramTest</include>
-            <include>org.apache.camel.itest.springboot.CamelTestngTest</include>
-            <include>org.apache.camel.itest.springboot.CamelTestTest</include>
-            <include>org.apache.camel.itest.springboot.CamelTwitterTest</include>
-            <include>org.apache.camel.itest.springboot.CamelUndertowTest</include>
-            <include>org.apache.camel.itest.springboot.CamelUnivocityParsersTest</include>
-            <include>org.apache.camel.itest.springboot.CamelUrlrewriteTest</include>
-            <include>org.apache.camel.itest.springboot.CamelVelocityTest</include>
-            <include>org.apache.camel.itest.springboot.CamelVertxTest</include>
-            <include>org.apache.camel.itest.springboot.CamelWeatherTest</include>
-            <include>org.apache.camel.itest.springboot.CamelWebsocketTest</include>
-            <include>org.apache.camel.itest.springboot.CamelXmlbeansTest</include>
-            <include>org.apache.camel.itest.springboot.CamelXmljsonTest</include>
-            <include>org.apache.camel.itest.springboot.CamelXmlrpcTest</include>
-            <include>org.apache.camel.itest.springboot.CamelXmlsecurityTest</include>
-            <include>org.apache.camel.itest.springboot.CamelXmppTest</include>
-            <include>org.apache.camel.itest.springboot.CamelXstreamTest</include>
-            <include>org.apache.camel.itest.springboot.CamelYammerTest</include>
-            <include>org.apache.camel.itest.springboot.CamelZipfileTest</include>
-            <include>org.apache.camel.itest.springboot.CamelZipkinTest</include>
-            <include>org.apache.camel.itest.springboot.CamelZookeeperTest</include>
+            <!--<include>org.apache.camel.itest.springboot.CamelNetty4Test</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelNettyHttpTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelNettyTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelOgnlTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelOlingo2Test</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelOpenshiftTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelOptaplannerTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelPahoTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelPdfTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelPgeventTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelPrinterTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelProtobufTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelQuartz2Test</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelQuartzTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelQuickfixTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelRabbitmqTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelRestletTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelRibbonTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelRmiTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelRouteboxTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelRssTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelRubyTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelRxTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSalesforceTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSapNetweaverTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSaxonTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelScalaTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSchematronTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelScriptTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelScrTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelServicenowTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelServletlistenerTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelServletTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelShiroTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSipTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSjmsTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSlackTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSmppTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSnakeyamlTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSnmpTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSoapTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSolrTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSparkRestTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSparkTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSplunkTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSpringBatchTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSpringBootTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSpringDmTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSpringIntegrationTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSpringJavaconfigTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSpringLdapTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSpringRedisTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSpringSecurityTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSpringTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSpringWsTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSqlTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSshTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelStaxTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelStompTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelStreamTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelStringtemplateTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSwaggerJavaTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelSyslogTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelTagsoupTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelTarfileTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelTelegramTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelTestngTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelTestTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelTwitterTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelUndertowTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelUnivocityParsersTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelUrlrewriteTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelVelocityTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelVertxTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelWeatherTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelWebsocketTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelXmlbeansTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelXmljsonTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelXmlrpcTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelXmlsecurityTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelXmppTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelXstreamTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelYammerTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelZipfileTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelZipkinTest</include>-->
+            <!--<include>org.apache.camel.itest.springboot.CamelZookeeperTest</include>-->
 
           </includes>
           <systemProperties>

http://git-wip-us.apache.org/repos/asf/camel/blob/7f351389/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 392ffa3..131254f 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
@@ -26,6 +26,7 @@ import java.security.PrivilegedAction;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -167,31 +168,57 @@ public final class ArquillianPackager {
 //        moduleDependencies.add(mainDep);
 
 
-        List<String> testProvidedDependencies = new LinkedList<>();
+        List<String> testProvidedDependenciesXml = new LinkedList<>();
         List<ScopeType> scopes = new LinkedList<>();
         if (config.getIncludeProvidedDependencies() || config.getIncludeTestDependencies()
|| config.getUnitTestEnabled()) {
 
             if (config.getIncludeTestDependencies() || config.getUnitTestEnabled()) {
-                testProvidedDependencies.addAll(DependencyResolver.getDependencies(config.getModuleBasePath()
+ "/pom.xml", ScopeType.TEST.toString()));
+                testProvidedDependenciesXml.addAll(DependencyResolver.getDependencies(config.getModuleBasePath()
+ "/pom.xml", ScopeType.TEST.toString()));
                 scopes.add(ScopeType.TEST);
             }
             if (config.getIncludeProvidedDependencies()) {
-                testProvidedDependencies.addAll(DependencyResolver.getDependencies(config.getModuleBasePath()
+ "/pom.xml", ScopeType.PROVIDED.toString()));
+                testProvidedDependenciesXml.addAll(DependencyResolver.getDependencies(config.getModuleBasePath()
+ "/pom.xml", ScopeType.PROVIDED.toString()));
                 scopes.add(ScopeType.PROVIDED);
             }
 
         }
 
-        List<String> cleanTestProvidedDependencies = new LinkedList<>();
-        for (String depXml : testProvidedDependencies) {
+        List<String> cleanTestProvidedDependenciesXml = new LinkedList<>();
+        for (String depXml : testProvidedDependenciesXml) {
             if (validTestDependency(config, depXml, commonExclusions)) {
                 depXml = enforceExclusions(config, depXml, commonExclusions);
-                depXml = addBOMVersionWhereMissing(config, depXml);
-                cleanTestProvidedDependencies.add(depXml);
+                //depXml = addBOMVersionWhereMissing(config, depXml);
+                cleanTestProvidedDependenciesXml.add(depXml);
             }
         }
 
-        File moduleSpringBootPom = createUserPom(config, cleanTestProvidedDependencies);
+        List<String> versionedTestProvidedDependenciesXml = new LinkedList<>();
+        if(!cleanTestProvidedDependenciesXml.isEmpty()) {
+
+            File testProvidedResolverPom = createResolverPom(config, cleanTestProvidedDependenciesXml);
+
+            List<MavenResolvedArtifact> artifacts = Arrays.asList(resolver(config)
+                    .loadPomFromFile(testProvidedResolverPom)
+                    .importDependencies(scopes.toArray(new ScopeType[0]))
+                    .resolve()
+                    .withoutTransitivity()
+                    .asResolvedArtifact());
+
+            Map<String, String> resolvedVersions = new HashMap<>();
+            for(MavenResolvedArtifact art : artifacts) {
+                String key = art.getCoordinate().getGroupId() + ":" + art.getCoordinate().getArtifactId();
+                String val = art.getCoordinate().getVersion();
+                resolvedVersions.put(key, val);
+            }
+
+            for(String dep : cleanTestProvidedDependenciesXml) {
+                dep = setResolvedVersion(config, dep, resolvedVersions);
+                versionedTestProvidedDependenciesXml.add(dep);
+            }
+
+        }
+
+        File moduleSpringBootPom = createUserPom(config, versionedTestProvidedDependenciesXml);
 
         List<ScopeType> resolvedScopes = new LinkedList<>();
         resolvedScopes.add(ScopeType.COMPILE);
@@ -254,6 +281,42 @@ public final class ArquillianPackager {
         return external.build();
     }
 
+    private static File createResolverPom(ITestConfig config, List<String> cleanTestProvidedDependencies)
throws Exception {
+
+        String pom;
+        try (InputStream pomTemplate = ArquillianPackager.class.getResourceAsStream("/dependency-resolver-pom.xml"))
{
+            pom = IOUtils.toString(pomTemplate);
+        }
+
+        StringBuilder dependencies = new StringBuilder();
+        for (String dep : cleanTestProvidedDependencies) {
+            dependencies.append(dep);
+            dependencies.append("\n");
+        }
+
+        pom = pom.replace("<!-- DEPENDENCIES -->", dependencies.toString());
+
+        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));
+        }
+
+        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 File createUserPom(ITestConfig config, List<String> cleanTestProvidedDependencies)
throws Exception {
 
         String pom;
@@ -297,25 +360,6 @@ public final class ArquillianPackager {
         return Maven.configureResolver().workOffline(config.getMavenOfflineResolution());
     }
 
-    public static void copyResource(String folder, String fileNameRegex, String targetFolder)
throws IOException {
-
-        final Pattern pattern = Pattern.compile(fileNameRegex);
-
-        File sourceFolder = new File(folder);
-        File[] candidates = sourceFolder.listFiles(new FilenameFilter() {
-            @Override
-            public boolean accept(File dir, String name) {
-                return pattern.matcher(name).matches();
-            }
-        });
-        if (candidates.length == 0) {
-            Assert.fail("No file matching regex " + fileNameRegex + " has been found");
-        }
-
-        File f = candidates[0];
-        FileUtils.copyFileToDirectory(f, new File(targetFolder));
-    }
-
     private static ClassLoader getExtensionClassloader() {
         ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
             @Override
@@ -368,20 +412,22 @@ public final class ArquillianPackager {
         return dependencyXml;
     }
 
-    private static String addBOMVersionWhereMissing(ITestConfig config, String dependencyXml)
throws Exception {
-
-        if (dependencyXml.contains("<version>")) {
-            return dependencyXml;
-        }
+    private static String setResolvedVersion(ITestConfig config, String dependencyXml, Map<String,
String> resolvedVersions) throws Exception {
 
         String groupId = textBetween(dependencyXml, "<groupId>", "</groupId>");
         String artifactId = textBetween(dependencyXml, "<artifactId>", "</artifactId>");
 
-        String version = DependencyResolver.resolveCamelParentBOMVersion(groupId, artifactId);
-        if (version != null) {
+        String resolvedVersion = resolvedVersions.get(groupId + ":" + artifactId);
+
+        if (!dependencyXml.contains("<version>")) {
             String after = "</artifactId>";
             int split = dependencyXml.indexOf(after) + after.length();
-            dependencyXml = dependencyXml.substring(0, split) + "<version>" + version
+ "</version>" + dependencyXml.substring(split);
+            dependencyXml = dependencyXml.substring(0, split) + "<version>" + resolvedVersion
+ "</version>" + dependencyXml.substring(split);
+        } else {
+            String versionTag = "<version>";
+            int split = dependencyXml.indexOf(versionTag) + versionTag.length();
+            int end = dependencyXml.indexOf("</version>");
+            dependencyXml = dependencyXml.substring(0, split) + resolvedVersion + dependencyXml.substring(end);
         }
 
         return dependencyXml;

http://git-wip-us.apache.org/repos/asf/camel/blob/7f351389/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/JarExporter.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/JarExporter.java
b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/JarExporter.java
index b68ac46..16bcc90 100644
--- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/JarExporter.java
+++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/util/JarExporter.java
@@ -32,7 +32,7 @@ public class JarExporter {
     public void exportJar() throws Exception {
 
         Archive<?> archive = ArquillianPackager.springBootPackage(new ITestConfigBuilder()
-                .module("camel-jetty9")
+                .module("camel-hbase")
                 .build());
 
         new ZipExporterImpl(archive).exportTo(new File("target/export.zip"), true);

http://git-wip-us.apache.org/repos/asf/camel/blob/7f351389/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 a651f21..8e0b3c2 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
@@ -25,7 +25,7 @@
     <version>1.0</version>
 
     <name>Spring-Boot Application</name>
-    <description>This a the base pom of spring-boot applications launched by the users</description>
+    <description>This is a the base pom of spring-boot applications launched by the
users</description>
 
     <dependencyManagement>
         <dependencies>

http://git-wip-us.apache.org/repos/asf/camel/blob/7f351389/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..f0e60e2
--- /dev/null
+++ b/tests/camel-itest-spring-boot/src/test/resources/dependency-resolver-pom.xml
@@ -0,0 +1,60 @@
+<?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-dependency-resolver</artifactId>
+    <version>1.0</version>
+
+    <name>Spring-Boot Dependency Resolver</name>
+    <description>This POM is used to resolve test and provided dependencies required
in integration tests</description>
+
+    <dependencyManagement>
+        <dependencies>
+
+            <dependency>
+                <!-- Then use camel dependency management -->
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-starter-parent</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+
+            <dependency>
+                <!-- Added as fallback for test and optional dependencies -->
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-parent</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+
+        <!-- DEPENDENCIES -->
+
+    </dependencies>
+
+</project>


Mime
View raw message