Skip to content

Commit

Permalink
[MNG-5840] Add tests for when the parent version is a range.
Browse files Browse the repository at this point in the history
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](https://github.com/apache/maven/blob/25f5143169d39075cee67d9f4d11649cce0fafa0/maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java#L938) does not actually exist.
  • Loading branch information
stephenc committed Jul 22, 2015
1 parent b015e1c commit f2d3d7a
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 2 deletions.
@@ -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();
}

}
Expand Up @@ -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" );
Expand All @@ -27,5 +27,4 @@ public void testPkgTypeMojoConfiguration()
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}

}
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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>

0 comments on commit f2d3d7a

Please sign in to comment.