public void InitializationShouldLoadLastSynchronizedEtagFromStorage() { var synchronizer = new DatabaseEtagSynchronizer(storage); var iSynchronizer = synchronizer.GetSynchronizer(EtagSynchronizerType.Indexer); Assert.Equal(1, numberOfCalls); }
public IndexingExecuter(WorkContext context, DatabaseEtagSynchronizer synchronizer, Prefetcher prefetcher) : base(context) { autoTuner = new IndexBatchSizeAutoTuner(context); etagSynchronizer = synchronizer.GetSynchronizer(EtagSynchronizerType.Indexer); prefetchingBehavior = prefetcher.GetPrefetchingBehavior(PrefetchingUser.Indexer, autoTuner); }
public void Calculation1() { var synchronizer = new DatabaseEtagSynchronizer(storage); var iSynchronizer = synchronizer.GetSynchronizer(EtagSynchronizerType.Indexer); var someEtag = EtagUtil.Increment(Etag.Empty, 1); Assert.Equal(someEtag, iSynchronizer.CalculateSynchronizationEtag(null, someEtag)); }
public void SynchronizerShouldReturnNullIfNoNewEtagsArrivedFromLastGet() { var synchronizer = new DatabaseEtagSynchronizer(storage); var iSynchronizer = synchronizer.GetSynchronizer(EtagSynchronizerType.Indexer); var someEtag = EtagUtil.Increment(Etag.Empty, 1); iSynchronizer.UpdateSynchronizationState(someEtag); var etag = iSynchronizer.GetSynchronizationEtag(); Assert.Equal(someEtag, etag); Assert.Null(iSynchronizer.GetSynchronizationEtag()); }
public void SynchronizerShouldReturnLowestEtagInEachCycle() { var synchronizer = new DatabaseEtagSynchronizer(storage); var iSynchronizer = synchronizer.GetSynchronizer(EtagSynchronizerType.Indexer); var lowestEtag = EtagUtil.Increment(Etag.Empty, 1); var higherEtag = EtagUtil.Increment(Etag.Empty, 2); var highestEtag = EtagUtil.Increment(Etag.Empty, 2); iSynchronizer.UpdateSynchronizationState(higherEtag); iSynchronizer.UpdateSynchronizationState(lowestEtag); iSynchronizer.UpdateSynchronizationState(highestEtag); var etag = iSynchronizer.GetSynchronizationEtag(); Assert.Equal(lowestEtag, etag); }
public void Calculation2() { var synchronizer = new DatabaseEtagSynchronizer(storage); var iSynchronizer = synchronizer.GetSynchronizer(EtagSynchronizerType.Indexer); Assert.Equal(Etag.Empty, iSynchronizer.CalculateSynchronizationEtag(null, null)); }
public void CalculationShouldNotPersist() { var synchronizer = new DatabaseEtagSynchronizer(storage); var iSynchronizer = synchronizer.GetSynchronizer(EtagSynchronizerType.Indexer); var lowerEtag = EtagUtil.Increment(Etag.Empty, 1); var higherEtag = EtagUtil.Increment(Etag.Empty, 2); iSynchronizer.UpdateSynchronizationState(higherEtag); Assert.Equal(higherEtag, iSynchronizer.GetSynchronizationEtag()); iSynchronizer.CalculateSynchronizationEtag(null, higherEtag); Assert.Equal(3, numberOfCalls); }
public void CalculationShouldPersist1() { var synchronizer = new DatabaseEtagSynchronizer(storage); var iSynchronizer = synchronizer.GetSynchronizer(EtagSynchronizerType.Indexer); var lowerEtag = EtagUtil.Increment(Etag.Empty, 1); Assert.Equal(lowerEtag, iSynchronizer.CalculateSynchronizationEtag(null, lowerEtag)); Assert.Equal(2, numberOfCalls); }
public void Calculation5() { var synchronizer = new DatabaseEtagSynchronizer(storage); var iSynchronizer = synchronizer.GetSynchronizer(EtagSynchronizerType.Indexer); var lowerEtag = EtagUtil.Increment(Etag.Empty, 1); var higherEtag = EtagUtil.Increment(Etag.Empty, 2); Assert.Equal(lowerEtag, iSynchronizer.CalculateSynchronizationEtag(higherEtag, lowerEtag)); }