@Test public void testBackupEnabled( @Mocked IConfiguration configuration, @Mocked IBackupRestoreConfig backupRestoreConfig) throws Exception { new Expectations() { { backupRestoreConfig.getSnapshotMetaServiceCronExpression(); result = "0 0 0/1 1/1 * ? *"; backupRestoreConfig.getBackupTTLMonitorPeriodInSec(); result = 600; backupRestoreConfig.getBackupVerificationCronExpression(); result = "0 0 0/1 1/1 * ? *"; backupRestoreConfig.enableV2Backups(); result = true; configuration.isIncrementalBackupEnabled(); result = true; configuration.getBackupCronExpression(); result = "-1"; } }; IService backupService = new BackupV2Service( configuration, backupRestoreConfig, scheduler, snapshotMetaTask, cassandraTunerService); backupService.scheduleService(); Assert.assertEquals(4, scheduler.getScheduler().getJobKeys(null).size()); }
@Override public void scheduleService() throws Exception { TaskTimer snapshotMetaTimer = SnapshotMetaTask.getTimer(configuration, backupRestoreConfig); scheduleTask(scheduler, SnapshotMetaTask.class, snapshotMetaTimer); if (snapshotMetaTimer != null) { snapshotMetaTask.uploadFiles(); scheduleTask( scheduler, BackupTTLTask.class, BackupTTLTask.getTimer(backupRestoreConfig)); scheduleTask( scheduler, BackupVerificationTask.class, BackupVerificationTask.getTimer(backupRestoreConfig)); } else { scheduler.deleteTask(BackupTTLTask.JOBNAME); scheduler.deleteTask(BackupVerificationTask.JOBNAME); } scheduleTask( scheduler, IncrementalBackup.class, IncrementalBackup.getTimer(configuration, backupRestoreConfig)); }
BackupV2Service implements IService { @Override public void scheduleService() throws Exception { TaskTimer snapshotMetaTimer = SnapshotMetaTask.getTimer(configuration, backupRestoreConfig); scheduleTask(scheduler, SnapshotMetaTask.class, snapshotMetaTimer); if (snapshotMetaTimer != null) { snapshotMetaTask.uploadFiles(); scheduleTask( scheduler, BackupTTLTask.class, BackupTTLTask.getTimer(backupRestoreConfig)); scheduleTask( scheduler, BackupVerificationTask.class, BackupVerificationTask.getTimer(backupRestoreConfig)); } else { scheduler.deleteTask(BackupTTLTask.JOBNAME); scheduler.deleteTask(BackupVerificationTask.JOBNAME); } scheduleTask( scheduler, IncrementalBackup.class, IncrementalBackup.getTimer(configuration, backupRestoreConfig)); } }
BackupV2Service implements IService { @Override public void scheduleService() throws Exception { TaskTimer snapshotMetaTimer = SnapshotMetaTask.getTimer(configuration, backupRestoreConfig); scheduleTask(scheduler, SnapshotMetaTask.class, snapshotMetaTimer); if (snapshotMetaTimer != null) { snapshotMetaTask.uploadFiles(); scheduleTask( scheduler, BackupTTLTask.class, BackupTTLTask.getTimer(backupRestoreConfig)); scheduleTask( scheduler, BackupVerificationTask.class, BackupVerificationTask.getTimer(backupRestoreConfig)); } else { scheduler.deleteTask(BackupTTLTask.JOBNAME); scheduler.deleteTask(BackupVerificationTask.JOBNAME); } scheduleTask( scheduler, IncrementalBackup.class, IncrementalBackup.getTimer(configuration, backupRestoreConfig)); } @Inject  BackupV2Service(
            IConfiguration configuration,
            IBackupRestoreConfig backupRestoreConfig,
            PriamScheduler scheduler,
            SnapshotMetaTask snapshotMetaService,
            CassandraTunerService cassandraTunerService); }
BackupV2Service implements IService { @Override public void scheduleService() throws Exception { TaskTimer snapshotMetaTimer = SnapshotMetaTask.getTimer(configuration, backupRestoreConfig); scheduleTask(scheduler, SnapshotMetaTask.class, snapshotMetaTimer); if (snapshotMetaTimer != null) { snapshotMetaTask.uploadFiles(); scheduleTask( scheduler, BackupTTLTask.class, BackupTTLTask.getTimer(backupRestoreConfig)); scheduleTask( scheduler, BackupVerificationTask.class, BackupVerificationTask.getTimer(backupRestoreConfig)); } else { scheduler.deleteTask(BackupTTLTask.JOBNAME); scheduler.deleteTask(BackupVerificationTask.JOBNAME); } scheduleTask( scheduler, IncrementalBackup.class, IncrementalBackup.getTimer(configuration, backupRestoreConfig)); } @Inject  BackupV2Service(
            IConfiguration configuration,
            IBackupRestoreConfig backupRestoreConfig,
            PriamScheduler scheduler,
            SnapshotMetaTask snapshotMetaService,
            CassandraTunerService cassandraTunerService); @Override void scheduleService(); @Override void updateServicePre(); @Override void updateServicePost(); }
BackupV2Service implements IService { @Override public void scheduleService() throws Exception { TaskTimer snapshotMetaTimer = SnapshotMetaTask.getTimer(configuration, backupRestoreConfig); scheduleTask(scheduler, SnapshotMetaTask.class, snapshotMetaTimer); if (snapshotMetaTimer != null) { snapshotMetaTask.uploadFiles(); scheduleTask( scheduler, BackupTTLTask.class, BackupTTLTask.getTimer(backupRestoreConfig)); scheduleTask( scheduler, BackupVerificationTask.class, BackupVerificationTask.getTimer(backupRestoreConfig)); } else { scheduler.deleteTask(BackupTTLTask.JOBNAME); scheduler.deleteTask(BackupVerificationTask.JOBNAME); } scheduleTask( scheduler, IncrementalBackup.class, IncrementalBackup.getTimer(configuration, backupRestoreConfig)); } @Inject  BackupV2Service(
            IConfiguration configuration,
            IBackupRestoreConfig backupRestoreConfig,
            PriamScheduler scheduler,
            SnapshotMetaTask snapshotMetaService,
            CassandraTunerService cassandraTunerService); @Override void scheduleService(); @Override void updateServicePre(); @Override void updateServicePost();  }