@Test public void assertToJobConfiguration() { CloudJobConfigurationPOJO pojo = new CloudJobConfigurationPOJO(); pojo.setAppName("app"); pojo.setCpuCount(1d); pojo.setMemoryMB(128d); pojo.setJobExecutionType(CloudJobExecutionType.DAEMON); pojo.setJobName("test_job"); pojo.setCron("0/1 * * * * ?"); pojo.setShardingTotalCount(3); pojo.setShardingItemParameters("0=A,1=B,2=C"); pojo.setJobParameter("param"); pojo.setMonitorExecution(true); pojo.setFailover(true); pojo.setMisfire(true); pojo.setJobShardingStrategyType("AVG_ALLOCATION"); pojo.setJobExecutorServiceHandlerType("CPU"); pojo.setJobErrorHandlerType("IGNORE"); pojo.setDescription("Job description"); pojo.getProps().setProperty("key", "value"); pojo.setDisabled(true); pojo.setOverwrite(true); CloudJobConfiguration actual = pojo.toCloudJobConfiguration(); assertThat(actual.getAppName(), is("app")); assertThat(actual.getCpuCount(), is(1d)); assertThat(actual.getMemoryMB(), is(128d)); assertThat(actual.getJobExecutionType(), is(CloudJobExecutionType.DAEMON)); assertThat(actual.getJobConfig().getJobName(), is("test_job")); assertThat(actual.getJobConfig().getCron(), is("0/1 * * * * ?")); assertThat(actual.getJobConfig().getShardingTotalCount(), is(3)); assertThat(actual.getJobConfig().getShardingItemParameters(), is("0=A,1=B,2=C")); assertThat(actual.getJobConfig().getJobParameter(), is("param")); assertTrue(actual.getJobConfig().isMonitorExecution()); assertTrue(actual.getJobConfig().isFailover()); assertTrue(actual.getJobConfig().isMisfire()); assertThat(actual.getJobConfig().getJobShardingStrategyType(), is("AVG_ALLOCATION")); assertThat(actual.getJobConfig().getJobExecutorServiceHandlerType(), is("CPU")); assertThat(actual.getJobConfig().getJobErrorHandlerType(), is("IGNORE")); assertThat(actual.getJobConfig().getDescription(), is("Job description")); assertThat(actual.getJobConfig().getProps().getProperty("key"), is("value")); assertTrue(actual.getJobConfig().isDisabled()); assertTrue(actual.getJobConfig().isOverwrite()); }
public CloudJobConfiguration toCloudJobConfiguration() { JobConfiguration jobConfig = JobConfiguration.newBuilder(jobName, shardingTotalCount) .cron(cron).shardingItemParameters(shardingItemParameters).jobParameter(jobParameter) .monitorExecution(monitorExecution).failover(failover).misfire(misfire) .maxTimeDiffSeconds(maxTimeDiffSeconds).reconcileIntervalMinutes(reconcileIntervalMinutes) .jobShardingStrategyType(jobShardingStrategyType).jobExecutorServiceHandlerType(jobExecutorServiceHandlerType).jobErrorHandlerType(jobErrorHandlerType) .description(description).disabled(disabled).overwrite(overwrite).build(); for (Object each : props.keySet()) { jobConfig.getProps().setProperty(each.toString(), props.get(each.toString()).toString()); } return new CloudJobConfiguration(appName, cpuCount, memoryMB, jobExecutionType, jobConfig); }
CloudJobConfigurationPOJO { public CloudJobConfiguration toCloudJobConfiguration() { JobConfiguration jobConfig = JobConfiguration.newBuilder(jobName, shardingTotalCount) .cron(cron).shardingItemParameters(shardingItemParameters).jobParameter(jobParameter) .monitorExecution(monitorExecution).failover(failover).misfire(misfire) .maxTimeDiffSeconds(maxTimeDiffSeconds).reconcileIntervalMinutes(reconcileIntervalMinutes) .jobShardingStrategyType(jobShardingStrategyType).jobExecutorServiceHandlerType(jobExecutorServiceHandlerType).jobErrorHandlerType(jobErrorHandlerType) .description(description).disabled(disabled).overwrite(overwrite).build(); for (Object each : props.keySet()) { jobConfig.getProps().setProperty(each.toString(), props.get(each.toString()).toString()); } return new CloudJobConfiguration(appName, cpuCount, memoryMB, jobExecutionType, jobConfig); } }
CloudJobConfigurationPOJO { public CloudJobConfiguration toCloudJobConfiguration() { JobConfiguration jobConfig = JobConfiguration.newBuilder(jobName, shardingTotalCount) .cron(cron).shardingItemParameters(shardingItemParameters).jobParameter(jobParameter) .monitorExecution(monitorExecution).failover(failover).misfire(misfire) .maxTimeDiffSeconds(maxTimeDiffSeconds).reconcileIntervalMinutes(reconcileIntervalMinutes) .jobShardingStrategyType(jobShardingStrategyType).jobExecutorServiceHandlerType(jobExecutorServiceHandlerType).jobErrorHandlerType(jobErrorHandlerType) .description(description).disabled(disabled).overwrite(overwrite).build(); for (Object each : props.keySet()) { jobConfig.getProps().setProperty(each.toString(), props.get(each.toString()).toString()); } return new CloudJobConfiguration(appName, cpuCount, memoryMB, jobExecutionType, jobConfig); }  }
CloudJobConfigurationPOJO { public CloudJobConfiguration toCloudJobConfiguration() { JobConfiguration jobConfig = JobConfiguration.newBuilder(jobName, shardingTotalCount) .cron(cron).shardingItemParameters(shardingItemParameters).jobParameter(jobParameter) .monitorExecution(monitorExecution).failover(failover).misfire(misfire) .maxTimeDiffSeconds(maxTimeDiffSeconds).reconcileIntervalMinutes(reconcileIntervalMinutes) .jobShardingStrategyType(jobShardingStrategyType).jobExecutorServiceHandlerType(jobExecutorServiceHandlerType).jobErrorHandlerType(jobErrorHandlerType) .description(description).disabled(disabled).overwrite(overwrite).build(); for (Object each : props.keySet()) { jobConfig.getProps().setProperty(each.toString(), props.get(each.toString()).toString()); } return new CloudJobConfiguration(appName, cpuCount, memoryMB, jobExecutionType, jobConfig); }  CloudJobConfiguration toCloudJobConfiguration(); static CloudJobConfigurationPOJO fromCloudJobConfiguration(final CloudJobConfiguration cloudJobConfig); }
CloudJobConfigurationPOJO { public CloudJobConfiguration toCloudJobConfiguration() { JobConfiguration jobConfig = JobConfiguration.newBuilder(jobName, shardingTotalCount) .cron(cron).shardingItemParameters(shardingItemParameters).jobParameter(jobParameter) .monitorExecution(monitorExecution).failover(failover).misfire(misfire) .maxTimeDiffSeconds(maxTimeDiffSeconds).reconcileIntervalMinutes(reconcileIntervalMinutes) .jobShardingStrategyType(jobShardingStrategyType).jobExecutorServiceHandlerType(jobExecutorServiceHandlerType).jobErrorHandlerType(jobErrorHandlerType) .description(description).disabled(disabled).overwrite(overwrite).build(); for (Object each : props.keySet()) { jobConfig.getProps().setProperty(each.toString(), props.get(each.toString()).toString()); } return new CloudJobConfiguration(appName, cpuCount, memoryMB, jobExecutionType, jobConfig); }  CloudJobConfiguration toCloudJobConfiguration(); static CloudJobConfigurationPOJO fromCloudJobConfiguration(final CloudJobConfiguration cloudJobConfig);  }