//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotAppendCommittedTransactionsWhenTooFarAhead()
        public virtual void ShouldNotAppendCommittedTransactionsWhenTooFarAhead()
        {
            // GIVEN
            InMemoryClosableChannel channel = new InMemoryClosableChannel();

            when(_logFile.Writer).thenReturn(channel);
            TransactionAppender appender = Life.add(CreateTransactionAppender());

            // 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 = 4545;
            long       timeCommitted                = timeStarted + 10;
            PhysicalTransactionRepresentation transactionRepresentation = new PhysicalTransactionRepresentation(SingleCreateNodeCommand(0));

            transactionRepresentation.SetHeader(additionalHeader, masterId, authorId, timeStarted, latestCommittedTxWhenStarted, timeCommitted, -1);

            when(_transactionIdStore.LastCommittedTransactionId).thenReturn(latestCommittedTxWhenStarted);

            LogEntryStart  start  = new LogEntryStart(0, 0, 0L, latestCommittedTxWhenStarted, null, LogPosition.UNSPECIFIED);
            LogEntryCommit commit = new LogEntryCommit(latestCommittedTxWhenStarted + 2, 0L);
            CommittedTransactionRepresentation transaction = new CommittedTransactionRepresentation(start, transactionRepresentation, commit);

            try
            {
                appender.Append(new TransactionToApply(transaction.TransactionRepresentation, transaction.CommitEntry.TxId), _logAppendEvent);
                fail("should have thrown");
            }
            catch (Exception e)
            {
                assertThat(e.Message, containsString("to be applied, but appending it ended up generating an"));
            }
        }
Exemplo n.º 2
0
 internal Writer(InMemoryClosableChannel outerInstance, ByteBuffer buffer) : base(outerInstance, buffer)
 {
     this._outerInstance = outerInstance;
 }
Exemplo n.º 3
0
 internal ByteBufferBase(InMemoryClosableChannel outerInstance, ByteBuffer buffer)
 {
     this._outerInstance = outerInstance;
     this.Buffer         = buffer;
 }