add unit test for [MRM-1877]

This commit is contained in:
Olivier Lamy 2015-03-23 15:00:51 +11:00
parent a6c73dcde2
commit 6317bd9d02
2 changed files with 8 additions and 9 deletions

View File

@ -98,8 +98,9 @@ public class ChecksummedFile
File checksumFile = new File( referenceFile.getAbsolutePath() + "." + checksumAlgorithm.getExt() );
Files.deleteIfExists( checksumFile.toPath() );
String checksum = calculateChecksum( checksumAlgorithm );
Files.write( checksumFile.toPath(), (checksum + " " + referenceFile.getName()).getBytes(), StandardOpenOption.CREATE_NEW );
//FileUtils.writeStringToFile( checksumFile, checksum + " " + referenceFile.getName() );
Files.write( checksumFile.toPath(), //
( checksum + " " + referenceFile.getName() ).getBytes(), //
StandardOpenOption.CREATE_NEW );
return checksumFile;
}

View File

@ -27,10 +27,10 @@ import org.apache.archiva.configuration.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
@ -42,8 +42,6 @@ import java.util.List;
/**
* ArtifactMissingChecksumsConsumer - Create missing and/or fix invalid checksums for the artifact.
*
*
*/
@Service( "knownRepositoryContentConsumer#create-missing-checksums" )
@Scope( "prototype" )
@ -155,7 +153,7 @@ public class ArtifactMissingChecksumsConsumer
private void createFixChecksum( String path, ChecksumAlgorithm checksumAlgorithm )
{
File artifactFile = new File( this.repositoryDir, path );
File checksumFile = new File( this.repositoryDir, path + checksumAlgorithm.getExt() );//+ "."
File checksumFile = new File( this.repositoryDir, path + "." + checksumAlgorithm.getExt() );
if ( checksumFile.exists() )
{