mirror of https://github.com/apache/archiva.git
[MRM-9] warn if no POM at source
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@372728 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
00ea26352a
commit
f9c4b27afd
|
@ -278,6 +278,15 @@ public class DefaultRepositoryConverter
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reporter.addWarning( artifact, getI18NString( "warning.missing.pom" ) );
|
||||
}
|
||||
}
|
||||
|
||||
private String getI18NString( String key )
|
||||
{
|
||||
return i18n.getString( getClass().getName(), Locale.getDefault(), key );
|
||||
}
|
||||
|
||||
private boolean testChecksums( Artifact artifact, File file, ArtifactReporter reporter )
|
||||
|
@ -293,8 +302,7 @@ public class DefaultRepositoryConverter
|
|||
String checksum = FileUtils.fileRead( md5 );
|
||||
if ( !digester.verifyChecksum( file, checksum, Digester.MD5 ) )
|
||||
{
|
||||
reporter.addFailure( artifact, i18n.getString( getClass().getName(), Locale.getDefault(),
|
||||
"failure.incorrect.md5" ) );
|
||||
reporter.addFailure( artifact, getI18NString( "failure.incorrect.md5" ) );
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
@ -305,8 +313,7 @@ public class DefaultRepositoryConverter
|
|||
String checksum = FileUtils.fileRead( sha1 );
|
||||
if ( !digester.verifyChecksum( file, checksum, Digester.SHA1 ) )
|
||||
{
|
||||
reporter.addFailure( artifact, i18n.getString( getClass().getName(), Locale.getDefault(),
|
||||
"failure.incorrect.sha1" ) );
|
||||
reporter.addFailure( artifact, getI18NString( "failure.incorrect.sha1" ) );
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,5 @@
|
|||
#
|
||||
|
||||
failure.incorrect.md5=The MD5 checksum value was incorrect.
|
||||
failure.incorrect.sha1=The SHA1 checksum value was incorrect.
|
||||
failure.incorrect.sha1=The SHA1 checksum value was incorrect.
|
||||
warning.missing.pom=The artifact had no POM in the source repository
|
|
@ -391,11 +391,14 @@ public class RepositoryConverterTest
|
|||
public void testNoPomConvert()
|
||||
throws IOException, RepositoryConversionException
|
||||
{
|
||||
// test that a POM is created when there was none at the source
|
||||
// test that a POM is not created when there was none at the source
|
||||
|
||||
Artifact artifact = createArtifact( "test", "noPomArtifact", "1.0.0" );
|
||||
repositoryConverter.convert( artifact, targetRepository, reporter );
|
||||
checkSuccess();
|
||||
assertEquals( "check no errors", 0, reporter.getFailures() );
|
||||
assertEquals( "check no warnings", 1, reporter.getWarnings() );
|
||||
assertEquals( "check success", 1, reporter.getSuccesses() );
|
||||
assertEquals( "check warning message", getI18nString( "warning.missing.pom" ), getWarning().getReason() );
|
||||
|
||||
File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
|
||||
assertTrue( "Check artifact created", artifactFile.exists() );
|
||||
|
@ -404,7 +407,7 @@ public class RepositoryConverterTest
|
|||
artifact = createPomArtifact( artifact );
|
||||
File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
|
||||
File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
|
||||
// TODO: should we fail? Warn?
|
||||
|
||||
assertFalse( "Check no POM created", pomFile.exists() );
|
||||
assertFalse( "No source POM", sourcePomFile.exists() );
|
||||
}
|
||||
|
@ -420,8 +423,7 @@ public class RepositoryConverterTest
|
|||
|
||||
repositoryConverter.convert( artifact, targetRepository, reporter );
|
||||
checkFailure();
|
||||
ArtifactResult failure = (ArtifactResult) reporter.getArtifactFailureIterator().next();
|
||||
assertEquals( "check failure message", getI18nString( "failure.incorrect.md5" ), failure.getReason() );
|
||||
assertEquals( "check failure message", getI18nString( "failure.incorrect.md5" ), getFailure().getReason() );
|
||||
|
||||
assertFalse( "Check artifact not created", file.exists() );
|
||||
}
|
||||
|
@ -437,8 +439,7 @@ public class RepositoryConverterTest
|
|||
|
||||
repositoryConverter.convert( artifact, targetRepository, reporter );
|
||||
checkFailure();
|
||||
ArtifactResult failure = (ArtifactResult) reporter.getArtifactFailureIterator().next();
|
||||
assertEquals( "check failure message", getI18nString( "failure.incorrect.sha1" ), failure.getReason() );
|
||||
assertEquals( "check failure message", getI18nString( "failure.incorrect.sha1" ), getFailure().getReason() );
|
||||
|
||||
assertFalse( "Check artifact not created", file.exists() );
|
||||
}
|
||||
|
@ -727,4 +728,14 @@ public class RepositoryConverterTest
|
|||
return i18n.getString( repositoryConverter.getClass().getName(), Locale.getDefault(), key );
|
||||
}
|
||||
|
||||
private ArtifactResult getFailure()
|
||||
{
|
||||
return (ArtifactResult) reporter.getArtifactFailureIterator().next();
|
||||
}
|
||||
|
||||
private ArtifactResult getWarning()
|
||||
{
|
||||
return (ArtifactResult) reporter.getArtifactWarningIterator().next();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue