use of org.finra.herd.model.api.xml.StorageUpdateRequest in project herd by FINRAOS.
the class StorageServiceTest method testUpdateStorage.
@Test
public void testUpdateStorage() {
// Create a storage.
Storage storage = storageService.createStorage(getNewStorageCreateRequest());
// Update the storage.
// TODO: Update various attributes of the storage update request in the future when there is something to update.
Storage result = storageService.updateStorage(new StorageKey(storage.getName()), new StorageUpdateRequest());
// Validate the results.
// TODO: Add asserts to ensure fields that were update indeed got updated.
assertEquals(new Storage(storage.getName(), storage.getStoragePlatformName(), storage.getAttributes()), result);
}
use of org.finra.herd.model.api.xml.StorageUpdateRequest in project herd by FINRAOS.
the class StorageServiceTest method testUpdateStorageStorageNoExists.
@Test
public void testUpdateStorageStorageNoExists() {
// Try to update a storage that doesn't yet exist.
try {
storageService.updateStorage(new StorageKey(INVALID_VALUE), new StorageUpdateRequest());
fail();
} catch (ObjectNotFoundException e) {
assertEquals(String.format("Storage with name \"%s\" doesn't exist.", INVALID_VALUE), e.getMessage());
}
}
use of org.finra.herd.model.api.xml.StorageUpdateRequest in project herd by FINRAOS.
the class StorageRestControllerTest method testUpdateStorage.
@Test
public void testUpdateStorage() {
// Create a storage key.
StorageKey storageKey = new StorageKey(STORAGE_NAME);
// Create a storage update request.
StorageUpdateRequest storageUpdateRequest = new StorageUpdateRequest();
// Create a storage.
Storage storage = new Storage(STORAGE_NAME, STORAGE_PLATFORM_CODE, NO_ATTRIBUTES);
// Mock the external calls.
when(storageService.updateStorage(storageKey, storageUpdateRequest)).thenReturn(storage);
// Call the method under test.
Storage result = storageRestController.updateStorage(STORAGE_NAME, storageUpdateRequest);
// Verify the external calls.
verify(storageService).updateStorage(storageKey, storageUpdateRequest);
verifyNoMoreInteractions(storageService);
// Validate the returned object.
assertEquals(storage, result);
}
Aggregations