//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReadAStartLogEntry() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReadAStartLogEntry() { // given LogEntryVersion version = LogEntryVersion.CURRENT; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LogEntryStart start = new LogEntryStart(version, 1, 2, 3, 4, new byte[]{5}, new org.neo4j.kernel.impl.transaction.log.LogPosition(0, 31)); LogEntryStart start = new LogEntryStart(version, 1, 2, 3, 4, new sbyte[] { 5 }, new LogPosition(0, 31)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel channel = new org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel(); InMemoryClosableChannel channel = new InMemoryClosableChannel(); channel.Put(version.byteCode()); // version channel.Put(LogEntryByteCodes.TxStart); // type channel.PutInt(start.MasterId); channel.PutInt(start.LocalId); channel.PutLong(start.TimeWritten); channel.PutLong(start.LastCommittedTxWhenTransactionStarted); channel.PutInt(start.AdditionalHeader.Length); channel.Put(start.AdditionalHeader, start.AdditionalHeader.Length); // when //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LogEntry logEntry = logEntryReader.readLogEntry(channel); LogEntry logEntry = _logEntryReader.readLogEntry(channel); // then assertEquals(start, logEntry); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReadACheckPointLogEntry() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReadACheckPointLogEntry() { // given LogEntryVersion version = LogEntryVersion.CURRENT; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.LogPosition logPosition = new org.neo4j.kernel.impl.transaction.log.LogPosition(42, 43); LogPosition logPosition = new LogPosition(42, 43); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final CheckPoint checkPoint = new CheckPoint(version, logPosition); CheckPoint checkPoint = new CheckPoint(version, logPosition); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel channel = new org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel(); InMemoryClosableChannel channel = new InMemoryClosableChannel(); channel.Put(version.byteCode()); channel.Put(LogEntryByteCodes.CheckPoint); channel.PutLong(logPosition.LogVersion); channel.PutLong(logPosition.ByteOffset); // when //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LogEntry logEntry = logEntryReader.readLogEntry(channel); LogEntry logEntry = _logEntryReader.readLogEntry(channel); // then assertEquals(checkPoint, logEntry); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReadACommandLogEntry() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReadACommandLogEntry() { // given LogEntryVersion version = LogEntryVersion.CURRENT; Command.NodeCommand nodeCommand = new Command.NodeCommand(new NodeRecord(11), new NodeRecord(11)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LogEntryCommand command = new LogEntryCommand(version, nodeCommand); LogEntryCommand command = new LogEntryCommand(version, nodeCommand); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel channel = new org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel(); InMemoryClosableChannel channel = new InMemoryClosableChannel(); channel.Put(version.byteCode()); channel.Put(LogEntryByteCodes.Command); nodeCommand.Serialize(channel); // when //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LogEntry logEntry = logEntryReader.readLogEntry(channel); LogEntry logEntry = _logEntryReader.readLogEntry(channel); // then assertEquals(command, logEntry); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void moreRecent() public virtual void MoreRecent() { assertTrue(LogEntryVersion.moreRecentVersionExists(LogEntryVersion.V2_3)); assertTrue(LogEntryVersion.moreRecentVersionExists(LogEntryVersion.V3_0)); assertTrue(LogEntryVersion.moreRecentVersionExists(LogEntryVersion.V2_3_5)); assertTrue(LogEntryVersion.moreRecentVersionExists(LogEntryVersion.V3_0_2)); assertFalse(LogEntryVersion.moreRecentVersionExists(LogEntryVersion.V3_0_10)); }
public LogEntryStart(LogEntryVersion version, int masterId, int authorId, long timeWritten, long lastCommittedTxWhenTransactionStarted, sbyte[] additionalHeader, LogPosition startPosition) : base(version, TX_START) { this._masterId = masterId; this._authorId = authorId; this._startPosition = startPosition; this._timeWritten = timeWritten; this._lastCommittedTxWhenTransactionStarted = lastCommittedTxWhenTransactionStarted; this._additionalHeader = additionalHeader; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToSelectAnyVersion() public virtual void ShouldBeAbleToSelectAnyVersion() { foreach (LogEntryVersion version in LogEntryVersion.values()) { // GIVEN sbyte code = version.byteCode(); // WHEN LogEntryVersion selectedVersion = LogEntryVersion.byVersion(code); // THEN assertEquals(version, selectedVersion); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnNullWhenThereIsNoCommand() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReturnNullWhenThereIsNoCommand() { // given LogEntryVersion version = LogEntryVersion.CURRENT; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel channel = new org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel(); InMemoryClosableChannel channel = new InMemoryClosableChannel(); channel.Put(version.byteCode()); channel.Put(LogEntryByteCodes.Command); channel.Put(Org.Neo4j.Kernel.impl.transaction.command.NeoCommandType_Fields.None); // when //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LogEntry logEntry = logEntryReader.readLogEntry(channel); LogEntry logEntry = _logEntryReader.readLogEntry(channel); // then assertNull(logEntry); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void appendCheckpoint(org.neo4j.kernel.impl.transaction.log.entry.LogEntryVersion logVersion) throws java.io.IOException private void AppendCheckpoint(LogEntryVersion logVersion) { PageCache pageCache = _pageCacheRule.getPageCache(_fs); VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>(); LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(_storeDirectory.databaseLayout(), _fs, pageCache).withLogEntryReader(logEntryReader).build(); LogTailScanner tailScanner = new LogTailScanner(logFiles, logEntryReader, new Monitors()); LogTailScanner.LogTailInformation tailInformation = tailScanner.TailInformation; using (Lifespan lifespan = new Lifespan(logFiles)) { FlushablePositionAwareChannel channel = logFiles.LogFile.Writer; LogPosition logPosition = tailInformation.LastCheckPoint.LogPosition; // Fake record channel.Put(logVersion.byteCode()).put(CHECK_POINT).putLong(logPosition.LogVersion).putLong(logPosition.ByteOffset); channel.PrepareForFlush().flush(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReadACommitLogEntry() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReadACommitLogEntry() { // given LogEntryVersion version = LogEntryVersion.CURRENT; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LogEntryCommit commit = new LogEntryCommit(version, 42, 21); LogEntryCommit commit = new LogEntryCommit(version, 42, 21); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel channel = new org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel(); InMemoryClosableChannel channel = new InMemoryClosableChannel(); channel.Put(version.byteCode()); channel.Put(LogEntryByteCodes.TxCommit); channel.PutLong(commit.TxId); channel.PutLong(commit.TimeWritten); // when //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LogEntry logEntry = logEntryReader.readLogEntry(channel); LogEntry logEntry = _logEntryReader.readLogEntry(channel); // then assertEquals(commit, logEntry); }
internal AbstractLogEntry(LogEntryVersion version, sbyte type) { this._type = type; this._version = version; }
public LogEntryCommit(LogEntryVersion version, long txId, long timeWritten) : base(version, TX_COMMIT) { this._txId = txId; this._timeWritten = timeWritten; this.Name = "Commit"; }
public LogEntryCommand(LogEntryVersion version, StorageCommand command) : base(version, COMMAND) { this._command = command; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public LogEntry readLogEntry(SOURCE channel) throws java.io.IOException public override LogEntry ReadLogEntry(SOURCE channel) { try { LogPositionMarker positionMarker = new LogPositionMarker(); long skipped = 0; while (true) { channel.GetCurrentPosition(positionMarker); sbyte versionCode = channel.Get(); sbyte typeCode = channel.Get(); LogEntryVersion version = null; LogEntryParser <LogEntry> entryReader; LogEntry entry; try { version = byVersion(versionCode); entryReader = version.entryParser(typeCode); entry = entryReader.Parse(version, channel, positionMarker, _commandReaderFactory); if (entry != null && skipped > 0) { // Take extra care when reading an entry in a bad section. Just because entry reading // didn't throw exception doesn't mean that it's a sane entry. if (!logEntryMakesSense(entry)) { throw new System.ArgumentException("Log entry " + entry + " which was read after " + "a bad section of " + skipped + " bytes was read successfully, but " + "its contents is unrealistic, so treating as part of bad section"); } _invalidLogEntryHandler.bytesSkipped(skipped); skipped = 0; } } catch (ReadPastEndException e) { // Make these exceptions slip by straight out to the outer handler throw e; } catch (Exception e) { // Tag all other exceptions with log position and other useful information LogPosition position = positionMarker.NewPosition(); e = withMessage(e, e.Message + ". At position " + position + " and entry version " + version); if (ChannelSupportsPositioning(channel) && _invalidLogEntryHandler.handleInvalidEntry(e, position)) { (( PositionableChannel )channel).CurrentPosition = positionMarker.ByteOffset + 1; skipped++; continue; } throwIfInstanceOf(e, typeof(UnsupportedLogVersionException)); throw new IOException(e); } if (!entryReader.Skip()) { return(entry); } } } catch (ReadPastEndException) { return(null); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void createStoreWithLogEntryVersion(org.neo4j.kernel.impl.transaction.log.entry.LogEntryVersion logEntryVersion) throws Exception private void CreateStoreWithLogEntryVersion(LogEntryVersion logEntryVersion) { CreateGraphDbAndKillIt(); AppendCheckpoint(logEntryVersion); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWarnAboutNewerLogVersion() public virtual void ShouldWarnAboutNewerLogVersion() { Expect.expect(typeof(UnsupportedLogVersionException)); LogEntryVersion.byVersion(( sbyte )-42); // unused for now }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWarnAboutOldLogVersion() public virtual void ShouldWarnAboutOldLogVersion() { Expect.expect(typeof(UnsupportedLogVersionException)); LogEntryVersion.byVersion(( sbyte )-4); }