mirror of https://github.com/apache/maven.git
Integration test for MNG-4565 where we move from multiple activators being AND'd instead of OR'd.
This commit is contained in:
parent
e39582a1a0
commit
a13035fa88
|
@ -35,7 +35,7 @@ public class MavenITmng3106ProfileMultipleActivatorsTest
|
|||
{
|
||||
public MavenITmng3106ProfileMultipleActivatorsTest()
|
||||
{
|
||||
super( "(2.0.9,)" );
|
||||
super( "(2.0.9,3.2.2-SNAPSHOT]" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 java.io.File;
|
||||
|
||||
import org.apache.maven.it.Verifier;
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
/**
|
||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4565">MNG-3106</a>:
|
||||
*
|
||||
* When multiple activators are present in a profile they should be AND'd. All activator must
|
||||
* conditions must be satisfied in order for the profile to be activated.
|
||||
*/
|
||||
public class MavenITmng4565MultiConditionProfileActivationTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
public MavenITmng4565MultiConditionProfileActivationTest()
|
||||
{
|
||||
super( "(3.2.2-SNAPSHOT,)" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test build with two profiles, each with more than one activator.
|
||||
* The profiles should be activated even though only one of the activators
|
||||
* returns true.
|
||||
*
|
||||
*/
|
||||
public void testProfilesWithMultipleActivators()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4565-multi-condition-profile-activation" );
|
||||
|
||||
Verifier verifier;
|
||||
|
||||
verifier = newVerifier( testDir.getAbsolutePath() );
|
||||
verifier.setAutoclean( false );
|
||||
verifier.deleteDirectory( "target" );
|
||||
verifier.addCliOption( "-Dprofile1.on=true" );
|
||||
verifier.executeGoal( "validate" );
|
||||
|
||||
//
|
||||
// The property profile1.on = true so only profile1 should be activated. The profile2.on property is not true so profile2
|
||||
// should not be activated. Only the profile1/touch.txt file should be generated.
|
||||
//
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.assertFilePresent( "target/profile1/touch.txt" );
|
||||
verifier.assertFileNotPresent( "target/profile2/touch.txt" );
|
||||
verifier.resetStreams();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.its.mng3106</groupId>
|
||||
<artifactId>test-artifact</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-touch</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>profile1</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>profile1.on</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
<file>
|
||||
<exists>pom.xml</exists>
|
||||
</file>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-touch</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>profile1-touch</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>touch</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/profile1</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>profile2</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>profile2.on</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
<file>
|
||||
<exists>pom.xml</exists>
|
||||
</file>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-touch</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>profile2-touch</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>touch</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}/profile2</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
Loading…
Reference in New Issue