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.verifyErrorFreeLog();
verifier.resetStreams(); verifier.resetStreams();
// check expected profiles activated, just for sanity // check expected profiles activated, just for sanity (or build should have failed, given other profiles)
Properties props = verifier.loadProperties( "target/project.properties" ); assertFileExists( testDir, "target/exists-basedir" );
assertEquals( "expected profile exists-basedir", "expected active profile", assertFileExists( testDir, "target/mng-5608-missing-project.basedir" );
props.getProperty( "exists-basedir" ) );
assertEquals( "expected profile mng-5608-missing-project.basedir", "expected active profile",
props.getProperty( "mng-5608-missing-project.basedir" ) );
// check that the 2 profiles using ${project.basedir} caused warnings // check that the 2 profiles using ${project.basedir} caused warnings
List<String> logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); 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" ) ); 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 ) 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 + ": .*" ); 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> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.its.plugins</groupId> <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> <version>2.1-SNAPSHOT</version>
<executions> <executions>
<execution> <execution>
<phase>validate</phase> <phase>validate</phase>
<goals> <goals>
<goal>generate-properties</goal> <goal>touch</goal>
</goals> </goals>
</execution> </execution>
</executions> </executions>
@ -61,7 +61,6 @@ under the License.
<plugin> <plugin>
<groupId>org.apache.maven.its.plugins</groupId> <groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-touch</artifactId> <artifactId>maven-it-plugin-touch</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration> <configuration>
<fail>true</fail><!-- this profile should not be activated --> <fail>true</fail><!-- this profile should not be activated -->
</configuration> </configuration>
@ -76,9 +75,17 @@ under the License.
<missing>${project.basedir}/pom.xml</missing> <missing>${project.basedir}/pom.xml</missing>
</file> </file>
</activation> </activation>
<properties> <build>
<mng-5608-missing-project.basedir>expected active profile</mng-5608-missing-project.basedir> <plugins>
</properties> <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> </profile>
<!-- for reference: ${basedir} supported for profile activation, see MNG-2363 --> <!-- for reference: ${basedir} supported for profile activation, see MNG-2363 -->
@ -89,9 +96,17 @@ under the License.
<exists>${basedir}/pom.xml</exists> <exists>${basedir}/pom.xml</exists>
</file> </file>
</activation> </activation>
<properties> <build>
<exists-basedir>expected active profile</exists-basedir> <plugins>
</properties> <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>
<profile> <profile>
<id>missing-basedir</id> <id>missing-basedir</id>
@ -105,7 +120,6 @@ under the License.
<plugin> <plugin>
<groupId>org.apache.maven.its.plugins</groupId> <groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-touch</artifactId> <artifactId>maven-it-plugin-touch</artifactId>
<version>2.1-SNAPSHOT</version>
<configuration> <configuration>
<fail>true</fail><!-- this profile should not be activated --> <fail>true</fail><!-- this profile should not be activated -->
</configuration> </configuration>