use of bio.terra.model.DRSChecksum in project jade-data-repo by DataBiosphere.
the class DrsService method drsObjectFromFSDir.
private DRSObject drsObjectFromFSDir(FSDir fsDir, String snapshotId) {
DRSObject dirObject = makeCommonDrsObject(fsDir, snapshotId);
DRSChecksum drsChecksum = new DRSChecksum().type("crc32c").checksum("0");
dirObject.size(0L).addChecksumsItem(drsChecksum).contents(makeContentsList(fsDir, snapshotId));
return dirObject;
}
use of bio.terra.model.DRSChecksum in project jade-data-repo by DataBiosphere.
the class FileService method makeChecksums.
// We use the DRSChecksum model to represent the checksums in the repository
// API's FileModel to return the set of checksums for a file.
List<DRSChecksum> makeChecksums(FSItem fsItem) {
List<DRSChecksum> checksums = new ArrayList<>();
if (fsItem.getChecksumCrc32c() != null) {
DRSChecksum checksumCrc32 = new DRSChecksum().checksum(fsItem.getChecksumCrc32c()).type("crc32c");
checksums.add(checksumCrc32);
}
if (fsItem.getChecksumMd5() != null) {
DRSChecksum checksumMd5 = new DRSChecksum().checksum(fsItem.getChecksumMd5()).type("md5");
checksums.add(checksumMd5);
}
return checksums;
}
use of bio.terra.model.DRSChecksum in project jade-data-repo by DataBiosphere.
the class DrsTest method validateDrsObject.
private void validateDrsObject(DRSObject drsObject, String drsObjectId) {
assertThat("DRS id matches", drsObject.getId(), equalTo(drsObjectId));
assertThat("Create and update dates match", drsObject.getCreatedTime(), equalTo(drsObject.getUpdatedTime()));
assertThat("DRS version is right", drsObject.getVersion(), equalTo("0"));
for (DRSChecksum checksum : drsObject.getChecksums()) {
assertTrue("checksum is md5 or crc32c", StringUtils.equals(checksum.getType(), "md5") || StringUtils.equals(checksum.getType(), "crc32c"));
}
}
use of bio.terra.model.DRSChecksum in project jade-data-repo by DataBiosphere.
the class ConnectedOperations method checkSuccessfulFileLoad.
private void checkSuccessfulFileLoad(FileLoadModel fileLoadModel, FileModel fileModel, String datasetId) {
assertThat("description matches", fileModel.getDescription(), CoreMatchers.equalTo(fileLoadModel.getDescription()));
assertThat("mime type matches", fileModel.getFileDetail().getMimeType(), CoreMatchers.equalTo(fileLoadModel.getMimeType()));
for (DRSChecksum checksum : fileModel.getChecksums()) {
assertTrue("valid checksum type", (StringUtils.equals(checksum.getType(), "crc32c") || StringUtils.equals(checksum.getType(), "md5")));
}
logger.info("addFile datasetId:{} objectId:{}", datasetId, fileModel.getFileId());
addFile(datasetId, fileModel.getFileId());
}
Aggregations