use of com.dangdang.ddframe.job.lite.lifecycle.domain.JobSettings in project elastic-job by dangdangdotcom.
the class JobSettingsAPIImplTest method assertGetScriptJobSettings.
@Test
public void assertGetScriptJobSettings() {
when(regCenter.get("/test_job/config")).thenReturn(LifecycleJsonConstants.getScriptJobJson());
JobSettings actual = jobSettingsAPI.getJobSettings("test_job");
assertJobSettings(actual, "SCRIPT", "com.dangdang.ddframe.job.api.script.ScriptJob");
verify(regCenter).get("/test_job/config");
}
use of com.dangdang.ddframe.job.lite.lifecycle.domain.JobSettings in project elastic-job by dangdangdotcom.
the class JobSettingsAPIImplTest method assertUpdateJobSettings.
@Test
public void assertUpdateJobSettings() {
when(regCenter.get("/test_job/config")).thenReturn(LifecycleJsonConstants.getDataflowJobJson());
JobSettings jobSettings = new JobSettings();
jobSettings.setJobName("test_job");
jobSettings.setJobClass("com.dangdang.ddframe.job.lite.fixture.TestDataflowJob");
jobSettings.setShardingTotalCount(10);
jobSettings.setMaxTimeDiffSeconds(-1);
jobSettings.setMonitorExecution(true);
jobSettings.setCron("0/1 * * * * ?");
jobSettings.setStreamingProcess(true);
jobSettings.setFailover(false);
jobSettings.setMisfire(true);
jobSettings.getJobProperties().put(JobPropertiesEnum.EXECUTOR_SERVICE_HANDLER.getKey(), DefaultExecutorServiceHandler.class.getCanonicalName());
jobSettings.getJobProperties().put(JobPropertiesEnum.JOB_EXCEPTION_HANDLER.getKey(), DefaultJobExceptionHandler.class.getCanonicalName());
jobSettings.setReconcileIntervalMinutes(70);
jobSettingsAPI.updateJobSettings(jobSettings);
verify(regCenter).update("/test_job/config", "{\"jobName\":\"test_job\",\"jobClass\":\"com.dangdang.ddframe.job.lite.fixture.TestDataflowJob\"," + "\"cron\":\"0/1 * * * * ?\",\"shardingTotalCount\":10,\"monitorExecution\":true,\"streamingProcess\":true," + "\"maxTimeDiffSeconds\":-1,\"monitorPort\":-1,\"failover\":false,\"misfire\":true," + "\"jobProperties\":{\"executor_service_handler\":\"" + DefaultExecutorServiceHandler.class.getCanonicalName() + "\"," + "\"job_exception_handler\":\"" + DefaultJobExceptionHandler.class.getCanonicalName() + "\"},\"reconcileIntervalMinutes\":70}");
}
use of com.dangdang.ddframe.job.lite.lifecycle.domain.JobSettings in project elastic-job by dangdangdotcom.
the class JobSettingsAPIImpl method getJobSettings.
@Override
public JobSettings getJobSettings(final String jobName) {
JobSettings result = new JobSettings();
JobNodePath jobNodePath = new JobNodePath(jobName);
LiteJobConfiguration liteJobConfig = LiteJobConfigurationGsonFactory.fromJson(regCenter.get(jobNodePath.getConfigNodePath()));
String jobType = liteJobConfig.getTypeConfig().getJobType().name();
buildSimpleJobSettings(jobName, result, liteJobConfig);
if (JobType.DATAFLOW.name().equals(jobType)) {
buildDataflowJobSettings(result, (DataflowJobConfiguration) liteJobConfig.getTypeConfig());
}
if (JobType.SCRIPT.name().equals(jobType)) {
buildScriptJobSettings(result, (ScriptJobConfiguration) liteJobConfig.getTypeConfig());
}
return result;
}
use of com.dangdang.ddframe.job.lite.lifecycle.domain.JobSettings in project elastic-job by dangdangdotcom.
the class JobSettingsAPIImplTest method assertGetDataflowJobSettings.
@Test
public void assertGetDataflowJobSettings() {
when(regCenter.get("/test_job/config")).thenReturn(LifecycleJsonConstants.getDataflowJobJson());
JobSettings actual = jobSettingsAPI.getJobSettings("test_job");
assertJobSettings(actual, "DATAFLOW", "com.dangdang.ddframe.job.lite.fixture.TestDataflowJob");
verify(regCenter).get("/test_job/config");
}
Aggregations