[MNG-5840] Add tests for when the parent version is a range.

Maven 3.3.0 through 3.3.3 are expected to have the following tests fail:

```
mng5840ParentVersionRanges(ParentRangeRelativePathPointsToWrongVersion)
mng5840ParentVersionRanges(ParentRangeRelativePathPointsToCorrectVersion)
mng5840RelativePathReactorMatching(RelativePathPointsToWrongVersion)
```

Maven 3.3.4 through 3.3.5 are expected to have the following tests fail:

```
mng5840ParentVersionRanges(ParentRangeRelativePathPointsToWrongVersion)
mng5840ParentVersionRanges(ParentRangeRelativePathPointsToCorrectVersion)
```

As of 25f5143169d39075cee67d9f4d11649cce0fafa0 in the Maven core repo the following
test results are expected and observed:

```
mng2199ParentVersionRange(ValidParentVersionRangeWithInclusiveUpperBound)OK (3.3 s)
mng2199ParentVersionRange(ValidParentVersionRangeWithExclusiveUpperBound)OK (1.7 s)
mng2199ParentVersionRange(InvalidParentVersionRange)........OK (0.7 s)
mng2199ParentVersionRange(ValidParentVersionRangeInvalidVersionExpression)OK (0.4 s)
mng2199ParentVersionRange(ValidParentVersionRangeInvalidVersionInheritance)OK (0.5 s)
mng2199ParentVersionRange(ValidLocalParentVersionRange).....OK (0.4 s)
mng5840ParentVersionRanges(ParentRangeRelativePathPointsToWrongVersion)FAILURE (0.4 s)
mng5840ParentVersionRanges(ParentRangeRelativePathPointsToCorrectVersion)OK (0.4 s)
mng5840RelativePathReactorMatching(RelativePathPointsToWrongVersion)OK (0.4 s)
```

With the one failure: mng5840ParentVersionRanges(ParentRangeRelativePathPointsToWrongVersion) expected
as the rumoured [validation in the workspace resolver](25f5143169/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java (L938)) does not actually exist.
This commit is contained in:
Stephen Connolly 2015-07-22 09:26:40 +01:00
parent 0d2b1d1b5c
commit 7ab01081d9
8 changed files with 182 additions and 2 deletions

View File

@ -0,0 +1,47 @@
package org.apache.maven.it;
import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
public class MavenITmng5840ParentVersionRanges
extends AbstractMavenIntegrationTestCase
{
public MavenITmng5840ParentVersionRanges()
{
super( "[3.3,)" );
}
public void testParentRangeRelativePathPointsToWrongVersion()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5840-relative-path-range-negative" );
Verifier verifier = newVerifier( new File( testDir, "parent-1" ).getAbsolutePath(), "remote" );
verifier.executeGoal( "install" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath(), "remote" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}
public void testParentRangeRelativePathPointsToCorrectVersion()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5840-relative-path-range-positive" );
Verifier verifier = newVerifier( new File( testDir, "parent-1" ).getAbsolutePath(), "remote" );
verifier.executeGoal( "install" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier = newVerifier( new File( testDir, "child" ).getAbsolutePath(), "remote" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}
}

View File

@ -12,7 +12,7 @@ public MavenITmng5840RelativePathReactorMatching()
super( ALL_MAVEN_VERSIONS );
}
public void testPkgTypeMojoConfiguration()
public void testRelativePathPointsToWrongVersion()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5840-relative-path-reactor-matching" );
@ -27,5 +27,4 @@ public void testPkgTypeMojoConfiguration()
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}
}

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>mng-5840-relative-path-negative</groupId>
<artifactId>parent</artifactId>
<version>[1,2)</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>child</artifactId>
<version>1-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<inherited>false</inherited>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<alwaysFail/>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mng-5840-relative-path-negative</groupId>
<artifactId>parent</artifactId>
<version>1</version>
<packaging>pom</packaging>
<properties>
<enforcer.skip>true</enforcer.skip>
</properties>
</project>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mng-5840-relative-path-negative</groupId>
<artifactId>parent</artifactId>
<version>3-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<!--<enforcer.skip>true</enforcer.skip>-->
</properties>
</project>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>mng-5840-relative-path-positive</groupId>
<artifactId>parent</artifactId>
<version>[1.5,3-SNAPSHOT)</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>child</artifactId>
<version>1-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<inherited>false</inherited>
<phase>validate</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<alwaysFail/>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mng-5840-relative-path-positive</groupId>
<artifactId>parent</artifactId>
<version>1</version>
<packaging>pom</packaging>
<properties>
<!-- <enforcer.skip>true</enforcer.skip> -->
</properties>
</project>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mng-5840-relative-path-positive</groupId>
<artifactId>parent</artifactId>
<version>2-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<enforcer.skip>true</enforcer.skip>
</properties>
</project>