//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void correctLastAppliedToPreviousLogTransactionInHeaderOnLogFileRotation() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void CorrectLastAppliedToPreviousLogTransactionInHeaderOnLogFileRotation() { LogFiles logFiles = GetLogFiles(_logVersionRepository, _transactionIdStore); Life.add(logFiles); DatabaseHealth databaseHealth = DatabaseHealth; LogRotationImpl logRotation = new LogRotationImpl(_monitors.newMonitor(typeof(Org.Neo4j.Kernel.impl.transaction.log.rotation.LogRotation_Monitor)), logFiles, databaseHealth); TransactionMetadataCache transactionMetadataCache = new TransactionMetadataCache(); SynchronizedArrayIdOrderingQueue idOrderingQueue = new SynchronizedArrayIdOrderingQueue(); BatchingTransactionAppender transactionAppender = new BatchingTransactionAppender(logFiles, logRotation, transactionMetadataCache, _transactionIdStore, idOrderingQueue, databaseHealth); Life.add(transactionAppender); LogAppendEvent logAppendEvent = new RotationLogAppendEvent(logRotation); TransactionToApply transactionToApply = PrepareTransaction(); transactionAppender.Append(transactionToApply, logAppendEvent); assertEquals(1, logFiles.HighestLogVersion); File highestLogFile = logFiles.HighestLogFile; LogHeader logHeader = LogHeaderReader.readLogHeader(FileSystem, highestLogFile); assertEquals(2, logHeader.LastCommittedTxId); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldKeepTransactionsIntactWhenConcurrentlyRotationAndAppending() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldKeepTransactionsIntactWhenConcurrentlyRotationAndAppending() { // GIVEN LogVersionRepository logVersionRepository = new SimpleLogVersionRepository(); LogFiles logFiles = LogFilesBuilder.builder(_directory.databaseLayout(), _fileSystemRule.get()).withLogVersionRepository(logVersionRepository).withRotationThreshold(ByteUnit.mebiBytes(1)).withTransactionIdStore(new SimpleTransactionIdStore()).build(); _life.add(logFiles); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.atomic.AtomicBoolean end = new java.util.concurrent.atomic.AtomicBoolean(); AtomicBoolean end = new AtomicBoolean(); AllTheMonitoring monitoring = new AllTheMonitoring(end, 100); TransactionIdStore txIdStore = new SimpleTransactionIdStore(); TransactionMetadataCache metadataCache = new TransactionMetadataCache(); monitoring.LogFile = logFiles.LogFile; DatabaseHealth health = new DatabaseHealth(mock(typeof(DatabasePanicEventGenerator)), NullLog.Instance); LogRotation rotation = new LogRotationImpl(monitoring, logFiles, health); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final TransactionAppender appender = life.add(new BatchingTransactionAppender(logFiles, rotation, metadataCache, txIdStore, BYPASS, health)); TransactionAppender appender = _life.add(new BatchingTransactionAppender(logFiles, rotation, metadataCache, txIdStore, BYPASS, health)); // WHEN Race race = new Race(); for (int i = 0; i < 10; i++) { race.AddContestant(() => { while (!end.get()) { try { appender.Append(new TransactionToApply(SillyTransaction(1_000)), NULL); } catch (Exception e) { e.printStackTrace(System.out); end.set(true); fail(e.Message); } } }); } race.AddContestant(EndAfterMax(10, SECONDS, end)); race.Go(); // THEN assertTrue(monitoring.NumberOfRotations() > 0); }
internal RotationLogAppendEvent(LogRotationImpl logRotation) { this.LogRotation = logRotation; }