示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToCloseOnlyAfterWriterIsClosed() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToCloseOnlyAfterWriterIsClosed()
        {
            using (SegmentFile segment = create(FsRule.get(), _fileNames.getForVersion(0), _readerPool, 0, _contentMarshal, _logProvider, _segmentHeader))
            {
                // given
                assertFalse(segment.TryClose());

                // when
                segment.CloseWriter();

                // then
                assertTrue(segment.TryClose());
            }
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPruneReaderPoolOnClose() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPruneReaderPoolOnClose()
        {
            using (SegmentFile segment = create(FsRule.get(), _fileNames.getForVersion(0), _readerPool, 0, _contentMarshal, _logProvider, _segmentHeader))
            {
                segment.Write(0, _entry1);
                segment.Flush();
                segment.CloseWriter();

                IOCursor <EntryRecord> cursor = segment.GetCursor(0);
                cursor.next();
                cursor.close();
            }

            verify(_readerPool).prune(0);
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHaveIdempotentCloseMethods() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHaveIdempotentCloseMethods()
        {
            // given
            SegmentFile            segment = create(FsRule.get(), _fileNames.getForVersion(0), _readerPool, 0, _contentMarshal, _logProvider, _segmentHeader);
            IOCursor <EntryRecord> cursor  = segment.GetCursor(0);

            // when
            segment.CloseWriter();
            cursor.close();

            // then
            assertTrue(segment.TryClose());
            segment.Close();
            assertTrue(segment.TryClose());
            segment.Close();
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleReaderPastEndCorrectly() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHandleReaderPastEndCorrectly()
        {
            using (SegmentFile segment = create(FsRule.get(), _fileNames.getForVersion(0), _readerPool, 0, _contentMarshal, _logProvider, _segmentHeader))
            {
                // given
                segment.Write(0, _entry1);
                segment.Write(1, _entry2);
                segment.Flush();
                segment.CloseWriter();

                IOCursor <EntryRecord> cursor = segment.GetCursor(3);

                // then
                assertFalse(cursor.next());

                // when
                cursor.close();

                // then
                assertTrue(segment.TryClose());
            }
        }
示例#5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCallDisposeHandlerAfterLastReaderIsClosed() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCallDisposeHandlerAfterLastReaderIsClosed()
        {
            using (SegmentFile segment = create(FsRule.get(), _fileNames.getForVersion(0), _readerPool, 0, _contentMarshal, _logProvider, _segmentHeader))
            {
                // given
                IOCursor <EntryRecord> cursor0 = segment.GetCursor(0);
                IOCursor <EntryRecord> cursor1 = segment.GetCursor(0);

                // when
                segment.CloseWriter();
                cursor0.close();

                // then
                assertFalse(segment.TryClose());

                // when
                cursor1.close();

                // then
                assertTrue(segment.TryClose());
            }
        }