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