@Test public void updateService( @Mocked IConfiguration configuration, @Mocked IBackupRestoreConfig backupRestoreConfig, @Mocked JMXNodeTool nodeTool, @Mocked TuneCassandra tuneCassandra) throws Exception { new Expectations() { { backupRestoreConfig.getSnapshotMetaServiceCronExpression(); result = "0 0 0/1 1/1 * ? *"; result = "0 0 0/1 1/1 * ? *"; result = "-1"; result = "-1"; configuration.isIncrementalBackupEnabled(); result = true; backupRestoreConfig.enableV2Backups(); result = true; backupRestoreConfig.getBackupVerificationCronExpression(); result = "-1"; backupRestoreConfig.getBackupTTLMonitorPeriodInSec(); result = 600; configuration.getBackupCronExpression(); result = "-1"; } }; IService backupService = new BackupV2Service( configuration, backupRestoreConfig, scheduler, snapshotMetaTask, cassandraTunerService); backupService.scheduleService(); Assert.assertEquals(3, scheduler.getScheduler().getJobKeys(null).size()); backupService.onChangeUpdateService(); Assert.assertEquals(0, 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();  }