mirror of https://github.com/apache/maven.git
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:
parent
fb6ffdc9de
commit
b5cbfc8bd4
|
@ -755,7 +755,6 @@ public class MavenEmbedder
|
||||||
|
|
||||||
if ( configuration.getGlobalSettingsFile() != null )
|
if ( configuration.getGlobalSettingsFile() != null )
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fileReader = new FileReader( configuration.getGlobalSettingsFile() );
|
fileReader = new FileReader( configuration.getGlobalSettingsFile() );
|
||||||
|
|
|
@ -18,11 +18,25 @@ public class ValidateConfigurationTest
|
||||||
|
|
||||||
ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration );
|
ConfigurationValidationResult result = MavenEmbedder.validateConfiguration( configuration );
|
||||||
|
|
||||||
assertTrue( result.isUserSettingsFileParses() );
|
assertTrue( result.isUserSettingsFilePresent() );
|
||||||
|
|
||||||
assertTrue( result.isUserSettingsFileParses() );
|
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()
|
public void testConfigurationOnlyGlobalSettingsAreActiveAndItIsValid()
|
||||||
{
|
{
|
||||||
File global = new File( getBasedir(), "src/test/resources/settings/valid-settings.xml" );
|
File global = new File( getBasedir(), "src/test/resources/settings/valid-settings.xml" );
|
||||||
|
@ -36,4 +50,18 @@ public class ValidateConfigurationTest
|
||||||
|
|
||||||
assertTrue( result.isGlobalSettingsFileParses() );
|
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() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<settings>
|
||||||
|
<!-- Missing end tag below -->
|
||||||
|
<localRepository>/Users/jvanzyl/maven-repo-local</localRepository
|
||||||
|
</settings>
|
Loading…
Reference in New Issue