Skip to content

Commit

Permalink
[MNG-6057], [MNG-6090], [MNG-5895]
Browse files Browse the repository at this point in the history
 o Added IT's for MNG-5895, MNG-6057, MNG-6090
 o Added flatten-maven-plugin for usage during
   the IT's.
  • Loading branch information
khmarbaise committed Mar 13, 2017
1 parent c68f707 commit dec1deb
Show file tree
Hide file tree
Showing 20 changed files with 884 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -11,3 +11,4 @@ bin
.DS_Store
.idea
jvz-*
.flattened-pom.xml
Expand Up @@ -106,6 +106,9 @@ public static Test suite()
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137

suite.addTestSuite( MavenITmng6057CheckReactorOrderTest.class );
suite.addTestSuite( MavenITmng5895CIFriendlyUsageWithPropertyTest.class );
suite.addTestSuite( MavenITmng6090CIFriendlyTest.class );
suite.addTestSuite( MavenITmng6173GetProjectsAndDependencyGraphTest.class );
suite.addTestSuite( MavenITmng6173GetAllProjectsInReactorTest.class );
suite.addTestSuite( MavenITmng5958LifecyclePhaseBinaryCompat.class );
Expand Down
@@ -0,0 +1,70 @@
package org.apache.maven.it;

/*
* 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.
*/

import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;

import java.io.File;

/**
* The usage of a <code>${revision}</code> for the version in the pom file and furthermore
* defining the property in the pom file and overwrite it via command line.
* <a href="https://issues.apache.org/jira/browse/MNG-5895">MNG-5895</a>.
*
* This will result in a failure without the fix for this issue.
*
* @author Karl Heinz Marbaise khmarbaise@apache.org
*/
public class MavenITmng5895CIFriendlyUsageWithPropertyTest
extends AbstractMavenIntegrationTestCase
{

public MavenITmng5895CIFriendlyUsageWithPropertyTest()
{
// The first version which contains the fix for the MNG-issue.
// TODO: Think about it!
super( "[3.5.0-alpha-2,)" );
}

/**
* Check that the resulting run will not fail in case
* of defining the property via command line which is
* already defined inside the pom.
*/
public void testitShouldResolveTheDependencies()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5895-ci-friendly-usage-with-property" );

Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
verifier.setMavenDebug( false );
verifier.setAutoclean( false );

//verifier.setLogFileName( "log-only.txt" );
verifier.addCliOption( "-Drevision=1.2" );
verifier.executeGoal( "clean" );
verifier.executeGoal( "package" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();

}

}
@@ -0,0 +1,119 @@
package org.apache.maven.it;

/*
* 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.
*/

import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;

import java.io.File;
import java.util.LinkedList;
import java.util.List;

/**
* Using a <code>${revision}</code> in the version will change the reactor order before fixing
* <a href="https://issues.apache.org/jira/browse/MNG-6057">MNG-6057</a>. Without the fix for this issue the order of
* the reactor is changed in that way that the parent is ordered to the last position instead of the first position.
*
* @author Karl Heinz Marbaise khmarbaise@apache.org
*/
public class MavenITmng6057CheckReactorOrderTest
extends AbstractMavenIntegrationTestCase
{

public MavenITmng6057CheckReactorOrderTest()
{
// The first version which contains the fix for the MNG-6057 issue.
// TODO: Think about it!
super( "[3.5.0-alpha-2,)" );
}

/**
* Verify that the result shows the reactor order as expected.
*/
public void testitReactorShouldResultInExpectedOrder()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6057-check-reactor-order" );

Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
verifier.setMavenDebug( false );
verifier.setAutoclean( false );

verifier.setLogFileName( "log-only.txt" );
verifier.addCliOption( "-Drevision=1.3.0-SNAPSHOT" );
verifier.executeGoal( "clean" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();

List<String> loadedLines = verifier.loadLines( "log-only.txt", "UTF-8" );
List<String> resultingLines = extractReactorBuildOrder( loadedLines );

// We expecting exactly three lines as result.
assertEquals( 3, resultingLines.size() );

// We expect those lines in the following exact order.
assertEquals( "[INFO] base-project", resultingLines.get( 0 ) );
assertEquals( "[INFO] module-1", resultingLines.get( 1 ) );
assertEquals( "[INFO] module-2", resultingLines.get( 2 ) );
}

/**
* Extract the lines at the beginning of the Maven output:
*
* <pre>
* [INFO] Reactor Build Order:
* [INFO]
* [INFO] module-1
* [INFO] module-2
* [INFO] base-project
* [INFO]
* </pre>
*/
private List<String> extractReactorBuildOrder( List<String> loadedLines )
{
List<String> resultingLines = new LinkedList<String>();
boolean start = false;
for ( String line : loadedLines )
{
if ( start )
{
if ( line.startsWith( "[INFO] ----------------------------" ) )
{
start = false;
}
else if ( !line.endsWith( "[INFO] " ) )
{
resultingLines.add( line );
}
}
else
{
if ( line.startsWith( "[INFO] Reactor Build Order:" ) )
{
start = true;
}

}
}
return resultingLines;

}

}
@@ -0,0 +1,80 @@
package org.apache.maven.it;

