@Test void skipAll() { this.environment.setProperty( DatabaseCleanupProperties.ApplicationDatabaseCleanupProperties.SKIP_PROPERTY, "true" ); this.environment.setProperty(DatabaseCleanupProperties.CommandDatabaseCleanupProperties.SKIP_PROPERTY, "true"); this.environment.setProperty( DatabaseCleanupProperties.CommandDeactivationDatabaseCleanupProperties.SKIP_PROPERTY, "true" ); this.environment.setProperty(DatabaseCleanupProperties.ClusterDatabaseCleanupProperties.SKIP_PROPERTY, "true"); this.environment.setProperty(DatabaseCleanupProperties.FileDatabaseCleanupProperties.SKIP_PROPERTY, "true"); this.environment.setProperty(DatabaseCleanupProperties.JobDatabaseCleanupProperties.SKIP_PROPERTY, "true"); this.environment.setProperty(DatabaseCleanupProperties.TagDatabaseCleanupProperties.SKIP_PROPERTY, "true"); Mockito.when(this.applicationCleanupProperties.isSkip()).thenReturn(false); Mockito.when(this.commandCleanupProperties.isSkip()).thenReturn(false); Mockito.when(this.commandDeactivationProperties.isSkip()).thenReturn(false); Mockito.when(this.clusterCleanupProperties.isSkip()).thenReturn(false); Mockito.when(this.fileCleanupProperties.isSkip()).thenReturn(false); Mockito.when(this.tagCleanupProperties.isSkip()).thenReturn(false); Mockito.when(this.jobCleanupProperties.isSkip()).thenReturn(false); this.task.run(); Mockito .verify(this.persistenceService, Mockito.never()) .deleteUnusedApplications(Mockito.any(Instant.class)); Mockito .verify(this.persistenceService, Mockito.never()) .deleteUnusedCommands(Mockito.anySet(), Mockito.any(Instant.class)); Mockito .verify(this.persistenceService, Mockito.never()) .updateStatusForUnusedCommands( Mockito.any(CommandStatus.class), Mockito.any(Instant.class), Mockito.anySet(), Mockito.any(Instant.class) ); Mockito .verify(this.persistenceService, Mockito.never()) .deleteJobsCreatedBefore( Mockito.any(Instant.class), Mockito.anySet(), Mockito.anyInt() ); Mockito .verify(this.persistenceService, Mockito.never()) .deleteUnusedClusters(Mockito.anySet(), Mockito.any(Instant.class)); Mockito .verify(this.persistenceService, Mockito.never()) .deleteUnusedFiles(Mockito.any(Instant.class)); Mockito .verify(this.persistenceService, Mockito.never()) .deleteUnusedTags(Mockito.any(Instant.class)); }
@Override public void run() { final long start = System.nanoTime(); final Instant runtime = Instant.now(); final Set<Tag> tags = Sets.newHashSet(); try { this.deleteJobs(); final Instant creationThreshold = runtime.minus(1L, ChronoUnit.HOURS); this.deleteClusters(creationThreshold); this.deactivateCommands(runtime); this.deleteCommands(creationThreshold); this.deleteApplications(creationThreshold); this.deleteFiles(creationThreshold); this.deleteTags(creationThreshold); MetricsUtils.addSuccessTags(tags); } catch (final Throwable t) { MetricsUtils.addFailureTagsWithException(tags, t); throw t; } finally { this.registry .timer(DATABASE_CLEANUP_DURATION_TIMER_NAME, tags) .record(System.nanoTime() - start, TimeUnit.NANOSECONDS); } }
DatabaseCleanupTask extends LeaderTask { @Override public void run() { final long start = System.nanoTime(); final Instant runtime = Instant.now(); final Set<Tag> tags = Sets.newHashSet(); try { this.deleteJobs(); final Instant creationThreshold = runtime.minus(1L, ChronoUnit.HOURS); this.deleteClusters(creationThreshold); this.deactivateCommands(runtime); this.deleteCommands(creationThreshold); this.deleteApplications(creationThreshold); this.deleteFiles(creationThreshold); this.deleteTags(creationThreshold); MetricsUtils.addSuccessTags(tags); } catch (final Throwable t) { MetricsUtils.addFailureTagsWithException(tags, t); throw t; } finally { this.registry .timer(DATABASE_CLEANUP_DURATION_TIMER_NAME, tags) .record(System.nanoTime() - start, TimeUnit.NANOSECONDS); } } }
DatabaseCleanupTask extends LeaderTask { @Override public void run() { final long start = System.nanoTime(); final Instant runtime = Instant.now(); final Set<Tag> tags = Sets.newHashSet(); try { this.deleteJobs(); final Instant creationThreshold = runtime.minus(1L, ChronoUnit.HOURS); this.deleteClusters(creationThreshold); this.deactivateCommands(runtime); this.deleteCommands(creationThreshold); this.deleteApplications(creationThreshold); this.deleteFiles(creationThreshold); this.deleteTags(creationThreshold); MetricsUtils.addSuccessTags(tags); } catch (final Throwable t) { MetricsUtils.addFailureTagsWithException(tags, t); throw t; } finally { this.registry .timer(DATABASE_CLEANUP_DURATION_TIMER_NAME, tags) .record(System.nanoTime() - start, TimeUnit.NANOSECONDS); } } DatabaseCleanupTask(
        @NotNull final DatabaseCleanupProperties cleanupProperties,
        @NotNull final Environment environment,
        @NotNull final DataServices dataServices,
        @NotNull final MeterRegistry registry
    ); }
