@Component public class StorageFileHelper extends Object
| Constructor and Description |
|---|
StorageFileHelper() |
| Modifier and Type | Method and Description |
|---|---|
StorageFile |
createStorageFileFromEntity(StorageFileEntity storageFileEntity)
Creates a storage file from the storage file entity.
|
List<StorageFile> |
createStorageFilesFromEntities(Collection<StorageFileEntity> storageFileEntities)
Creates a list of storage files from the collection of storage file entities.
|
List<StorageFile> |
createStorageFilesFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
Creates a list of storage files from the list of S3 object summaries.
|
List<String> |
getFilePathsFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
Returns a list of file paths extracted from the specified list of S3 object summaries.
|
List<String> |
getFilePathsFromStorageFiles(List<StorageFile> storageFiles)
Returns a list of file paths extracted from the specified list of storage files.
|
List<File> |
getFiles(List<StorageFile> storageFiles)
Returns a list of files extracted from the specified list of storage files.
|
Map<String,StorageFileEntity> |
getStorageFileEntitiesMap(Collection<StorageFileEntity> storageFileEntities)
Returns a map of file paths to the storage file entities build from the list of storage file entities.
|
Map<String,StorageFile> |
getStorageFilesMapFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
Returns a map of file paths to the storage files build from the list of S3 object summaries with map iteration order matching the original list order.
|
Map<String,StorageFile> |
getStorageFilesMapFromStorageFiles(List<StorageFile> storageFiles)
Returns a map of file paths to the storage files build from the list of storage files with map iteration order matching the original list order.
|
long |
getStorageFilesSizeBytes(Collection<StorageFile> storageFiles)
Get the total size in bytes of all storage files in the specified list.
|
void |
validateArchivedS3Files(List<StorageFile> expectedStorageFiles,
List<com.amazonaws.services.s3.model.S3ObjectSummary> actualS3Files,
String storageName,
BusinessObjectDataKey businessObjectDataKey)
Validates archived S3 files per list of expected storage files.
|
void |
validateCopiedS3Files(List<StorageFile> expectedStorageFiles,
List<com.amazonaws.services.s3.model.S3ObjectSummary> actualS3Files,
String storageName,
BusinessObjectDataKey businessObjectDataKey)
Validates copied S3 files per list of expected storage files.
|
void |
validateDownloadedS3Files(String baseDirectory,
String s3KeyPrefix,
List<StorageFile> storageFiles)
Validate downloaded S3 files per specified list of storage files.
|
void |
validateDownloadedS3Files(String baseDirectory,
String s3KeyPrefix,
StorageUnit storageUnit)
Validate downloaded S3 files per storage unit information.
|
void |
validateRestoredS3Files(List<StorageFile> expectedStorageFiles,
List<com.amazonaws.services.s3.model.S3ObjectSummary> actualS3Files,
String storageName,
BusinessObjectDataKey businessObjectDataKey)
Validates restored S3 files per list of expected storage files.
|
void |
validateSourceS3Files(List<StorageFile> expectedStorageFiles,
List<com.amazonaws.services.s3.model.S3ObjectSummary> actualS3Files,
String storageName,
BusinessObjectDataKey businessObjectDataKey)
Validates registered S3 files per list of expected storage files.
|
void |
validateStorageFile(StorageFile storageFile,
String s3BucketName,
Map<String,StorageFile> actualS3Keys,
boolean validateFileSize)
Validates storage file against the actual S3 objects reported by S3.
|
void |
validateStorageFileEntity(StorageFileEntity storageFileEntity,
String s3BucketName,
Map<String,StorageFile> actualS3Keys,
boolean validateFileSize)
Validates storage file entity against the actual S3 objects reported by S3.
|
void |
validateStorageFiles(Collection<String> storageFilePaths,
String s3KeyPrefix,
BusinessObjectDataEntity businessObjectDataEntity,
String storageName)
Validates a list of storage files registered with specified business object data at specified storage.
|
void |
validateStorageUnitS3Files(StorageUnit storageUnit,
List<String> actualS3Files,
String s3KeyPrefix)
Validates S3 files per storage unit information.
|
public StorageFile createStorageFileFromEntity(StorageFileEntity storageFileEntity)
storageFileEntity - the storage file entitypublic List<StorageFile> createStorageFilesFromEntities(Collection<StorageFileEntity> storageFileEntities)
storageFileEntities - the collection of storage file entitiespublic List<StorageFile> createStorageFilesFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
s3ObjectSummaries - the list of S3 object summariespublic List<String> getFilePathsFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
s3ObjectSummaries - the list of of S3 object summariespublic List<String> getFilePathsFromStorageFiles(List<StorageFile> storageFiles)
storageFiles - the list of storage filespublic List<File> getFiles(List<StorageFile> storageFiles)
storageFiles - the list of storage filespublic Map<String,StorageFileEntity> getStorageFileEntitiesMap(Collection<StorageFileEntity> storageFileEntities)
storageFileEntities - the collection of storage file entitiespublic Map<String,StorageFile> getStorageFilesMapFromS3ObjectSummaries(List<com.amazonaws.services.s3.model.S3ObjectSummary> s3ObjectSummaries)
s3ObjectSummaries - the list of S3 object summariespublic Map<String,StorageFile> getStorageFilesMapFromStorageFiles(List<StorageFile> storageFiles)
storageFiles - the list of storage filespublic long getStorageFilesSizeBytes(Collection<StorageFile> storageFiles)
storageFiles - the list of storage filespublic void validateArchivedS3Files(List<StorageFile> expectedStorageFiles, List<com.amazonaws.services.s3.model.S3ObjectSummary> actualS3Files, String storageName, BusinessObjectDataKey businessObjectDataKey)
expectedStorageFiles - the list of expected S3 files represented by storage filesactualS3Files - the list of actual S3 files represented by S3 object summariesstorageName - the storage namebusinessObjectDataKey - the business object data keypublic void validateCopiedS3Files(List<StorageFile> expectedStorageFiles, List<com.amazonaws.services.s3.model.S3ObjectSummary> actualS3Files, String storageName, BusinessObjectDataKey businessObjectDataKey)
expectedStorageFiles - the list of expected S3 files represented by storage filesactualS3Files - the list of actual S3 files represented by S3 object summariesstorageName - the storage namebusinessObjectDataKey - the business object data keypublic void validateDownloadedS3Files(String baseDirectory, String s3KeyPrefix, StorageUnit storageUnit) throws IllegalStateException
baseDirectory - the local parent directory path, relative to which the files are expected to be locateds3KeyPrefix - the S3 key prefix that was prepended to the S3 file paths, when they were uploaded to S3storageUnit - the storage unit that contains a list of storage files to be validatedIllegalStateException - if files are not validpublic void validateDownloadedS3Files(String baseDirectory, String s3KeyPrefix, List<StorageFile> storageFiles) throws IllegalStateException
baseDirectory - the local parent directory path, relative to which the files are expected to be locateds3KeyPrefix - the S3 key prefix that was prepended to the S3 file paths, when they were uploaded to S3storageFiles - the list of storage filesIllegalStateException - if files are not validpublic void validateRestoredS3Files(List<StorageFile> expectedStorageFiles, List<com.amazonaws.services.s3.model.S3ObjectSummary> actualS3Files, String storageName, BusinessObjectDataKey businessObjectDataKey)
expectedStorageFiles - the list of expected S3 files represented by storage filesactualS3Files - the list of actual S3 files represented by S3 object summariesstorageName - the storage namebusinessObjectDataKey - the business object data keypublic void validateSourceS3Files(List<StorageFile> expectedStorageFiles, List<com.amazonaws.services.s3.model.S3ObjectSummary> actualS3Files, String storageName, BusinessObjectDataKey businessObjectDataKey)
expectedStorageFiles - the list of expected S3 files represented by storage filesactualS3Files - the list of actual S3 files represented by S3 object summariesstorageName - the storage namebusinessObjectDataKey - the business object data keypublic void validateStorageFile(StorageFile storageFile, String s3BucketName, Map<String,StorageFile> actualS3Keys, boolean validateFileSize)
storageFile - the storage file to be validateds3BucketName - the S3 bucket nameactualS3Keys - the map of storage file paths to storage files as reported by S3validateFileSize - specifies whether file size validation is required or notpublic void validateStorageFileEntity(StorageFileEntity storageFileEntity, String s3BucketName, Map<String,StorageFile> actualS3Keys, boolean validateFileSize)
storageFileEntity - the storage file to be validateds3BucketName - the S3 bucket nameactualS3Keys - the map of storage file paths to storage files as reported by S3validateFileSize - specifies whether file size validation is required or notpublic void validateStorageFiles(Collection<String> storageFilePaths, String s3KeyPrefix, BusinessObjectDataEntity businessObjectDataEntity, String storageName) throws IllegalArgumentException
storageFilePaths - the storage file paths to be validateds3KeyPrefix - the S3 key prefix that storage file paths are expected to start withbusinessObjectDataEntity - the business object data entitystorageName - the name of the storage that storage files are stored inIllegalArgumentException - if a storage file doesn't match the expected S3 key prefix.public void validateStorageUnitS3Files(StorageUnit storageUnit, List<String> actualS3Files, String s3KeyPrefix)
storageUnit - the storage unit that contains S3 files to be validatedactualS3Files - the list of the actual S3 filess3KeyPrefix - the S3 key prefix that was prepended to the S3 file paths, when they were uploaded to S3Copyright © 2017. All rights reserved.