JobConfigurationPOJO { public static JobConfigurationPOJO fromJobConfiguration(final JobConfiguration jobConfiguration) { JobConfigurationPOJO result = new JobConfigurationPOJO(); result.setJobName(jobConfiguration.getJobName()); result.setCron(jobConfiguration.getCron()); result.setShardingTotalCount(jobConfiguration.getShardingTotalCount()); result.setShardingItemParameters(jobConfiguration.getShardingItemParameters()); result.setJobParameter(jobConfiguration.getJobParameter()); result.setMonitorExecution(jobConfiguration.isMonitorExecution()); result.setFailover(jobConfiguration.isFailover()); result.setMisfire(jobConfiguration.isMisfire()); result.setMaxTimeDiffSeconds(jobConfiguration.getMaxTimeDiffSeconds()); result.setReconcileIntervalMinutes(jobConfiguration.getReconcileIntervalMinutes()); result.setJobShardingStrategyType(jobConfiguration.getJobShardingStrategyType()); result.setJobExecutorServiceHandlerType(jobConfiguration.getJobExecutorServiceHandlerType()); result.setJobErrorHandlerType(jobConfiguration.getJobErrorHandlerType()); result.setJobListenerTypes(jobConfiguration.getJobListenerTypes()); result.setDescription(jobConfiguration.getDescription()); result.setProps(jobConfiguration.getProps()); result.setDisabled(jobConfiguration.isDisabled()); result.setOverwrite(jobConfiguration.isOverwrite()); return result; }  JobConfiguration toJobConfiguration(); static JobConfigurationPOJO fromJobConfiguration(final JobConfiguration jobConfiguration);  }
@Test public void assertFromJobConfiguration() { JobConfiguration jobConfiguration = 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") .jobListenerTypes("LOG").description("Job description").setProperty("key", "value") .disabled(true).overwrite(true).build(); JobConfigurationPOJO actual = JobConfigurationPOJO.fromJobConfiguration(jobConfiguration); 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.getJobListenerTypes(), hasItem("LOG")); assertThat(actual.getDescription(), is("Job description")); assertThat(actual.getProps().getProperty("key"), is("value")); assertTrue(actual.isDisabled()); assertTrue(actual.isOverwrite()); }