Author: brett Date: Thu Feb 26 11:57:34 2009 New Revision: 748105 URL: http://svn.apache.org/viewvc?rev=748105&view=rev Log: [MNG-3641] Lack of error checks on profiles Submitted by: Torben S. Giesselmann
Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3641ProfileActivationWarningTest.java (with props) maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3641/ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3641/pom.xml Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Modified: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java?rev=748105&r1=748104&r2=748105&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java (original) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java Thu Feb 26 11:57:34 2009 @@ -181,6 +181,7 @@ suite.addTestSuite( MavenITmng3667ResolveDepsWithBadPomVersionTest.class ); suite.addTestSuite( MavenITmng3652UserAgentHeaderTest.class ); suite.addTestSuite( MavenITmng3642DynamicResourcesTest.class ); + suite.addTestSuite( MavenITmng3641ProfileActivationWarningTest.class ); suite.addTestSuite( MavenITmng3600DeploymentModeDefaultsTest.class ); suite.addTestSuite( MavenITmng3599useHttpProxyForWebDAVTest.class ); suite.addTestSuite( MavenITmng3586SystemScopePluginDependencyTest.class ); Added: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3641ProfileActivationWarningTest.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3641ProfileActivationWarningTest.java?rev=748105&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3641ProfileActivationWarningTest.java (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3641ProfileActivationWarningTest.java Thu Feb 26 11:57:34 2009 @@ -0,0 +1,86 @@ +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 java.util.Collections; +import java.util.List; + +import org.apache.maven.it.util.ResourceExtractor; + +/** + * MNG-3641 - Profile activation warning test + */ +public class MavenITmng3641ProfileActivationWarningTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng3641ProfileActivationWarningTest() + { + super( "[2.0.11,2.1.0-M1),[2.1.0,)" ); // only test in 2.0.11+, 2.1.0+ + } + + public void testitMNG3641() + throws Exception + { + // (0) Initialize. + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3641" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + + // Delete this artifact. Just in case. + verifier.deleteArtifact( "org.apache.maven.its.mng3641", "parent", "1.0", "pom" ); + + // (1) First run: make sure the profile is found. Must not contain a warning. + verifier.setCliOptions( Collections.singletonList( "-P mng-3641-it-provided-profile" ) ); + verifier.setLogFileName( "log-1.txt" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + List logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + assertFalse( logFile.contains( "[WARNING] Profile with id: 'mng-3641-it-provided-profile' has not been activated." ) ); + + // (2) Second run: make sure the profile was not found and a warning was printed. + verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setCliOptions( Collections.singletonList( "-P mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p" ) ); + verifier.setLogFileName( "log-2.txt" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + assertTrue( logFile.contains( "[WARNING] Profile with id: 'mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p' has not been activated." ) ); + + // (3) Third run: make sure the first profile is found while the other is not and a warning was printed + // accordingly. + verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setCliOptions( Collections.singletonList( "-P mng-3641-it-provided-profile,mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p" ) ); + verifier.setLogFileName( "log-3.txt" ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false ); + assertFalse( logFile.contains( "[WARNING] Profile with id: 'mng-3641-it-provided-profile' has not been activated." ) ); + assertTrue( logFile.contains( "[WARNING] Profile with id: 'mng-3641-TWlzdGVyIFQgd2FzIGhlcmUuICheX14p' has not been activated." ) ); + } +} Propchange: maven/core-integration-testing/trunk/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3641ProfileActivationWarningTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3641/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3641/pom.xml?rev=748105&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3641/pom.xml (added) +++ maven/core-integration-testing/trunk/core-it-suite/src/test/resources/mng-3641/pom.xml Thu Feb 26 11:57:34 2009 @@ -0,0 +1,37 @@ +<?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 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.mng3641</groupId> + <artifactId>profile-test</artifactId> + <version>1</version> + <packaging>pom</packaging> + + <name>MNG-3641 - Profile activation warning test</name> + + <profiles> + <profile> + <id>mng-3641-it-provided-profile</id> + </profile> + </profiles> +</project>