/** * Gets a list of storage keys for all storage defined in the system. * * @return the list of storage keys */ @RequestMapping(value = STORAGE_URI_PREFIX, method = RequestMethod.GET) @Secured(SecurityFunctions.FN_STORAGES_ALL_GET) StorageKeys getStorages() { return storageService.getAllStorage(); }
/** * Gets a list of storage keys for all storage defined in the system. * * @return the list of storage keys */ @RequestMapping(value = STORAGE_URI_PREFIX, method = RequestMethod.GET) @Secured(SecurityFunctions.FN_STORAGES_ALL_GET) StorageKeys getStorages() { return storageService.getAllStorage(); }
@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); }
@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)); }