use of org.finra.herd.model.api.xml.StorageKey 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.StorageKey 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);
}
use of org.finra.herd.model.api.xml.StorageKey in project herd by FINRAOS.
the class StorageRestControllerTest method testGetStorages.
@Test
public void testGetStorages() {
// Get a list of storage keys.
StorageKeys storageKeys = new StorageKeys(Arrays.asList(new StorageKey(STORAGE_NAME), new StorageKey(STORAGE_NAME_2)));
// Mock the external calls.
when(storageService.getAllStorage()).thenReturn(storageKeys);
// Call the method under test.
StorageKeys result = storageRestController.getStorages();
// Verify the external calls.
verify(storageService).getAllStorage();
verifyNoMoreInteractions(storageService);
// Validate the returned object.
assertEquals(storageKeys, result);
}
use of org.finra.herd.model.api.xml.StorageKey in project herd by FINRAOS.
the class StorageDaoTest method testGetAllStorage.
@Test
public void testGetAllStorage() {
// Get a list of test storage keys.
List<StorageKey> storageKeys = storageDaoTestHelper.getTestStorageKeys();
// Create and persist storage entities.
for (StorageKey storageKey : storageKeys) {
storageDaoTestHelper.createStorageEntity(storageKey.getStorageName());
}
// Retrieve a list of storage keys for all storage registered in the system.
List<StorageKey> result = storageDao.getAllStorage();
// Validate the results.
assertNotNull(result);
assertTrue(result.containsAll(storageDaoTestHelper.getTestStorageKeys()));
}
use of org.finra.herd.model.api.xml.StorageKey in project herd by FINRAOS.
the class StorageServiceTest method testUpdateStorageAttributes.
@Test
public void testUpdateStorageAttributes() {
// Create and persist a valid storage.
StorageCreateRequest request = getNewStorageCreateRequest();
Storage storage = storageService.createStorage(request);
// Update attributes for the storage.
Storage result = storageService.updateStorageAttributes(new StorageKey(storage.getName()), new StorageAttributesUpdateRequest(businessObjectDefinitionServiceTestHelper.getNewAttributes2()));
// Validate the results.
assertEquals(new Storage(storage.getName(), storage.getStoragePlatformName(), businessObjectDefinitionServiceTestHelper.getNewAttributes2()), result);
}
Aggregations