@Test public void updateService( @Mocked IConfiguration configuration, @Mocked IBackupRestoreConfig backupRestoreConfig, @Mocked JMXNodeTool nodeTool, @Mocked TuneCassandra tuneCassandra) throws Exception { new Expectations() { { configuration.getBackupCronExpression(); result = "0 0/1 * 1/1 * ? *"; result = "0 0/1 * 1/1 * ? *"; result = "-1"; result = "-1"; configuration.isIncrementalBackupEnabled(); result = true; backupRestoreConfig.enableV2Backups(); result = true; backupRestoreConfig.getSnapshotMetaServiceCronExpression(); result = "0 0/1 * 1/1 * ? *"; } }; IService backupService = new BackupService( configuration, backupRestoreConfig, scheduler, cassandraTunerService); backupService.scheduleService(); Assert.assertEquals(3, scheduler.getScheduler().getJobKeys(null).size()); System.out.println("After updated"); backupService.onChangeUpdateService(); System.out.println(scheduler.getScheduler().getJobKeys(null)); Assert.assertEquals(2, scheduler.getScheduler().getJobKeys(null).size()); }
@Override public void scheduleService() throws Exception { TaskTimer snapshotTimer = SnapshotBackup.getTimer(config); scheduleTask(scheduler, SnapshotBackup.class, snapshotTimer); if (snapshotTimer != null) { scheduleTask(scheduler, UpdateCleanupPolicy.class, UpdateCleanupPolicy.getTimer()); scheduleTask( scheduler, CommitLogBackupTask.class, CommitLogBackupTask.getTimer(config)); } scheduleTask( scheduler, IncrementalBackup.class, IncrementalBackup.getTimer(config, backupRestoreConfig)); }
BackupService implements IService { @Override public void scheduleService() throws Exception { TaskTimer snapshotTimer = SnapshotBackup.getTimer(config); scheduleTask(scheduler, SnapshotBackup.class, snapshotTimer); if (snapshotTimer != null) { scheduleTask(scheduler, UpdateCleanupPolicy.class, UpdateCleanupPolicy.getTimer()); scheduleTask( scheduler, CommitLogBackupTask.class, CommitLogBackupTask.getTimer(config)); } scheduleTask( scheduler, IncrementalBackup.class, IncrementalBackup.getTimer(config, backupRestoreConfig)); } }
BackupService implements IService { @Override public void scheduleService() throws Exception { TaskTimer snapshotTimer = SnapshotBackup.getTimer(config); scheduleTask(scheduler, SnapshotBackup.class, snapshotTimer); if (snapshotTimer != null) { scheduleTask(scheduler, UpdateCleanupPolicy.class, UpdateCleanupPolicy.getTimer()); scheduleTask( scheduler, CommitLogBackupTask.class, CommitLogBackupTask.getTimer(config)); } scheduleTask( scheduler, IncrementalBackup.class, IncrementalBackup.getTimer(config, backupRestoreConfig)); } @Inject  BackupService(
            IConfiguration config,
            IBackupRestoreConfig backupRestoreConfig,
            PriamScheduler priamScheduler,
            CassandraTunerService cassandraTunerService); }
BackupService implements IService { @Override public void scheduleService() throws Exception { TaskTimer snapshotTimer = SnapshotBackup.getTimer(config); scheduleTask(scheduler, SnapshotBackup.class, snapshotTimer); if (snapshotTimer != null) { scheduleTask(scheduler, UpdateCleanupPolicy.class, UpdateCleanupPolicy.getTimer()); scheduleTask( scheduler, CommitLogBackupTask.class, CommitLogBackupTask.getTimer(config)); } scheduleTask( scheduler, IncrementalBackup.class, IncrementalBackup.getTimer(config, backupRestoreConfig)); } @Inject  BackupService(
            IConfiguration config,
            IBackupRestoreConfig backupRestoreConfig,
            PriamScheduler priamScheduler,
            CassandraTunerService cassandraTunerService); @Override void scheduleService(); @Override void updateServicePre(); @Override void updateServicePost(); }
BackupService implements IService { @Override public void scheduleService() throws Exception { TaskTimer snapshotTimer = SnapshotBackup.getTimer(config); scheduleTask(scheduler, SnapshotBackup.class, snapshotTimer); if (snapshotTimer != null) { scheduleTask(scheduler, UpdateCleanupPolicy.class, UpdateCleanupPolicy.getTimer()); scheduleTask( scheduler, CommitLogBackupTask.class, CommitLogBackupTask.getTimer(config)); } scheduleTask( scheduler, IncrementalBackup.class, IncrementalBackup.getTimer(config, backupRestoreConfig)); } @Inject  BackupService(
            IConfiguration config,
            IBackupRestoreConfig backupRestoreConfig,
            PriamScheduler priamScheduler,
            CassandraTunerService cassandraTunerService); @Override void scheduleService(); @Override void updateServicePre(); @Override void updateServicePost();  }