Esempio n. 1
0
        /// <returns>
        /// a List which contains the "current" dir for each storage
        /// directory of the given type.
        /// </returns>
        public static IList <FilePath> GetCurrentDirs(NNStorage storage, NNStorage.NameNodeDirType
                                                      type)
        {
            IList <FilePath> ret = Lists.NewArrayList();

            foreach (Storage.StorageDirectory sd in storage.DirIterable(type))
            {
                ret.AddItem(sd.GetCurrentDir());
            }
            return(ret);
        }
Esempio n. 2
0
 public static Storage.StorageDirectory MockStorageDirectory(FilePath currentDir,
                                                             NNStorage.NameNodeDirType type)
 {
     // Mock the StorageDirectory interface to just point to this file
     Storage.StorageDirectory sd = Org.Mockito.Mockito.Mock <Storage.StorageDirectory>(
         );
     Org.Mockito.Mockito.DoReturn(type).When(sd).GetStorageDirType();
     Org.Mockito.Mockito.DoReturn(currentDir).When(sd).GetCurrentDir();
     Org.Mockito.Mockito.DoReturn(currentDir).When(sd).GetRoot();
     Org.Mockito.Mockito.DoReturn(MockFile(true)).When(sd).GetVersionFile();
     Org.Mockito.Mockito.DoReturn(MockFile(false)).When(sd).GetPreviousDir();
     return(sd);
 }
 internal virtual void AddRoot(string root, NNStorage.NameNodeDirType dir)
 {
     this.dirRoots[new FilePath(root)] = new TestNNStorageRetentionManager.TestCaseDescription.FakeRoot
                                             (this, dir);
 }
 internal FakeRoot(TestCaseDescription _enclosing, NNStorage.NameNodeDirType type)
 {
     this._enclosing = _enclosing;
     this.type       = type;
     this.files      = Lists.NewArrayList();
 }
Esempio n. 5
0
        /// <exception cref="System.IO.IOException"/>
        public static FSImageTransactionalStorageInspector InspectStorageDirectory(FilePath
                                                                                   dir, NNStorage.NameNodeDirType dirType)
        {
            FSImageTransactionalStorageInspector inspector = new FSImageTransactionalStorageInspector
                                                                 ();

            inspector.InspectDirectory(MockStorageDirectory(dir, dirType));
            return(inspector);
        }