DatabaseCleanupTask extends LeaderTask { @Override public void run() { final long start = System.nanoTime(); final Instant runtime = Instant.now(); final Set<Tag> tags = Sets.newHashSet(); try { this.deleteJobs(); final Instant creationThreshold = runtime.minus(1L, ChronoUnit.HOURS); this.deleteClusters(creationThreshold); this.deactivateCommands(runtime); this.deleteCommands(creationThreshold); this.deleteApplications(creationThreshold); this.deleteFiles(creationThreshold); this.deleteTags(creationThreshold); MetricsUtils.addSuccessTags(tags); } catch (final Throwable t) { MetricsUtils.addFailureTagsWithException(tags, t); throw t; } finally { this.registry .timer(DATABASE_CLEANUP_DURATION_TIMER_NAME, tags) .record(System.nanoTime() - start, TimeUnit.NANOSECONDS); } } DatabaseCleanupTask(
        @NotNull final DatabaseCleanupProperties cleanupProperties,
        @NotNull final Environment environment,
        @NotNull final DataServices dataServices,
        @NotNull final MeterRegistry registry
    ); @Override GenieTaskScheduleType getScheduleType(); @Override Trigger getTrigger(); @Override void run(); @Override void cleanup(); }
DatabaseCleanupTask extends LeaderTask { @Override public void run() { final long start = System.nanoTime(); final Instant runtime = Instant.now(); final Set<Tag> tags = Sets.newHashSet(); try { this.deleteJobs(); final Instant creationThreshold = runtime.minus(1L, ChronoUnit.HOURS); this.deleteClusters(creationThreshold); this.deactivateCommands(runtime); this.deleteCommands(creationThreshold); this.deleteApplications(creationThreshold); this.deleteFiles(creationThreshold); this.deleteTags(creationThreshold); MetricsUtils.addSuccessTags(tags); } catch (final Throwable t) { MetricsUtils.addFailureTagsWithException(tags, t); throw t; } finally { this.registry .timer(DATABASE_CLEANUP_DURATION_TIMER_NAME, tags) .record(System.nanoTime() - start, TimeUnit.NANOSECONDS); } } DatabaseCleanupTask(
        @NotNull final DatabaseCleanupProperties cleanupProperties,
        @NotNull final Environment environment,
        @NotNull final DataServices dataServices,
        @NotNull final MeterRegistry registry
    ); @Override GenieTaskScheduleType getScheduleType(); @Override Trigger getTrigger(); @Override void run(); @Override void cleanup();  }