//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(); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: static SegmentFile create(org.neo4j.io.fs.FileSystemAbstraction fileSystem, java.io.File file, ReaderPool readerPool, long version, org.neo4j.causalclustering.messaging.marshalling.ChannelMarshal<org.neo4j.causalclustering.core.replication.ReplicatedContent> contentMarshal, org.neo4j.logging.LogProvider logProvider, SegmentHeader header) throws java.io.IOException internal static SegmentFile Create(FileSystemAbstraction fileSystem, File file, ReaderPool readerPool, long version, ChannelMarshal <ReplicatedContent> contentMarshal, LogProvider logProvider, SegmentHeader header) { if (fileSystem.FileExists(file)) { throw new System.InvalidOperationException("File was not expected to exist"); } SegmentFile segment = new SegmentFile(fileSystem, file, readerPool, version, contentMarshal, logProvider, header); _headerMarshal.marshal(header, segment.OrCreateWriter); segment.Flush(); return(segment); }
//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); }
//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(); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private synchronized SegmentFile createNext(long prevFileLastIndex, long prevIndex, long prevTerm) throws java.io.IOException private SegmentFile CreateNext(long prevFileLastIndex, long prevIndex, long prevTerm) { lock (this) { _currentVersion++; SegmentHeader header = new SegmentHeader(prevFileLastIndex, _currentVersion, prevIndex, prevTerm); File file = _fileNames.getForVersion(_currentVersion); SegmentFile segment = SegmentFile.Create(_fileSystem, file, _readerPool, _currentVersion, _contentMarshal, _logProvider, header); // TODO: Force base directory... probably not possible using fsa. segment.Flush(); _allSegments.Add(segment); _rangeMap.replaceFrom(prevIndex + 1, segment); return(segment); } }
//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()); } }