Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNeverDeleteOnTruncate() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNeverDeleteOnTruncate()
        {
            // Given
            using (Segments segments = new Segments(_fsa, _fileNames, _readerPool, _segmentFiles, _contentMarshal, _logProvider, -1))
            {
                segments.Rotate(-1, -1, -1);
                segments.Last().closeWriter();                        // need to close writer otherwise dispose will not be called
                segments.Rotate(10, 10, 2);                           // we will truncate this whole file away
                segments.Last().closeWriter();

                // When
                segments.Truncate(20, 9, 4);

                // Then
                verify(_fsa, never()).deleteFile(any());
            }
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDeleteTruncatedFilesOnPrune() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDeleteTruncatedFilesOnPrune()
        {
            // Given
            using (Segments segments = new Segments(_fsa, _fileNames, _readerPool, _segmentFiles, _contentMarshal, _logProvider, -1))
            {
                SegmentFile toBePruned = segments.Rotate(-1, -1, -1);
                segments.Last().closeWriter();                         // need to close writer otherwise dispose will not be called
                // we will truncate this whole file away
                SegmentFile toBeTruncated = segments.Rotate(10, 10, 2);
                segments.Last().closeWriter();

                // When
                // We truncate a whole file
                segments.Truncate(20, 9, 4);
                // And we prune all files before that file
                segments.Prune(10);

                // Then
                // the truncate file is part of the deletes that happen while pruning
                verify(_fsa, times(_segmentFiles.Count)).deleteFile(_fileNames.getForVersion(toBePruned.Header().version()));
            }
        }