mirror of https://github.com/apache/maven.git
Trying to make the FileProfileActivator unit test more resilient to alternative local repository locations.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@612645 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
372207fe19
commit
c1b1ff061e
|
@ -69,13 +69,14 @@ public class FileProfileActivator
|
|||
{
|
||||
fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" );
|
||||
|
||||
System.out.println( "FileProfileActivator: Checking file existence for: " + fileString + ". Result: " + FileUtils.fileExists( fileString ) );
|
||||
boolean result = FileUtils.fileExists( fileString );
|
||||
|
||||
if ( logger != null )
|
||||
{
|
||||
logger.info( "FileProfileActivator: Checking file existence for: " + fileString );
|
||||
logger.debug( "FileProfileActivator: Checking file existence for: " + fileString + ". Result: " + result );
|
||||
}
|
||||
|
||||
return FileUtils.fileExists( fileString );
|
||||
return result;
|
||||
}
|
||||
|
||||
// check if the file is missing, if it is then the profile will be active
|
||||
|
@ -85,21 +86,21 @@ public class FileProfileActivator
|
|||
{
|
||||
fileString = StringUtils.replace( interpolator.interpolate( fileString, "" ), "\\", "/" );
|
||||
|
||||
System.out.println( "FileProfileActivator: Checking file is missing for: " + fileString + ". Result: " + (!FileUtils.fileExists( fileString )) );
|
||||
boolean result = !FileUtils.fileExists( fileString );
|
||||
|
||||
if ( logger != null )
|
||||
{
|
||||
logger.info( "FileProfileActivator: Checking file is missing for: " + fileString );
|
||||
logger.debug( "FileProfileActivator: Checking file is missing for: " + fileString + ". Result: " + result );
|
||||
}
|
||||
|
||||
return !FileUtils.fileExists( fileString );
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println( "FileProfileActivator: no file specified. Skipping activation." );
|
||||
if ( logger != null )
|
||||
{
|
||||
logger.info( "FileProfileActivator: no file specified. Skipping activation." );
|
||||
logger.debug( "FileProfileActivator: no file specified. Skipping activation." );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@ package org.apache.maven.profiles.activation;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.Activation;
|
||||
import org.apache.maven.model.Profile;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.maven.model.Activation;
|
||||
import org.apache.maven.model.Profile;
|
||||
|
||||
/**
|
||||
* Test case for the {@link FileProfileActivator}.
|
||||
*
|
||||
|
@ -41,8 +41,18 @@ public class FileProfileActivatorTest
|
|||
throws ProfileActivationException
|
||||
{
|
||||
org.apache.maven.model.ActivationFile activationFile = new org.apache.maven.model.ActivationFile();
|
||||
|
||||
// make an educated guess at the repository location...
|
||||
String repoLocation = System.getProperty( "maven.repo.local", "${user.home}/.m2/repository" );
|
||||
|
||||
repoLocation = repoLocation.replace( '\\', '/' );
|
||||
if ( repoLocation.endsWith( "/" ) )
|
||||
{
|
||||
repoLocation = repoLocation.substring( 0, repoLocation.length() - 1 );
|
||||
}
|
||||
|
||||
// Assume that junit exists
|
||||
activationFile.setExists( "${user.home}/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar" );
|
||||
activationFile.setExists( repoLocation + "/junit/junit/3.8.1/junit-3.8.1.jar" );
|
||||
|
||||
Activation fileActivation = new Activation();
|
||||
fileActivation.setFile( activationFile );
|
||||
|
|
Loading…
Reference in New Issue