@Test public void assertFindLatestTaskResultStatisticsWhenRdbIsNotConfigured() { ReflectionUtils.setFieldValue(statisticManager, "rdbRepository", null); for (StatisticInterval each : StatisticInterval.values()) { TaskResultStatistics actual = statisticManager.findLatestTaskResultStatistics(each); assertThat(actual.getSuccessCount(), is(0)); assertThat(actual.getFailedCount(), is(0)); } }
public TaskResultStatistics findLatestTaskResultStatistics(final StatisticInterval statisticInterval) { if (isRdbConfigured()) { Optional<TaskResultStatistics> result = rdbRepository.findLatestTaskResultStatistics(statisticInterval); if (result.isPresent()) { return result.get(); } } return new TaskResultStatistics(0, 0, statisticInterval, new Date()); }
StatisticManager { public TaskResultStatistics findLatestTaskResultStatistics(final StatisticInterval statisticInterval) { if (isRdbConfigured()) { Optional<TaskResultStatistics> result = rdbRepository.findLatestTaskResultStatistics(statisticInterval); if (result.isPresent()) { return result.get(); } } return new TaskResultStatistics(0, 0, statisticInterval, new Date()); } }
StatisticManager { public TaskResultStatistics findLatestTaskResultStatistics(final StatisticInterval statisticInterval) { if (isRdbConfigured()) { Optional<TaskResultStatistics> result = rdbRepository.findLatestTaskResultStatistics(statisticInterval); if (result.isPresent()) { return result.get(); } } return new TaskResultStatistics(0, 0, statisticInterval, new Date()); } private  StatisticManager(final CoordinatorRegistryCenter registryCenter, final TracingConfiguration tracingConfiguration,
                             final StatisticsScheduler scheduler, final Map<StatisticInterval, TaskResultMetaData> statisticData); }
StatisticManager { public TaskResultStatistics findLatestTaskResultStatistics(final StatisticInterval statisticInterval) { if (isRdbConfigured()) { Optional<TaskResultStatistics> result = rdbRepository.findLatestTaskResultStatistics(statisticInterval); if (result.isPresent()) { return result.get(); } } return new TaskResultStatistics(0, 0, statisticInterval, new Date()); } private  StatisticManager(final CoordinatorRegistryCenter registryCenter, final TracingConfiguration tracingConfiguration,
                             final StatisticsScheduler scheduler, final Map<StatisticInterval, TaskResultMetaData> statisticData); static StatisticManager getInstance(final CoordinatorRegistryCenter regCenter, final TracingConfiguration tracingConfiguration); void startup(); void shutdown(); void taskRunSuccessfully(); void taskRunFailed(); TaskResultStatistics getTaskResultStatisticsWeekly(); TaskResultStatistics getTaskResultStatisticsSinceOnline(); TaskResultStatistics findLatestTaskResultStatistics(final StatisticInterval statisticInterval); List<TaskResultStatistics> findTaskResultStatisticsDaily(); JobExecutionTypeStatistics getJobExecutionTypeStatistics(); List<TaskRunningStatistics> findTaskRunningStatisticsWeekly(); List<JobRunningStatistics> findJobRunningStatisticsWeekly(); List<JobRegisterStatistics> findJobRegisterStatisticsSinceOnline(); }
StatisticManager { public TaskResultStatistics findLatestTaskResultStatistics(final StatisticInterval statisticInterval) { if (isRdbConfigured()) { Optional<TaskResultStatistics> result = rdbRepository.findLatestTaskResultStatistics(statisticInterval); if (result.isPresent()) { return result.get(); } } return new TaskResultStatistics(0, 0, statisticInterval, new Date()); } private  StatisticManager(final CoordinatorRegistryCenter registryCenter, final TracingConfiguration tracingConfiguration,
                             final StatisticsScheduler scheduler, final Map<StatisticInterval, TaskResultMetaData> statisticData); static StatisticManager getInstance(final CoordinatorRegistryCenter regCenter, final TracingConfiguration tracingConfiguration); void startup(); void shutdown(); void taskRunSuccessfully(); void taskRunFailed(); TaskResultStatistics getTaskResultStatisticsWeekly(); TaskResultStatistics getTaskResultStatisticsSinceOnline(); TaskResultStatistics findLatestTaskResultStatistics(final StatisticInterval statisticInterval); List<TaskResultStatistics> findTaskResultStatisticsDaily(); JobExecutionTypeStatistics getJobExecutionTypeStatistics(); List<TaskRunningStatistics> findTaskRunningStatisticsWeekly(); List<JobRunningStatistics> findJobRunningStatisticsWeekly(); List<JobRegisterStatistics> findJobRegisterStatisticsSinceOnline();  }