@Test public void assertLoadFromCacheButNull() { when(jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT)).thenReturn(null); when(jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT)).thenReturn(LiteYamlConstants.getJobYaml()); JobConfiguration actual = configService.load(true); assertThat(actual.getJobName(), is("test_job")); assertThat(actual.getCron(), is("0/1 * * * * ?")); assertThat(actual.getShardingTotalCount(), is(3)); }
public JobConfiguration load(final boolean fromCache) { String result; if (fromCache) { result = jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT); if (null == result) { result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT); } } else { result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT); } return YamlEngine.unmarshal(result, JobConfigurationPOJO.class).toJobConfiguration(); }
ConfigurationService { public JobConfiguration load(final boolean fromCache) { String result; if (fromCache) { result = jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT); if (null == result) { result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT); } } else { result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT); } return YamlEngine.unmarshal(result, JobConfigurationPOJO.class).toJobConfiguration(); } }
ConfigurationService { public JobConfiguration load(final boolean fromCache) { String result; if (fromCache) { result = jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT); if (null == result) { result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT); } } else { result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT); } return YamlEngine.unmarshal(result, JobConfigurationPOJO.class).toJobConfiguration(); } ConfigurationService(final CoordinatorRegistryCenter regCenter, final String jobName); }
ConfigurationService { public JobConfiguration load(final boolean fromCache) { String result; if (fromCache) { result = jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT); if (null == result) { result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT); } } else { result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT); } return YamlEngine.unmarshal(result, JobConfigurationPOJO.class).toJobConfiguration(); } ConfigurationService(final CoordinatorRegistryCenter regCenter, final String jobName); JobConfiguration load(final boolean fromCache); JobConfiguration setUpJobConfiguration(final String jobClassName, final JobConfiguration jobConfig); void checkMaxTimeDiffSecondsTolerable(); }
ConfigurationService { public JobConfiguration load(final boolean fromCache) { String result; if (fromCache) { result = jobNodeStorage.getJobNodeData(ConfigurationNode.ROOT); if (null == result) { result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT); } } else { result = jobNodeStorage.getJobNodeDataDirectly(ConfigurationNode.ROOT); } return YamlEngine.unmarshal(result, JobConfigurationPOJO.class).toJobConfiguration(); } ConfigurationService(final CoordinatorRegistryCenter regCenter, final String jobName); JobConfiguration load(final boolean fromCache); JobConfiguration setUpJobConfiguration(final String jobClassName, final JobConfiguration jobConfig); void checkMaxTimeDiffSecondsTolerable();  }