o more tests for the configuration validation

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@512558 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-02-28 01:54:23 +00:00
parent fb6ffdc9de
commit b5cbfc8bd4
3 changed files with 34 additions and 2 deletions

View File

@ -755,7 +755,6 @@ public class MavenEmbedder
if ( configuration.getGlobalSettingsFile() != null )
{
try
{
fileReader = new FileReader( configuration.getGlobalSettingsFile() );

View File

@ -18,11 +18,25 @@ public class ValidateConfigurationTest
ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration );
assertTrue( result.isUserSettingsFileParses() );
assertTrue( result.isUserSettingsFilePresent() );
assertTrue( result.isUserSettingsFileParses() );
}
public void testConfigurationOnlyUserSettingsAreActiveAndItIsInvalid()
{
File user = new File( getBasedir(), "src/test/resources/settings/invalid-settings.xml" );
Configuration configuration = new DefaultConfiguration()
.setUserSettingsFile( user );
ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration );
assertTrue( result.isUserSettingsFilePresent() );
assertFalse( result.isUserSettingsFileParses() );
}
public void testConfigurationOnlyGlobalSettingsAreActiveAndItIsValid()
{
File global = new File( getBasedir(), "src/test/resources/settings/valid-settings.xml" );
@ -36,4 +50,18 @@ public class ValidateConfigurationTest
assertTrue( result.isGlobalSettingsFileParses() );
}
public void testConfigurationOnlyGlobalSettingsAreActiveAndItIsInvalid()
{
File global = new File( getBasedir(), "src/test/resources/settings/invalid-settings.xml" );
Configuration configuration = new DefaultConfiguration()
.setGlobalSettingsFile( global );
ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration );
assertTrue( result.isGlobalSettingsFilePresent() );
assertFalse( result.isGlobalSettingsFileParses() );
}
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<settings>
<!-- Missing end tag below -->
<localRepository>/Users/jvanzyl/maven-repo-local</localRepository
</settings>