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

                for (int i = 0; i < 3; i++)
                {
                    // when
                    IOCursor <EntryRecord> cursor = segment.GetCursor(0);

                    // then
                    assertTrue(cursor.next());
                    assertEquals(_entry1, cursor.get().logEntry());
                    assertTrue(cursor.next());
                    assertEquals(_entry2, cursor.get().logEntry());
                    assertTrue(cursor.next());
                    assertEquals(_entry3, cursor.get().logEntry());
                    assertFalse(cursor.next());

                    cursor.close();
                }
            }
        }
示例#2
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());
            }
        }
示例#3
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);
        }
示例#4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToWriteAndRead() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToWriteAndRead()
        {
            using (SegmentFile segment = create(FsRule.get(), _fileNames.getForVersion(0), _readerPool, 0, _contentMarshal, _logProvider, _segmentHeader))
            {
                // given
                segment.Write(0, _entry1);
                segment.Flush();

                // when
                IOCursor <EntryRecord> cursor = segment.GetCursor(0);

                // then
                assertTrue(cursor.next());
                assertEquals(_entry1, cursor.get().logEntry());

                cursor.close();
            }
        }