use touch plugin for every checks

This commit is contained in:
Hervé Boutemy 2014-06-01 17:46:57 +02:00
parent 68979ecc30
commit 436f79079c
2 changed files with 33 additions and 16 deletions

View File

@ -50,12 +50,9 @@ public class MavenITmng5608ProfileActivationWarningTest
verifier.verifyErrorFreeLog();
verifier.resetStreams();
// check expected profiles activated, just for sanity
Properties props = verifier.loadProperties( "target/project.properties" );
assertEquals( "expected profile exists-basedir", "expected active profile",
props.getProperty( "exists-basedir" ) );
assertEquals( "expected profile mng-5608-missing-project.basedir", "expected active profile",
props.getProperty( "mng-5608-missing-project.basedir" ) );
// check expected profiles activated, just for sanity (or build should have failed, given other profiles)
assertFileExists( testDir, "target/exists-basedir" );
assertFileExists( testDir, "target/mng-5608-missing-project.basedir" );
// check that the 2 profiles using ${project.basedir} caused warnings
List<String> logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
@ -63,6 +60,12 @@ public class MavenITmng5608ProfileActivationWarningTest
assertNotNull( findWarning( logFile, "mng-5608-missing-project.basedir" ) );
}
private void assertFileExists( File dir, String filename )
{
File file = new File( dir, filename );
assertTrue( "expected file: " + file , file.exists() );
}
private String findWarning( List<String> logLines, String profileId )
{
Pattern pattern = Pattern.compile( "(?i).*Failed to interpolate file location ..project.basedir./pom.xml for profile " + profileId + ": .*" );

View File

@ -33,13 +33,13 @@ under the License.
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-uses-properties</artifactId>
<artifactId>maven-it-plugin-touch</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>generate-properties</goal>
<goal>touch</goal>
</goals>
</execution>
</executions>
@ -61,7 +61,6 @@ under the License.
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-touch</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<fail>true</fail><!-- this profile should not be activated -->
</configuration>
@ -76,9 +75,17 @@ under the License.
<missing>${project.basedir}/pom.xml</missing>
</file>
</activation>
<properties>
<mng-5608-missing-project.basedir>expected active profile</mng-5608-missing-project.basedir>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-touch</artifactId>
<configuration>
<pluginItem>mng-5608-missing-project.basedir</pluginItem>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!-- for reference: ${basedir} supported for profile activation, see MNG-2363 -->
@ -89,9 +96,17 @@ under the License.
<exists>${basedir}/pom.xml</exists>
</file>
</activation>
<properties>
<exists-basedir>expected active profile</exists-basedir>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-touch</artifactId>
<configuration>
<goalItem>exists-basedir</goalItem>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>missing-basedir</id>
@ -105,7 +120,6 @@ under the License.
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-touch</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration>
<fail>true</fail><!-- this profile should not be activated -->
</configuration>