ConfigurationService { public boolean isFailover() { return isMonitorExecution() && Boolean.valueOf(jobNodeStorage.getJobNodeData(ConfigurationNode.FAILOVER)); } ConfigurationService(final CoordinatorRegistryCenter coordinatorRegistryCenter, final JobConfiguration jobConfiguration); void persistJobConfiguration(); int getShardingTotalCount(); Map<Integer, String> getShardingItemParameters(); String getJobParameter(); String getCron(); boolean isMonitorExecution(); int getProcessCountIntervalSeconds(); int getConcurrentDataProcessThreadCount(); int getFetchDataCount(); void checkMaxTimeDiffSecondsTolerable(); boolean isFailover(); boolean isMisfire(); String getJobShardingStrategyClass(); int getMonitorPort(); String getJobName(); String getScriptCommandLine();  }
@Test public void assertIsNotFailoverWhenNotMonitorExecution() { when(jobNodeStorage.getJobNodeData(ConfigurationNode.MONITOR_EXECUTION)).thenReturn("false"); assertFalse(configService.isFailover()); verify(jobNodeStorage).getJobNodeData(ConfigurationNode.MONITOR_EXECUTION); }
@Test public void assertIsNotFailoverWhenMonitorExecution() { when(jobNodeStorage.getJobNodeData(ConfigurationNode.MONITOR_EXECUTION)).thenReturn("true"); when(jobNodeStorage.getJobNodeData(ConfigurationNode.FAILOVER)).thenReturn("false"); assertFalse(configService.isFailover()); verify(jobNodeStorage).getJobNodeData(ConfigurationNode.MONITOR_EXECUTION); verify(jobNodeStorage).getJobNodeData(ConfigurationNode.FAILOVER); }
@Test public void assertIsFailover() { when(jobNodeStorage.getJobNodeData(ConfigurationNode.MONITOR_EXECUTION)).thenReturn("true"); when(jobNodeStorage.getJobNodeData(ConfigurationNode.FAILOVER)).thenReturn("true"); assertTrue(configService.isFailover()); verify(jobNodeStorage).getJobNodeData(ConfigurationNode.MONITOR_EXECUTION); verify(jobNodeStorage).getJobNodeData(ConfigurationNode.FAILOVER); }