DDI supports sha256 (#869)
* Add SHA256 file hash to ddi GET outputs Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com> * Integrate review findings for SHA256 changes Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com> * Renamed hashes to base16hases in store() parameters Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com> * Added missing javadoc according to sonarqube findings Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>
This commit is contained in:
committed by
Dominic Schabel
parent
fba6cf9787
commit
bde3548846
@@ -62,16 +62,14 @@ public class ArtifactFilesystemRepository extends AbstractArtifactRepository {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ArtifactFilesystem(file, sha1, new DbArtifactHash(sha1, null), file.length(), null);
|
||||
return new ArtifactFilesystem(file, sha1, new DbArtifactHash(sha1, null, null), file.length(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractDbArtifact store(final String tenant, final String sha1Hash16, final String mdMD5Hash16,
|
||||
final String contentType, final String tempFile) throws IOException {
|
||||
protected AbstractDbArtifact store(final String tenant, final DbArtifactHash base16Hashes, final String contentType, final String tempFile) throws IOException {
|
||||
|
||||
final File file = new File(tempFile);
|
||||
return renameFileToSHA1Naming(tenant, file, new ArtifactFilesystem(file, sha1Hash16,
|
||||
new DbArtifactHash(sha1Hash16, mdMD5Hash16), file.length(), contentType));
|
||||
return renameFileToSHA1Naming(tenant, file, new ArtifactFilesystem(file, base16Hashes.getSha1(), base16Hashes, file.length(), contentType));
|
||||
}
|
||||
|
||||
private ArtifactFilesystem renameFileToSHA1Naming(final String tenant, final File file,
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ArtifactFilesystemTest {
|
||||
public void getInputStreamOfNonExistingFileThrowsException() {
|
||||
final File file = new File("fileWhichTotalDoesNotExists");
|
||||
final ArtifactFilesystem underTest = new ArtifactFilesystem(file, "fileWhichTotalDoesNotExists",
|
||||
new DbArtifactHash("1", "2"), 0L, null);
|
||||
new DbArtifactHash("1", "2", "3"), 0L, null);
|
||||
try {
|
||||
underTest.getFileInputStream();
|
||||
Assertions.fail("Expected a FileNotFoundException because file does not exists");
|
||||
@@ -48,7 +48,7 @@ public class ArtifactFilesystemTest {
|
||||
createTempFile.deleteOnExit();
|
||||
|
||||
final ArtifactFilesystem underTest = new ArtifactFilesystem(createTempFile,
|
||||
ArtifactFilesystemTest.class.getSimpleName(), new DbArtifactHash("1", "2"), 0L, null);
|
||||
ArtifactFilesystemTest.class.getSimpleName(), new DbArtifactHash("1", "2", "3"), 0L, null);
|
||||
final byte[] buffer = new byte[1024];
|
||||
IOUtils.read(underTest.getFileInputStream(), buffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user