//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.kernel.impl.transaction.log.TransactionMetadataCache.TransactionMetadata getMetadataFor(long transactionId) throws java.io.IOException public override TransactionMetadata GetMetadataFor(long transactionId) { if (transactionId <= BASE_TX_ID) { return(_metadataForEmptyStore); } TransactionMetadata transactionMetadata = _transactionMetadataCache.getTransactionMetadata(transactionId); if (transactionMetadata == null) { using (IOCursor <CommittedTransactionRepresentation> cursor = GetTransactions(transactionId)) { while (cursor.next()) { CommittedTransactionRepresentation tx = cursor.get(); LogEntryCommit commitEntry = tx.CommitEntry; long committedTxId = commitEntry.TxId; long timeWritten = commitEntry.TimeWritten; TransactionMetadata metadata = _transactionMetadataCache.cacheTransactionMetadata(committedTxId, tx.StartEntry.StartPosition, tx.StartEntry.MasterId, tx.StartEntry.LocalId, LogEntryStart.checksum(tx.StartEntry), timeWritten); if (committedTxId == transactionId) { transactionMetadata = metadata; } } } if (transactionMetadata == null) { throw new NoSuchTransactionException(transactionId); } } return(transactionMetadata); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public LogPosition getAndCacheFoundLogPosition(TransactionMetadataCache transactionMetadataCache) throws NoSuchTransactionException public virtual LogPosition GetAndCacheFoundLogPosition(TransactionMetadataCache transactionMetadataCache) { if (StartEntryForFoundTransaction == null) { throw new NoSuchTransactionException(StartTransactionId); } transactionMetadataCache.CacheTransactionMetadata(StartTransactionId, StartEntryForFoundTransaction.StartPosition, StartEntryForFoundTransaction.MasterId, StartEntryForFoundTransaction.LocalId, LogEntryStart.checksum(StartEntryForFoundTransaction), CommitTimestamp); return(StartEntryForFoundTransaction.StartPosition); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFindTransactionLogPosition() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldFindTransactionLogPosition() { // given //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final PhysicalLogicalTransactionStore.TransactionPositionLocator locator = new PhysicalLogicalTransactionStore.TransactionPositionLocator(txId, logEntryReader); PhysicalLogicalTransactionStore.TransactionPositionLocator locator = new PhysicalLogicalTransactionStore.TransactionPositionLocator(_txId, _logEntryReader); when(_logEntryReader.readLogEntry(_channel)).thenReturn(_start, _command, _commit, null); // when //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final boolean result = locator.visit(channel); bool result = locator.Visit(_channel); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final LogPosition position = locator.getAndCacheFoundLogPosition(metadataCache); LogPosition position = locator.GetAndCacheFoundLogPosition(_metadataCache); // then assertFalse(result); assertEquals(_startPosition, position); verify(_metadataCache, times(1)).cacheTransactionMetadata(_txId, _startPosition, _start.MasterId, _start.LocalId, LogEntryStart.checksum(_start), _commit.TimeWritten); }