use of org.finra.herd.model.api.xml.BusinessObjectDataKey in project herd by FINRAOS.
the class DataBridgeWebClientTest method testUpdateBusinessObjectDataStatus.
/**
* Calls updateBusinessObjectDataStatus() method and makes assertions.
*
* @param useSsl specifies whether to use SSL or not
*
* @throws IOException
* @throws JAXBException
* @throws URISyntaxException
*/
private void testUpdateBusinessObjectDataStatus(List<String> subPartitionValues, boolean useSsl) throws IOException, JAXBException, URISyntaxException {
dataBridgeWebClient.regServerAccessParamsDto.setUseSsl(useSsl);
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey();
businessObjectDataKey.setSubPartitionValues(subPartitionValues);
String businessObjectDataStatus = "testBusinessObjectDataStatus";
BusinessObjectDataStatusUpdateResponse businessObjectDataStatusUpdateResponse = dataBridgeWebClient.updateBusinessObjectDataStatus(businessObjectDataKey, businessObjectDataStatus);
assertNotNull("businessObjectDataStatusUpdateResponse", businessObjectDataStatusUpdateResponse);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataKey in project herd by FINRAOS.
the class DataBridgeWebClientTest method testAddStorageFilesResponse200BadContentReturnsNull.
@Test
public void testAddStorageFilesResponse200BadContentReturnsNull() throws Exception {
dataBridgeWebClient.regServerAccessParamsDto.setRegServerHost(MockHttpClientOperationsImpl.HOSTNAME_RESPOND_WITH_STATUS_CODE_200_AND_INVALID_CONTENT);
dataBridgeWebClient.regServerAccessParamsDto.setUseSsl(false);
BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey();
UploaderInputManifestDto manifest = getUploaderInputManifestDto();
S3FileTransferRequestParamsDto s3FileTransferRequestParamsDto = new S3FileTransferRequestParamsDto();
String storageName = "testStorage";
BusinessObjectDataStorageFilesCreateResponse businessObjectDataStorageFilesCreateResponse = dataBridgeWebClient.addStorageFiles(businessObjectDataKey, manifest, s3FileTransferRequestParamsDto, storageName);
assertNull("businessObjectDataStorageFilesCreateResponse", businessObjectDataStorageFilesCreateResponse);
}
use of org.finra.herd.model.api.xml.BusinessObjectDataKey in project herd by FINRAOS.
the class DownloaderWebClientTest method testGetS3KeyPrefix.
@Test
public void testGetS3KeyPrefix() throws Exception {
// Upload and register business object data parents.
uploadAndRegisterTestDataParents(downloaderWebClient);
// Upload and register the initial version if of the test business object data.
uploadTestDataFilesToS3(S3_TEST_PATH_V0);
final UploaderInputManifestDto uploaderInputManifestDto = getTestUploaderInputManifestDto();
executeWithoutLogging(DataBridgeWebClient.class, new Command() {
@Override
public void execute() throws Exception {
BusinessObjectData businessObjectData = downloaderWebClient.preRegisterBusinessObjectData(uploaderInputManifestDto, StorageEntity.MANAGED_STORAGE, false);
BusinessObjectDataKey businessObjectDataKey = businessObjectDataHelper.getBusinessObjectDataKey(businessObjectData);
downloaderWebClient.addStorageFiles(businessObjectDataKey, uploaderInputManifestDto, getTestS3FileTransferRequestParamsDto(S3_TEST_PATH_V0 + "/"), StorageEntity.MANAGED_STORAGE);
downloaderWebClient.updateBusinessObjectDataStatus(businessObjectDataKey, BusinessObjectDataStatusEntity.VALID);
}
});
// Get S3 key prefix.
BusinessObjectData businessObjectData = toBusinessObjectData(uploaderInputManifestDto);
S3KeyPrefixInformation resultS3KeyPrefixInformation = downloaderWebClient.getS3KeyPrefix(businessObjectData);
// Validate the results.
assertNotNull(resultS3KeyPrefixInformation);
assertEquals(S3_SIMPLE_TEST_PATH, resultS3KeyPrefixInformation.getS3KeyPrefix());
}
use of org.finra.herd.model.api.xml.BusinessObjectDataKey in project herd by FINRAOS.
the class RetentionExpirationDestroyerController method performRetentionExpirationDestruction.
/**
* Executes the retention expiration destroyer workflow.
*
* @param localInputFile the local input file
* @param regServerAccessParamsDto the DTO for the parameters required to communicate with the registration server
*
* @throws Exception if any problems were encountered
*/
public void performRetentionExpirationDestruction(File localInputFile, RegServerAccessParamsDto regServerAccessParamsDto) throws Exception {
// Read business object data keys from the input CSV file.
List<BusinessObjectDataKey> businessObjectDataKeys = getBusinessObjectDataKeys(localInputFile);
// Initialize the web client.
retentionExpirationDestroyerWebClient.setRegServerAccessParamsDto(regServerAccessParamsDto);
// Process business object data keys one by one.
LOGGER.info("Processing {} business object data instances for destruction.", CollectionUtils.size(businessObjectDataKeys));
for (BusinessObjectDataKey businessObjectDataKey : businessObjectDataKeys) {
retentionExpirationDestroyerWebClient.destroyBusinessObjectData(businessObjectDataKey);
LOGGER.info("Successfully marked for destruction. Business object data {}", jsonHelper.objectToJson(businessObjectDataKey));
}
LOGGER.info("Successfully processed {} business object data instances for destruction.", CollectionUtils.size(businessObjectDataKeys));
}
use of org.finra.herd.model.api.xml.BusinessObjectDataKey in project herd by FINRAOS.
the class RetentionExpirationDestroyerControllerTest method testGetBusinessObjectDataKeys.
@Test
public void testGetBusinessObjectDataKeys() throws Exception {
// Create a local input CSV file.
File inputCsvFile = createLocalInputCsvFile();
// Get and validate a list of business object data keys.
List<BusinessObjectDataKey> result = retentionExpirationDestroyerController.getBusinessObjectDataKeys(inputCsvFile);
// Validate the results.
assertEquals(Arrays.asList(new BusinessObjectDataKey(NAMESPACE, BUSINESS_OBJECT_DEFINITION_NAME, BUSINESS_OBJECT_FORMAT_USAGE, BUSINESS_OBJECT_FORMAT_FILE_TYPE, BUSINESS_OBJECT_FORMAT_VERSION, PRIMARY_PARTITION_VALUE, SUB_PARTITION_VALUES, BUSINESS_OBJECT_DATA_VERSION), new BusinessObjectDataKey(NAMESPACE, BUSINESS_OBJECT_DEFINITION_NAME, BUSINESS_OBJECT_FORMAT_USAGE, BUSINESS_OBJECT_FORMAT_FILE_TYPE, BUSINESS_OBJECT_FORMAT_VERSION, PRIMARY_PARTITION_VALUE, NO_SUB_PARTITION_VALUES, BUSINESS_OBJECT_DATA_VERSION), new BusinessObjectDataKey(NAMESPACE + ",\"", BUSINESS_OBJECT_DEFINITION_NAME + ",\"", BUSINESS_OBJECT_FORMAT_USAGE + ",\"", BUSINESS_OBJECT_FORMAT_FILE_TYPE + ",\"", BUSINESS_OBJECT_FORMAT_VERSION, PRIMARY_PARTITION_VALUE + ",\"", Arrays.asList(SUB_PARTITION_VALUES.get(0) + ",\"", SUB_PARTITION_VALUES.get(1) + ",\"", SUB_PARTITION_VALUES.get(2) + ",\"", SUB_PARTITION_VALUES.get(3) + ",\""), BUSINESS_OBJECT_DATA_VERSION)), result);
}
Aggregations