@Test(expected = JobConfigurationException.class) public void assertSetUpJobConfigurationJobConfigurationForJobConflict() { when(jobNodeStorage.isJobRootNodeExisted()).thenReturn(true); when(jobNodeStorage.getJobRootNodeData()).thenReturn("org.apache.shardingsphere.elasticjob.lite.api.script.api.ScriptJob"); try { configService.setUpJobConfiguration(null, JobConfiguration.newBuilder("test_job", 3).cron("0/1 * * * * ?").build()); } finally { verify(jobNodeStorage).isJobRootNodeExisted(); verify(jobNodeStorage).getJobRootNodeData(); } }
public JobConfiguration setUpJobConfiguration(final String jobClassName, final JobConfiguration jobConfig) { checkConflictJob(jobClassName, jobConfig); if (!jobNodeStorage.isJobNodeExisted(ConfigurationNode.ROOT) || jobConfig.isOverwrite()) { jobNodeStorage.replaceJobNode(ConfigurationNode.ROOT, YamlEngine.marshal(JobConfigurationPOJO.fromJobConfiguration(jobConfig))); jobNodeStorage.replaceJobRootNode(jobClassName); return jobConfig; } return load(false); }
ConfigurationService { public JobConfiguration setUpJobConfiguration(final String jobClassName, final JobConfiguration jobConfig) { checkConflictJob(jobClassName, jobConfig); if (!jobNodeStorage.isJobNodeExisted(ConfigurationNode.ROOT) || jobConfig.isOverwrite()) { jobNodeStorage.replaceJobNode(ConfigurationNode.ROOT, YamlEngine.marshal(JobConfigurationPOJO.fromJobConfiguration(jobConfig))); jobNodeStorage.replaceJobRootNode(jobClassName); return jobConfig; } return load(false); } }
ConfigurationService { public JobConfiguration setUpJobConfiguration(final String jobClassName, final JobConfiguration jobConfig) { checkConflictJob(jobClassName, jobConfig); if (!jobNodeStorage.isJobNodeExisted(ConfigurationNode.ROOT) || jobConfig.isOverwrite()) { jobNodeStorage.replaceJobNode(ConfigurationNode.ROOT, YamlEngine.marshal(JobConfigurationPOJO.fromJobConfiguration(jobConfig))); jobNodeStorage.replaceJobRootNode(jobClassName); return jobConfig; } return load(false); } ConfigurationService(final CoordinatorRegistryCenter regCenter, final String jobName); }
ConfigurationService { public JobConfiguration setUpJobConfiguration(final String jobClassName, final JobConfiguration jobConfig) { checkConflictJob(jobClassName, jobConfig); if (!jobNodeStorage.isJobNodeExisted(ConfigurationNode.ROOT) || jobConfig.isOverwrite()) { jobNodeStorage.replaceJobNode(ConfigurationNode.ROOT, YamlEngine.marshal(JobConfigurationPOJO.fromJobConfiguration(jobConfig))); jobNodeStorage.replaceJobRootNode(jobClassName); return jobConfig; } return load(false); } 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 setUpJobConfiguration(final String jobClassName, final JobConfiguration jobConfig) { checkConflictJob(jobClassName, jobConfig); if (!jobNodeStorage.isJobNodeExisted(ConfigurationNode.ROOT) || jobConfig.isOverwrite()) { jobNodeStorage.replaceJobNode(ConfigurationNode.ROOT, YamlEngine.marshal(JobConfigurationPOJO.fromJobConfiguration(jobConfig))); jobNodeStorage.replaceJobRootNode(jobClassName); return jobConfig; } return load(false); } ConfigurationService(final CoordinatorRegistryCenter regCenter, final String jobName); JobConfiguration load(final boolean fromCache); JobConfiguration setUpJobConfiguration(final String jobClassName, final JobConfiguration jobConfig); void checkMaxTimeDiffSecondsTolerable();  }