@VisibleForTesting static boolean timeLockMigrationCompleteIfNeeded(LockAndTimestampServices lockAndTimestampServices) { return lockAndTimestampServices.migrator().map(AsyncInitializer::isInitialized).orElse(true); }
@Test public void timeLockMigrationReportsReadyIfMigrationDone() { when(migrator.isInitialized()).thenReturn(true); when(lockAndTimestampServices.migrator()).thenReturn(Optional.of(migrator)); assertTrue(TransactionManagers.timeLockMigrationCompleteIfNeeded(lockAndTimestampServices)); }
@Test public void timeLockMigrationReportsNotReadyIfMigrationNotDone() { when(migrator.isInitialized()).thenReturn(false); when(lockAndTimestampServices.migrator()).thenReturn(Optional.of(migrator)); assertFalse(TransactionManagers.timeLockMigrationCompleteIfNeeded(lockAndTimestampServices)); }
@VisibleForTesting static boolean timeLockMigrationCompleteIfNeeded(LockAndTimestampServices lockAndTimestampServices) { return lockAndTimestampServices.migrator().map(AsyncInitializer::isInitialized).orElse(true); }
@Test public void timeLockMigrationReportsReadyIfMigrationNotNeeded() { when(lockAndTimestampServices.migrator()).thenReturn(Optional.empty()); assertTrue(TransactionManagers.timeLockMigrationCompleteIfNeeded(lockAndTimestampServices)); }