//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAppendSingleTransaction() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldAppendSingleTransaction() { // GIVEN when(_logFile.Writer).thenReturn(_channel); long txId = 15; when(_transactionIdStore.nextCommittingTransactionId()).thenReturn(txId); TransactionAppender appender = Life.add(CreateTransactionAppender()); // WHEN TransactionRepresentation transaction = transaction(SingleCreateNodeCommand(0), new sbyte[] { 1, 2, 5 }, 2, 1, 12345, 4545, 12345 + 10); appender.Append(new TransactionToApply(transaction), _logAppendEvent); // THEN //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader<ReadableLogChannel> logEntryReader = new org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader<>(); LogEntryReader <ReadableLogChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableLogChannel>(); using (PhysicalTransactionCursor <ReadableLogChannel> reader = new PhysicalTransactionCursor <ReadableLogChannel>(_channel, logEntryReader)) { reader.Next(); TransactionRepresentation tx = reader.Get().TransactionRepresentation; assertArrayEquals(transaction.AdditionalHeader(), tx.AdditionalHeader()); assertEquals(transaction.MasterId, tx.MasterId); assertEquals(transaction.AuthorId, tx.AuthorId); assertEquals(transaction.TimeStarted, tx.TimeStarted); assertEquals(transaction.TimeCommitted, tx.TimeCommitted); assertEquals(transaction.LatestCommittedTxWhenStarted, tx.LatestCommittedTxWhenStarted); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAppendCommittedTransactions() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldAppendCommittedTransactions() { // GIVEN when(_logFile.Writer).thenReturn(_channel); long nextTxId = 15; when(_transactionIdStore.nextCommittingTransactionId()).thenReturn(nextTxId); TransactionAppender appender = Life.add(new BatchingTransactionAppender(_logFiles, NO_ROTATION, _positionCache, _transactionIdStore, BYPASS, _databaseHealth)); // WHEN //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final byte[] additionalHeader = new byte[]{1, 2, 5}; sbyte[] additionalHeader = new sbyte[] { 1, 2, 5 }; const int masterId = 2; int authorId = 1; const long timeStarted = 12345; long latestCommittedTxWhenStarted = nextTxId - 5; long timeCommitted = timeStarted + 10; PhysicalTransactionRepresentation transactionRepresentation = new PhysicalTransactionRepresentation(SingleCreateNodeCommand(0)); transactionRepresentation.SetHeader(additionalHeader, masterId, authorId, timeStarted, latestCommittedTxWhenStarted, timeCommitted, -1); LogEntryStart start = new LogEntryStart(0, 0, 0L, latestCommittedTxWhenStarted, null, LogPosition.UNSPECIFIED); LogEntryCommit commit = new LogEntryCommit(nextTxId, 0L); CommittedTransactionRepresentation transaction = new CommittedTransactionRepresentation(start, transactionRepresentation, commit); appender.Append(new TransactionToApply(transactionRepresentation, transaction.CommitEntry.TxId), _logAppendEvent); // THEN LogEntryReader <ReadableLogChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableLogChannel>(); using (PhysicalTransactionCursor <ReadableLogChannel> reader = new PhysicalTransactionCursor <ReadableLogChannel>(_channel, logEntryReader)) { reader.Next(); TransactionRepresentation result = reader.Get().TransactionRepresentation; assertArrayEquals(additionalHeader, result.AdditionalHeader()); assertEquals(masterId, result.MasterId); assertEquals(authorId, result.AuthorId); assertEquals(timeStarted, result.TimeStarted); assertEquals(timeCommitted, result.TimeCommitted); assertEquals(latestCommittedTxWhenStarted, result.LatestCommittedTxWhenStarted); } }