Added IT for MNG-5230 exclude projects from reactor

This commit is contained in:
Luuk van den Broek 2013-12-24 16:27:09 +09:00 committed by Robert Scholte
parent 00f6d87734
commit 7a0fae76ce
7 changed files with 486 additions and 1 deletions

View File

@ -109,13 +109,14 @@ public static Test suite()
suite.addTestSuite( MavenITmng5530MojoExecutionScopeTest.class );
//suite.addTestSuite( MavenITmng5208EventSpyParallelTest.class );
suite.addTestSuite( MavenITmng5482AetherNotFoundTest.class );
suite.addTestSuite( MavenITmng5445LegacyStringSearchModelInterpolatorTest.class );
suite.addTestSuite( MavenITmng5387ArtifactReplacementPlugin.class );
suite.addTestSuite( MavenITmng5382Jsr330Plugin.class );
suite.addTestSuite( MavenITmng5338FileOptionToDirectory.class );
suite.addTestSuite( MavenITmng5280SettingsProfilesRepositoriesOrderTest.class );
suite.addTestSuite( MavenITmng5230MakeReactorWithExcludesTest.class );
suite.addTestSuite( MavenITmng5224InjectedSettings.class );
suite.addTestSuite( MavenITmng5214DontMapWsdlToJar.class );
suite.addTestSuite( MavenITmng5137ReactorResolutionInForkedBuildTest.class );

View File

@ -0,0 +1,259 @@
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;
/**
* Test case adapted from MNG-2576
* @author Luuk van den Broek
*/
public class MavenITmng5230MakeReactorWithExcludesTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng5230MakeReactorWithExcludesTest()
{
super( "[2.1.0,)" );
}
private void clean( Verifier verifier )
throws Exception
{
verifier.deleteDirectory( "target" );
verifier.deleteDirectory( "sub-a/target" );
verifier.deleteDirectory( "sub-b/target" );
verifier.deleteDirectory( "sub-c/target" );
verifier.deleteDirectory( "sub-d/target" );
}
/**
* Verify that project list exclusion by itself is not built
*/
public void testitMakeWithExclude()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
clean( verifier );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "!sub-b" );
verifier.setLogFileName( "log-only.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFilePresent( "target/touch.txt" );
verifier.assertFilePresent( "sub-a/target/touch.txt" );
verifier.assertFileNotPresent( "sub-b/target/touch.txt" );
verifier.assertFilePresent( "sub-c/target/touch.txt" );
verifier.assertFilePresent( "sub-d/target/touch.txt" );
}
/**
* Verify that that exclusion happens on upstream projects.
*/
public void testitMakeUpstreamExclude()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
clean( verifier );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "sub-b,!sub-a" );
verifier.addCliOption( "-am" );
verifier.setLogFileName( "log-upstream.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFilePresent( "target/touch.txt" );
verifier.assertFileNotPresent( "sub-a/target/touch.txt" );
verifier.assertFilePresent( "sub-b/target/touch.txt" );
verifier.assertFileNotPresent( "sub-c/target/touch.txt" );
verifier.assertFileNotPresent( "sub-d/target/touch.txt" );
}
/**
* Verify that project list and all their downstream projects are built.
*/
public void testitMakeDownstreamExclude()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
clean( verifier );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "sub-b,!sub-c" );
verifier.addCliOption( "-amd" );
verifier.setLogFileName( "log-downstream.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFileNotPresent( "target/touch.txt" );
verifier.assertFileNotPresent( "sub-a/target/touch.txt" );
verifier.assertFilePresent( "sub-b/target/touch.txt" );
verifier.assertFileNotPresent( "sub-c/target/touch.txt" );
verifier.assertFileNotPresent( "sub-d/target/touch.txt" );
}
/**
* Verify project exclusion when also building upstream and downstream projects are built.
*/
public void testitMakeBothExclude()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
clean( verifier );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "sub-b,!sub-a" );
verifier.addCliOption( "-am" );
verifier.addCliOption( "-amd" );
verifier.setLogFileName( "log-both.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFilePresent( "target/touch.txt" );
verifier.assertFileNotPresent( "sub-a/target/touch.txt" );
verifier.assertFilePresent( "sub-b/target/touch.txt" );
verifier.assertFilePresent( "sub-c/target/touch.txt" );
verifier.assertFileNotPresent( "sub-d/target/touch.txt" );
}
/**
* Verify that using the basedir for exclusion in the project list matches projects with non-default POM files.
*/
public void testitMatchesByBasedirExclude()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
clean( verifier );
verifier.assertFileNotPresent( "sub-d/pom.xml" );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "!sub-d" );
verifier.setLogFileName( "log-basedir.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFilePresent( "target/touch.txt" );
verifier.assertFilePresent( "sub-a/target/touch.txt" );
verifier.assertFilePresent( "sub-b/target/touch.txt" );
verifier.assertFilePresent( "sub-c/target/touch.txt" );
verifier.assertFileNotPresent( "sub-d/target/touch.txt" );
}
/**
* Verify that the project list can also specify project ids for exclusion
*/
public void testitMatchesByIdExclude()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
clean( verifier );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "!org.apache.maven.its.mng5230:sub-b" );
verifier.setLogFileName( "log-id.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFilePresent( "target/touch.txt" );
verifier.assertFilePresent( "sub-a/target/touch.txt" );
verifier.assertFileNotPresent( "sub-b/target/touch.txt" );
verifier.assertFilePresent( "sub-c/target/touch.txt" );
verifier.assertFilePresent( "sub-d/target/touch.txt" );
}
/**
* Verify that the project list exclude can also specify aritfact ids.
*/
public void testitMatchesByArtifactIdExclude()
throws Exception
{
// as per MNG-4244
requiresMavenVersion( "[3.0-alpha-3,)" );
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
clean( verifier );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "!:sub-b" );
verifier.setLogFileName( "log-artifact-id.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFilePresent( "target/touch.txt" );
verifier.assertFilePresent( "sub-a/target/touch.txt" );
verifier.assertFileNotPresent( "sub-b/target/touch.txt" );
verifier.assertFilePresent( "sub-c/target/touch.txt" );
verifier.assertFilePresent( "sub-d/target/touch.txt" );
}
/**
* Verify that reactor is resumed from specified project with exclude
*/
public void testitResumeFromExclude()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5230" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
clean( verifier );
verifier.addCliOption( "-rf" );
verifier.addCliOption( "sub-b" );
verifier.addCliOption( "-pl" );
verifier.addCliOption( "!sub-c" );
verifier.setLogFileName( "log-resume.txt" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFileNotPresent( "target/touch.txt" );
verifier.assertFileNotPresent( "sub-a/target/touch.txt" );
verifier.assertFilePresent( "sub-b/target/touch.txt" );
verifier.assertFileNotPresent( "sub-c/target/touch.txt" );
verifier.assertFilePresent( "sub-d/target/touch.txt" );
}
}

