JobFacade { public void registerJobCompleted(final JobExecutionMultipleShardingContext shardingContext, boolean completeFlag) { executionService.registerJobCompleted(shardingContext, completeFlag); if (configService.isFailover()) { failoverService.updateFailoverComplete(shardingContext.getShardingItems()); } } JobFacade(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration, final List<ElasticJobListener> elasticJobListeners); String getJobName(); int getConcurrentDataProcessThreadCount(); void checkMaxTimeDiffSecondsTolerable(); void failoverIfNecessary(); void registerJobBegin(final JobExecutionMultipleShardingContext shardingContext); void registerJobCompleted(final JobExecutionMultipleShardingContext shardingContext, boolean completeFlag); JobExecutionMultipleShardingContext getShardingContext(); boolean misfireIfNecessary(final List<Integer> shardingItems); void clearMisfire(final List<Integer> shardingItems); boolean isExecuteMisfired(final List<Integer> shardingItems); boolean isEligibleForJobRunning(); boolean isNeedSharding(); void updateOffset(final int item, final String offset); void cleanPreviousExecutionInfo(); void beforeJobExecuted(final JobExecutionMultipleShardingContext shardingContext); void afterJobExecuted(final JobExecutionMultipleShardingContext shardingContext); boolean inSkipTime(); boolean isLocalServerDisabled();  }
@Test public void testRegisterJobCompletedWhenFailoverDisabled() { JobExecutionMultipleShardingContext shardingContext = new JobExecutionMultipleShardingContext(); when(configService.isFailover()).thenReturn(false); jobFacade.registerJobCompleted(shardingContext, true); verify(executionService).registerJobCompleted(shardingContext, true); verify(failoverService, times(0)).updateFailoverComplete(shardingContext.getShardingItems()); }
@Test public void testRegisterJobCompletedWhenFailoverEnabled() { JobExecutionMultipleShardingContext shardingContext = new JobExecutionMultipleShardingContext(); when(configService.isFailover()).thenReturn(true); jobFacade.registerJobCompleted(shardingContext, true); verify(executionService).registerJobCompleted(shardingContext, true); verify(failoverService).updateFailoverComplete(shardingContext.getShardingItems()); }