it test for MNG-5418

This commit is contained in:
olivier lamy 2013-01-05 09:40:04 +01:00
parent cf5f33a3ac
commit 39e76295a0
3 changed files with 223 additions and 0 deletions

View File

@ -0,0 +1,62 @@
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.util.ResourceExtractor;
import java.io.File;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-5481">MNG-5418</a>.
*
* @author Olivier Lamy
*/
public class MavenITmng5418FileProjectPropertiesActivatorTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng5418FileProjectPropertiesActivatorTest()
{
super( "[3.1,)" );
}
/**
* Test that the file-based profile activator resolves project properties.
*/
public void testit()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5418" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFilePresent( "target/path1.txt" );
verifier.assertFilePresent( "target/file1.txt" );
verifier.assertFilePresent( "target/missing1.txt" );
verifier.assertFileNotPresent( "target/missing2.txt" );
}
}

View File

@ -0,0 +1,161 @@
<?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.mng5418</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
<packaging>pom</packaging>
<name>Maven Integration Test :: MNG-5418</name>
<description>
Test that the file-based profile activator resolves file path with project properties.
</description>
<properties>
<site.base.path>${basedir}</site.base.path>
<site.final.path>${site.base.path}/sub1</site.final.path>
<site.final.file>${site.base.path}/sub1/foo.txt</site.final.file>
<site.final.path.not>${site.base.path}/sub2</site.final.path.not>
</properties>
<profiles>
<profile>
<id>path-1</id>
<activation>
<file>
<exists>${site.final.path}</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test-1</id>
<phase>validate</phase>
<configuration>
<logFile>target/path1.txt</logFile>
</configuration>
<goals>
<goal>reset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>file-1</id>
<activation>
<file>
<exists>${site.final.file}</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test-2</id>
<phase>validate</phase>
<configuration>
<logFile>target/file1.txt</logFile>
</configuration>
<goals>
<goal>reset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>missing-1</id>
<activation>
<file>
<missing>${site.final.path.not}</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test-3</id>
<phase>validate</phase>
<configuration>
<logFile>target/missing1.txt</logFile>
</configuration>
<goals>
<goal>reset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>missing-2</id>
<activation>
<file>
<exists>${site.final.path.not}</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-log-file</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test-4</id>
<phase>validate</phase>
<configuration>
<logFile>target/missing2.txt</logFile>
</configuration>
<goals>
<goal>reset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>