Repository: maven-integration-testing
Updated Branches:
  refs/heads/master ba586bb6b -> 38d24683a


[MNG-4463] Version ranges cannot be used for artifacts with 'import' scope

o Updated the test cases for MNG-2199 to support the updated
  log messages.
o Added some more MNG-4463 tests.


Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/38d24683
Tree: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/38d24683
Diff: 
http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/38d24683

Branch: refs/heads/master
Commit: 38d24683af5ce5ea9ec8c592ef892bdc0fd4583e
Parents: ba586bb
Author: Christian Schulte <schu...@apache.org>
Authored: Sat Jan 30 22:53:55 2016 +0100
Committer: Christian Schulte <schu...@apache.org>
Committed: Sat Jan 30 22:53:55 2016 +0100

----------------------------------------------------------------------
 .../MavenITmng2199ParentVersionRangeTest.java   | 21 ++++--
 ...DependencyManagementImportVersionRanges.java | 61 +++++++++++++++-
 .../mng-4463/exclusive-upper-bound/pom.xml      | 76 ++++++++++++++++++++
 .../mng-4463/inclusive-upper-bound/pom.xml      | 76 ++++++++++++++++++++
 .../resources/mng-4463/no-upper-bound/pom.xml   | 54 ++++++++++++++
 .../src/test/resources/mng-4463/pom.xml         | 76 --------------------
 6 files changed, 279 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/38d24683/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java
 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java