View File

@ -0,0 +1,61 @@
<?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.mng5230</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Maven Integration Test :: MNG-5230</name>
<description>Test make-like reactor mode includes and excludes.</description>
<modules>
<module>sub-a</module>
<module>sub-b</module>
<module>sub-c</module>
<module>sub-d/pom-special.xml</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<logFile>target/touch.txt</logFile>
</configuration>
<executions>
<execution>
<id>test</id>
<phase>validate</phase>
<goals>
<goal>reset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,37 @@
<?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>
<parent>
<groupId>org.apache.maven.its.mng5230</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.its.mng5230</groupId>
<artifactId>sub-a</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-5230 :: Project A</name>
</project>

View File

@ -0,0 +1,45 @@
<?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>
<parent>
<groupId>org.apache.maven.its.mng5230</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.its.mng5230</groupId>
<artifactId>sub-b</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-5230 :: Project B</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng5230</groupId>
<artifactId>sub-a</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,45 @@
<?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>
<parent>
<groupId>org.apache.maven.its.mng5230</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.its.mng5230</groupId>
<artifactId>sub-c</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-5230 :: Project C</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.its.mng5230</groupId>
<artifactId>sub-b</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,37 @@
<?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>
<parent>
<groupId>org.apache.maven.its.mng5230</groupId>
<artifactId>parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.its.mng5230</groupId>
<artifactId>sub-d</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven Integration Test :: MNG-5230 :: Project D</name>
</project>