/*
* 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.
*/

import org.apache.maven.it.Verifier;
import org.apache.maven.it.util.ResourceExtractor;

import java.io.File;
import java.util.Arrays;

/**
* The usage of a <code>${revision}</code> for the version in the pom file and furthermore
* defining the property in the pom file and overwrite it via command line and
* try to build a partial reactor via <code>mvn -pl ..</code>
* <a href="https://issues.apache.org/jira/browse/MNG-6090">MNG-6090</a>.
*
* @author Karl Heinz Marbaise khmarbaise@apache.org
*/
public class MavenITmng6090CIFriendlyTest
extends AbstractMavenIntegrationTestCase
{

public MavenITmng6090CIFriendlyTest()
{
// The first version which contains the fix for the MNG-issue.
// TODO: Think about it!
super( "[3.5.0-alpha-2,)" );
}

/**
* Check that the resulting run will not fail in case
* of defining the property via command line and
* install the projects and afterwards just build
* a part of the whole reactor.
*/
public void testitShouldResolveTheDependencies()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6090-ci-friendly" );

Verifier verifier = newVerifier( testDir.getAbsolutePath(), false );
verifier.setMavenDebug( false );
verifier.setAutoclean( false );

verifier.addCliOption( "-Drevision=1.2" );
verifier.setLogFileName( "install-log.txt" );
verifier.executeGoals( Arrays.asList( "clean", "install" ) );
verifier.verifyErrorFreeLog();
verifier.resetStreams();

verifier = newVerifier( testDir.getAbsolutePath(), false );
verifier.setMavenDebug( false );
verifier.setAutoclean( false );

verifier.addCliOption( "-Drevision=1.2" );
verifier.addCliOption( "-pl module-3" );
verifier.executeGoal( "package" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();

}

}
72 changes: 72 additions & 0 deletions core-it-suite/src/test/resources/bootstrap/group-6/pom.xml
Expand Up @@ -88,5 +88,77 @@ under the License.
<version>3.1</version>
<scope>runtime</scope>
</dependency>
<!-- IT MNG-6057 -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings-builder</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-repository-metadata</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-aether-provider</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-spi</artifactId>
<version>0.9.0.M2</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-impl</artifactId>
<version>0.9.0.M2</version>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
<version>0.0.0.M5</version>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.inject</artifactId>
<version>0.0.0.M5</version>
</dependency>
<dependency>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guice</artifactId>
<version>3.1.0</version>
<classifier>no_aop</classifier>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>10.0.1</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>1.3.9</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.1</version>
</dependency>
</dependencies>
</project>
10 changes: 10 additions & 0 deletions core-it-suite/src/test/resources/bootstrap/pom.xml
Expand Up @@ -88,6 +88,16 @@ under the License.
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down

0 comments on commit dec1deb

Please sign in to comment.