private RecoveryStartInformation createRecoveryInformation( LogPosition logPosition, long firstTxId ) { return new RecoveryStartInformation( logPosition, firstTxId ); } }
@Override public RecoveryStartInformation getRecoveryStartInformation() { return new RecoveryStartInformation( LogPosition.start( 0 ), 1 ); }
@Test public void reportProgressOnRecovery() throws Throwable { RecoveryService recoveryService = mock( RecoveryService.class, Answers.RETURNS_MOCKS ); CorruptedLogsTruncator logsTruncator = mock( CorruptedLogsTruncator.class ); RecoveryMonitor recoveryMonitor = mock( RecoveryMonitor.class ); TransactionCursor reverseTransactionCursor = mock( TransactionCursor.class ); TransactionCursor transactionCursor = mock( TransactionCursor.class ); CommittedTransactionRepresentation transactionRepresentation = mock( CommittedTransactionRepresentation.class ); int transactionsToRecover = 5; int expectedMax = transactionsToRecover * 2; int lastCommittedTransactionId = 14; LogPosition recoveryStartPosition = LogPosition.start( 0 ); int firstTxIdAfterLastCheckPoint = 10; RecoveryStartInformation startInformation = new RecoveryStartInformation( recoveryStartPosition, firstTxIdAfterLastCheckPoint ); when( reverseTransactionCursor.next() ).thenAnswer( new NextTransactionAnswer( transactionsToRecover ) ); when( transactionCursor.next() ).thenAnswer( new NextTransactionAnswer( transactionsToRecover ) ); when( reverseTransactionCursor.get() ).thenReturn( transactionRepresentation ); when( transactionCursor.get() ).thenReturn( transactionRepresentation ); when( transactionRepresentation.getCommitEntry() ).thenReturn( new LogEntryCommit( lastCommittedTransactionId, 1L ) ); when( recoveryService.getRecoveryStartInformation() ).thenReturn( startInformation ); when( recoveryService.getTransactionsInReverseOrder( recoveryStartPosition ) ).thenReturn( reverseTransactionCursor ); when( recoveryService.getTransactions( recoveryStartPosition ) ).thenReturn( transactionCursor ); AssertableProgressReporter progressReporter = new AssertableProgressReporter( expectedMax ); Recovery recovery = new Recovery( recoveryService, logsTruncator, recoveryMonitor, progressReporter, true ); recovery.init(); progressReporter.verify(); }
private RecoveryStartInformation createRecoveryInformation( LogPosition logPosition, long firstTxId ) { return new RecoveryStartInformation( logPosition, firstTxId ); } }