index a11bc99..9a5a03f 100644
--- 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java
+++ 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2199ParentVersionRangeTest.java
@@ -33,7 +33,9 @@ public class MavenITmng2199ParentVersionRangeTest
         throws Exception
     {
         Verifier verifier = null;
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-2199-parent-version-range/valid-inclusive-upper-bound" );
+        File testDir =
+            ResourceExtractor.simpleExtractResources( getClass(),
+                                                      
"/mng-2199-parent-version-range/valid-inclusive-upper-bound" );
 
         try
         {
@@ -57,7 +59,9 @@ public class MavenITmng2199ParentVersionRangeTest
         throws Exception
     {
         Verifier verifier = null;
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-2199-parent-version-range/valid-exclusive-upper-bound" );
+        File testDir =
+            ResourceExtractor.simpleExtractResources( getClass(),
+                                                      
"/mng-2199-parent-version-range/valid-exclusive-upper-bound" );
 
         try
         {
@@ -69,7 +73,9 @@ public class MavenITmng2199ParentVersionRangeTest
             verifier.verifyErrorFreeLog();
 
             final List<String> lines = verifier.loadFile( new File( testDir, 
"log.txt" ), false );
-            assertFalse( "Unxpected error message found.", indexOf( lines, 
".*Failed to build parent project.*" ) >= 0 );
+            assertFalse( "Unxpected error message found.",
+                         indexOf( lines, ".*Failed to build parent project.*" 
) >= 0 );
+
         }
         finally
         {
@@ -94,8 +100,9 @@ public class MavenITmng2199ParentVersionRangeTest
         catch ( final VerificationException e )
         {
             final List<String> lines = verifier.loadFile( new File( testDir, 
"log.txt" ), false );
-            int msg = indexOf( lines, ".*The requested version range.*does not 
specify an upper bound.*" );
-            assertTrue( "Expected error message not found.", msg >= 0 );
+            assertTrue( "Expected error message not found.",
+                        indexOf( lines, ".*(parent)? version range.*does not 
specify an upper bound.*" ) >= 0 );
+
         }
         finally
         {
@@ -167,7 +174,8 @@ public class MavenITmng2199ParentVersionRangeTest
         throws Exception
     {
         Verifier verifier = null;
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-2199-parent-version-range/local-parent" );
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(),
+                                                                 
"/mng-2199-parent-version-range/local-parent" );
 
         try
         {
@@ -198,4 +206,5 @@ public class MavenITmng2199ParentVersionRangeTest
 
         return -1;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/38d24683/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4463DependencyManagementImportVersionRanges.java
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4463DependencyManagementImportVersionRanges.java
 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4463DependencyManagementImportVersionRanges.java
index de64990..7a93869 100644
--- 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4463DependencyManagementImportVersionRanges.java
+++ 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4463DependencyManagementImportVersionRanges.java
@@ -17,6 +17,7 @@ package org.apache.maven.it;
 
 import java.io.File;
 import java.util.List;
+import java.util.regex.Pattern;
 import org.apache.maven.it.util.ResourceExtractor;
 import static junit.framework.Assert.assertTrue;
 
@@ -34,12 +35,26 @@ public class 
MavenITmng4463DependencyManagementImportVersionRanges
         super( "[3.4,)" );
     }
 
-    public void testCanImportDependencyManagementUsingVersionRanges()
+    public void testInclusiveUpperBoundResolvesToHighestVersion()
         throws Exception
     {
-        File testDir = ResourceExtractor.simpleExtractResources( getClass(), 
"/mng-4463" );
+        final File testDir = ResourceExtractor.simpleExtractResources( 
getClass(), "/mng-4463/inclusive-upper-bound" );
+        final Verifier verifier = newVerifier( testDir.getAbsolutePath(), 
"remote" );
+        verifier.setAutoclean( false );
+        verifier.deleteDirectory( "target" );
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
 
-        Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" );
+        final List<String> artifacts = verifier.loadLines( 
"target/compile.txt", "UTF-8" );
+        assertTrue( artifacts.toString(), artifacts.contains( 
"org.apache.maven:maven-plugin-api:jar:3.0" ) );
+    }
+
+    public void testExclusiveUpperBoundResolvesToHighestVersion()
+        throws Exception
+    {
+        final File testDir = ResourceExtractor.simpleExtractResources( 
getClass(), "/mng-4463/exclusive-upper-bound" );
+        final Verifier verifier = newVerifier( testDir.getAbsolutePath(), 
"remote" );
         verifier.setAutoclean( false );
         verifier.deleteDirectory( "target" );
         verifier.executeGoal( "validate" );
@@ -50,4 +65,44 @@ public class 
MavenITmng4463DependencyManagementImportVersionRanges
         assertTrue( artifacts.toString(), artifacts.contains( 
"org.apache.maven:maven-plugin-api:jar:3.0" ) );
     }
 
+    public void testFailureWithoutUpperBound()
+        throws Exception
+    {
+        final File testDir = ResourceExtractor.simpleExtractResources( 
getClass(), "/mng-4463/no-upper-bound" );
+        final Verifier verifier = newVerifier( testDir.getAbsolutePath(), 
"remote" );
+
+        try
+        {
+            verifier.setAutoclean( false );
+            verifier.deleteDirectory( "target" );
+            verifier.executeGoal( "validate" );
+            fail( "Expected 'VerificationException' not thrown." );
+        }
+        catch ( final VerificationException e )
+        {
+            final List<String> lines = verifier.loadFile( new File( testDir, 
"log.txt" ), false );
+            assertTrue( "Expected error message not found.",
+                        indexOf( lines, ".*dependency version range.*does not 
specify an upper bound.*" ) >= 0 );
+        }
+        finally
+        {
+            verifier.resetStreams();
+        }
+    }
+
+    private static int indexOf( final List<String> logLines, final String 
regex )
+    {
+        final Pattern pattern = Pattern.compile( regex );
+
+        for ( int i = 0, l0 = logLines.size(); i < l0; i++ )
+        {
+            if ( pattern.matcher( logLines.get( i ) ).matches() )
+            {
+                return i;
+            }
+        }
+
+        return -1;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/38d24683/core-it-suite/src/test/resources/mng-4463/exclusive-upper-bound/pom.xml
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/resources/mng-4463/exclusive-upper-bound/pom.xml 
b/core-it-suite/src/test/resources/mng-4463/exclusive-upper-bound/pom.xml
new file mode 100644
index 0000000..54404ac
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-4463/exclusive-upper-bound/pom.xml
@@ -0,0 +1,76 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng4463</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: MNG-4463</name>
+  <description>
+    Tests that importing dependency management using version ranges
+    with exclusive upper bound resolves to the highest version.
+  </description>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven</artifactId>
+        <version>(,3.0.1)</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-dependency-resolution</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <compileArtifacts>target/compile.txt</compileArtifacts>
+        </configuration>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>compile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/38d24683/core-it-suite/src/test/resources/mng-4463/inclusive-upper-bound/pom.xml
----------------------------------------------------------------------
diff --git 
a/core-it-suite/src/test/resources/mng-4463/inclusive-upper-bound/pom.xml 
b/core-it-suite/src/test/resources/mng-4463/inclusive-upper-bound/pom.xml
new file mode 100644
index 0000000..0e91b01
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-4463/inclusive-upper-bound/pom.xml
@@ -0,0 +1,76 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng4463</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: MNG-4463</name>
+  <description>
+    Tests that importing dependency management using version ranges
+    with inclusive upper bound resolves to the highest version.
+  </description>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven</artifactId>
+        <version>(,3.0]</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.plugins</groupId>
+        <artifactId>maven-it-plugin-dependency-resolution</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <configuration>
+          <compileArtifacts>target/compile.txt</compileArtifacts>
+        </configuration>
+        <executions>
+          <execution>
+            <id>test</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>compile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/38d24683/core-it-suite/src/test/resources/mng-4463/no-upper-bound/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-4463/no-upper-bound/pom.xml 
b/core-it-suite/src/test/resources/mng-4463/no-upper-bound/pom.xml
new file mode 100644
index 0000000..53ec4e3
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-4463/no-upper-bound/pom.xml
@@ -0,0 +1,54 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.mng4463</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: MNG-4463</name>
+  <description>
+    Tests that importing dependency management using version ranges
+    without upper bound fails.
+  </description>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.maven</groupId>
+        <artifactId>maven</artifactId>
+        <version>(3.0,)</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+    </dependency>
+  </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/38d24683/core-it-suite/src/test/resources/mng-4463/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-4463/pom.xml 
b/core-it-suite/src/test/resources/mng-4463/pom.xml
deleted file mode 100644
index 84a078d..0000000
--- a/core-it-suite/src/test/resources/mng-4463/pom.xml
+++ /dev/null
@@ -1,76 +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>
-  <modelVersion>4.0.0</modelVersion>
-
-  <groupId>org.apache.maven.its.mng4463</groupId>
-  <artifactId>test</artifactId>
-  <version>1.0</version>
-  <packaging>jar</packaging>
-
-  <name>Maven Integration Test :: MNG-4463</name>
-  <description>
-    Tests that importing dependency management using version ranges
-    resolves to the highest version.
-  </description>
-
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.apache.maven</groupId>
-        <artifactId>maven</artifactId>
-        <version>(,3.0]</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-plugin-api</artifactId>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.its.plugins</groupId>
-        <artifactId>maven-it-plugin-dependency-resolution</artifactId>
-        <version>2.1-SNAPSHOT</version>
-        <configuration>
-          <compileArtifacts>target/compile.txt</compileArtifacts>
-        </configuration>
-        <executions>
-          <execution>
-            <id>test</id>
-            <phase>validate</phase>
-            <goals>
-              <goal>compile</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>

Reply via email to