@Test
public void testAddStorageDirectories() throws IOException,
    URISyntaxException {

  final int numLocations = 3;
  final int numNamespace = 3;
  List<StorageLocation> locations = createStorageLocations(numLocations);
  // Add volumes for multiple namespaces.
  List<NamespaceInfo> namespaceInfos = createNamespaceInfos(numNamespace);
  for (NamespaceInfo ni : namespaceInfos) {
    storage.addStorageLocations(mockDN, ni, locations, START_OPT);
    for (StorageLocation sl : locations) {
      checkDir(new File(sl.getUri()));
      checkDir(new File(sl.getUri()), ni.getBlockPoolID());
    }
  }
  assertEquals(numLocations, storage.getNumStorageDirs());
  locations = createStorageLocations(numLocations);
  List<StorageDirectory> addedLocation =
      storage.addStorageLocations(mockDN, namespaceInfos.get(0),
          locations, START_OPT);
  assertTrue(addedLocation.isEmpty());
  // The number of active storage dirs has not changed, since it tries to
  // add the storage dirs that are under service.
  assertEquals(numLocations, storage.getNumStorageDirs());
  // Add more directories.
  locations = createStorageLocations(6);
  storage.addStorageLocations(mockDN, nsInfo, locations, START_OPT);
  assertEquals(6, storage.getNumStorageDirs());
}