/// <exception cref="System.IO.IOException"/>
            public virtual FSEditLog MockEditLog(NNStorageRetentionManager.StoragePurger purger
                                                 )
            {
                IList <JournalManager> jms        = Lists.NewArrayList();
                JournalSet             journalSet = new JournalSet(0);

                foreach (TestNNStorageRetentionManager.TestCaseDescription.FakeRoot root in this.
                         dirRoots.Values)
                {
                    if (!root.type.IsOfType(NNStorage.NameNodeDirType.Edits))
                    {
                        continue;
                    }
                    // passing null NNStorage for unit test because it does not use it
                    FileJournalManager fjm = new FileJournalManager(this._enclosing.conf, root.MockStorageDir
                                                                        (), null);
                    fjm.purger = purger;
                    jms.AddItem(fjm);
                    journalSet.Add(fjm, false);
                }
                FSEditLog mockLog = Org.Mockito.Mockito.Mock <FSEditLog>();

                Org.Mockito.Mockito.DoAnswer(new _Answer_350(jms)).When(mockLog).PurgeLogsOlderThan
                    (Org.Mockito.Mockito.AnyLong());
                Org.Mockito.Mockito.DoAnswer(new _Answer_365(journalSet)).When(mockLog).SelectInputStreams
                    (Org.Mockito.Mockito.AnyCollection(), Org.Mockito.Mockito.AnyLong(), Org.Mockito.Mockito
                    .AnyBoolean());
                return(mockLog);
            }
Пример #2
0
        public static JournalSet SpyOnJournalSet(NameNode nn)
        {
            FSEditLog  editLog = nn.GetFSImage().GetEditLog();
            JournalSet js      = Org.Mockito.Mockito.Spy(editLog.GetJournalSet());

            editLog.SetJournalSetForTesting(js);
            return(js);
        }
Пример #3
0
 /// <exception cref="System.IO.IOException"/>
 internal JournalSetOutputStream(JournalSet _enclosing)
     : base()
 {
     this._enclosing = _enclosing;
 }
 public _Answer_365(JournalSet journalSet)
 {
     this.journalSet = journalSet;
 }