//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotCallTransactionClosedOnFailedAppendedTransaction() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotCallTransactionClosedOnFailedAppendedTransaction() { // GIVEN long txId = 3; string failureMessage = "Forces a failure"; FlushablePositionAwareChannel channel = spy(new PositionAwarePhysicalFlushableChannel(mock(typeof(PhysicalLogVersionedStoreChannel)))); IOException failure = new IOException(failureMessage); when(channel.PutInt(anyInt())).thenThrow(failure); when(_logFile.Writer).thenReturn(channel); when(_transactionIdStore.nextCommittingTransactionId()).thenReturn(txId); Mockito.reset(_databaseHealth); TransactionAppender appender = Life.add(CreateTransactionAppender()); // WHEN TransactionRepresentation transaction = mock(typeof(TransactionRepresentation)); when(transaction.AdditionalHeader()).thenReturn(new sbyte[0]); try { appender.Append(new TransactionToApply(transaction), _logAppendEvent); fail("Expected append to fail. Something is wrong with the test itself"); } catch (IOException e) { // THEN assertSame(failure, e); verify(_transactionIdStore, times(1)).nextCommittingTransactionId(); verify(_transactionIdStore, never()).transactionClosed(eq(txId), anyLong(), anyLong()); verify(_databaseHealth).panic(failure); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotCallTransactionClosedOnFailedForceLogToDisk() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotCallTransactionClosedOnFailedForceLogToDisk() { // GIVEN long txId = 3; string failureMessage = "Forces a failure"; FlushablePositionAwareChannel channel = spy(new InMemoryClosableChannel()); IOException failure = new IOException(failureMessage); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.io.Flushable flushable = mock(java.io.Flushable.class); Flushable flushable = mock(typeof(Flushable)); doAnswer(invocation => { invocation.callRealMethod(); return(flushable); }).when(channel).prepareForFlush(); doThrow(failure).when(flushable).flush(); when(_logFile.Writer).thenReturn(channel); TransactionMetadataCache metadataCache = new TransactionMetadataCache(); TransactionIdStore transactionIdStore = mock(typeof(TransactionIdStore)); when(transactionIdStore.NextCommittingTransactionId()).thenReturn(txId); Mockito.reset(_databaseHealth); TransactionAppender appender = Life.add(new BatchingTransactionAppender(_logFiles, NO_ROTATION, metadataCache, transactionIdStore, BYPASS, _databaseHealth)); // WHEN TransactionRepresentation transaction = mock(typeof(TransactionRepresentation)); when(transaction.AdditionalHeader()).thenReturn(new sbyte[0]); try { appender.Append(new TransactionToApply(transaction), _logAppendEvent); fail("Expected append to fail. Something is wrong with the test itself"); } catch (IOException e) { // THEN assertSame(failure, e); verify(transactionIdStore, times(1)).nextCommittingTransactionId(); verify(transactionIdStore, never()).transactionClosed(eq(txId), anyLong(), anyLong()); verify(_databaseHealth).panic(failure); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @After public void tearDown() public virtual void tearDown() { Mockito.reset(processEngine.HistoryService, historicDecisionInstanceStatisticsQuery); }