Search in sources :

Example 1 with StorageKeys

use of org.finra.herd.model.api.xml.StorageKeys 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);
}
Also used : StorageKeys(org.finra.herd.model.api.xml.StorageKeys) StorageKey(org.finra.herd.model.api.xml.StorageKey) Test(org.junit.Test)

Example 2 with StorageKeys

use of org.finra.herd.model.api.xml.StorageKeys in project herd by FINRAOS.

the class StorageServiceTest method testGetAllStorage.

@Test
public void testGetAllStorage() {
    // Get a list of test storage keys.
    List<StorageKey> storageKeys = storageDaoTestHelper.getTestStorageKeys();
    // Create and persist test storage entities.
    for (StorageKey storageKey : storageKeys) {
        storageDaoTestHelper.createStorageEntity(storageKey.getStorageName());
    }
    // Retrieve a list of storage keys.
    StorageKeys result = storageService.getAllStorage();
    // Validate the results.
    assertNotNull(result);
    assertTrue(result.getStorageKeys().containsAll(storageKeys));
}
Also used : StorageKeys(org.finra.herd.model.api.xml.StorageKeys) StorageKey(org.finra.herd.model.api.xml.StorageKey) Test(org.junit.Test)

Example 3 with StorageKeys

use of org.finra.herd.model.api.xml.StorageKeys in project herd by FINRAOS.

the class StorageServiceImpl method getAllStorage.

@Override
public StorageKeys getAllStorage() {
    StorageKeys storageKeys = new StorageKeys();
    storageKeys.getStorageKeys().addAll(storageDao.getAllStorage());
    return storageKeys;
}
Also used : StorageKeys(org.finra.herd.model.api.xml.StorageKeys)

Aggregations

StorageKeys (org.finra.herd.model.api.xml.StorageKeys)3 StorageKey (org.finra.herd.model.api.xml.StorageKey)2 Test (org.junit.Test)2