use of org.finra.herd.model.api.xml.Storage in project herd by FINRAOS.
the class DownloaderControllerTest method testCreateDownloaderOutputManifestDtoAssertOutputFilesEmptyWhenStorageFilesNull.
@Test
public void testCreateDownloaderOutputManifestDtoAssertOutputFilesEmptyWhenStorageFilesNull() {
BusinessObjectData businessObjectData = new BusinessObjectData();
StorageUnit storageUnit = new StorageUnit(new Storage("storageName", null, null), null, null, StorageUnitStatusEntity.ENABLED, null, null, null);
String s3KeyPrefix = "s3KeyPrefix";
DownloaderOutputManifestDto actual = downloaderController.createDownloaderOutputManifestDto(businessObjectData, storageUnit, s3KeyPrefix);
assertEquals(0, actual.getManifestFiles().size());
}
use of org.finra.herd.model.api.xml.Storage in project herd by FINRAOS.
the class DownloaderWebClientTest method toBusinessObjectData.
private BusinessObjectData toBusinessObjectData(final UploaderInputManifestDto uploaderInputManifestDto) {
BusinessObjectData businessObjectData = new BusinessObjectData();
businessObjectData.setNamespace(uploaderInputManifestDto.getNamespace());
businessObjectData.setBusinessObjectDefinitionName(uploaderInputManifestDto.getBusinessObjectDefinitionName());
businessObjectData.setBusinessObjectFormatUsage(uploaderInputManifestDto.getBusinessObjectFormatUsage());
businessObjectData.setBusinessObjectFormatFileType(uploaderInputManifestDto.getBusinessObjectFormatFileType());
businessObjectData.setBusinessObjectFormatVersion(Integer.valueOf(uploaderInputManifestDto.getBusinessObjectFormatVersion()));
businessObjectData.setPartitionKey(uploaderInputManifestDto.getPartitionKey());
businessObjectData.setPartitionValue(uploaderInputManifestDto.getPartitionValue());
businessObjectData.setSubPartitionValues(uploaderInputManifestDto.getSubPartitionValues());
businessObjectData.setVersion(TEST_DATA_VERSION_V0);
businessObjectData.setStorageUnits(Arrays.asList(new StorageUnit(new Storage(StorageEntity.MANAGED_STORAGE, null, null), null, null, null, null, null, null)));
return businessObjectData;
}
use of org.finra.herd.model.api.xml.Storage in project herd by FINRAOS.
the class MockHttpClientOperationsImpl method buildGetStorageResponse.
/**
* Builds a Get Storage response.
*
* @param response the response.
* @param uri the URI of the incoming request.
*
* @throws JAXBException if a JAXB error occurred.
*/
private void buildGetStorageResponse(MockCloseableHttpResponse response, URI uri) throws JAXBException {
Pattern pattern = Pattern.compile("/herd-app/rest/storages/(.*)");
Matcher matcher = pattern.matcher(uri.getPath());
if (matcher.find()) {
Storage storage = getNewStorage(matcher.group(1));
response.setEntity(getHttpEntity(storage));
}
}
use of org.finra.herd.model.api.xml.Storage in project herd by FINRAOS.
the class StorageRestControllerTest method testUpdateStorageAttributes.
@Test
public void testUpdateStorageAttributes() {
// Create a storage key.
StorageKey storageKey = new StorageKey(STORAGE_NAME);
// Create a storage update request.
StorageAttributesUpdateRequest storageAttributesUpdateRequest = new StorageAttributesUpdateRequest(businessObjectDefinitionServiceTestHelper.getNewAttributes());
// Create a storage.
Storage storage = new Storage(STORAGE_NAME, STORAGE_PLATFORM_CODE, businessObjectDefinitionServiceTestHelper.getNewAttributes());
// Mock the external calls.
when(storageService.updateStorageAttributes(storageKey, storageAttributesUpdateRequest)).thenReturn(storage);
// Call the method under test.
Storage result = storageRestController.updateStorageAttributes(STORAGE_NAME, storageAttributesUpdateRequest);
// Verify the external calls.
verify(storageService).updateStorageAttributes(storageKey, storageAttributesUpdateRequest);
verifyNoMoreInteractions(storageService);
// Validate the returned object.
assertEquals(storage, result);
}
use of org.finra.herd.model.api.xml.Storage in project herd by FINRAOS.
the class StorageRestControllerTest method testGetStorage.
@Test
public void testGetStorage() {
// Create a storage key.
StorageKey storageKey = new StorageKey(STORAGE_NAME);
// Create a storage.
Storage storage = new Storage(STORAGE_NAME, STORAGE_PLATFORM_CODE, NO_ATTRIBUTES);
// Mock the external calls.
when(storageService.getStorage(storageKey)).thenReturn(storage);
// Call the method under test.
Storage result = storageRestController.getStorage(STORAGE_NAME);
// Verify the external calls.
verify(storageService).getStorage(storageKey);
verifyNoMoreInteractions(storageService);
// Validate the returned object.
assertEquals(storage, result);
}
Aggregations