[MNG-2738] 1-char profile names cannot be activated with -P

o Added IT

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@1042262 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-12-04 23:24:20 +00:00
parent 9e887c2e75
commit 2e241679cf
3 changed files with 124 additions and 0 deletions

View File

@ -451,6 +451,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng2744checksumVerificationTest.class );
suite.addTestSuite( MavenITmng2741PluginMetadataResolutionErrorMessageTest.class );
suite.addTestSuite( MavenITmng2739RequiredRepositoryElementsTest.class );
suite.addTestSuite( MavenITmng2738ProfileIdCollidesWithCliOptionTest.class );
suite.addTestSuite( MavenITmng2720SiblingClasspathArtifactsTest.class );
suite.addTestSuite( MavenITmng2695OfflinePluginSnapshotsTest.class );
suite.addTestSuite( MavenITmng2693SitePluginRealmTest.class );

View File

@ -0,0 +1,61 @@
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;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2738">MNG-2738</a>.
*
* @author Benjamin Bentmann
*/
public class MavenITmng2738ProfileIdCollidesWithCliOptionTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng2738ProfileIdCollidesWithCliOptionTest()
{
super( "[2.1.0,3.0-alpha-1),[3.0,)" );
}
/**
* Verify that the CLI parsing properly handles activation of profiles whose id happens to match a short command
* line option.
*/
public void testit()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2738" );
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
verifier.setAutoclean( false );
verifier.deleteDirectory( "target" );
verifier.getCliOptions().add( "-Pe" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertFilePresent( "target/touch.txt" );
}
}

View File

@ -0,0 +1,62 @@
<?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.mng2738</groupId>
<artifactId>test</artifactId>
<version>0.1</version>
<name>Maven Integration Test :: MNG-2738</name>
<description>
Verify that the CLI parsing properly handles activation of profiles whose id happens to match a short command
line option.
</description>
<profiles>
<profile>
<!-- NOTE: It's the essential piece of this test that the profile id matches a short command line option, i.e. -e here -->
<id>e</id>
<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>default</id>
<phase>validate</phase>
<goals>
<goal>reset</goal>
</goals>
<configuration>
<logFile>target/touch.txt</logFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>