StandbyJobSummaryServiceImpl extends AbstractService implements StandbyJobSummaryService { @Override public synchronized void saveJobSummary(StandbyJobSummary standbyJobSummary) { StandbyJobData standbyJobData = standbyApiFactory.jobApi().getJob(standbyJobSummary.getGroupName(), standbyJobSummary.getJobName()); StandbyJobData.Data data; if (standbyJobData == null) { data = new StandbyJobData.Data(); } else { data = standbyJobData.getData(); } ReflectHelper.copyFieldValuesSkipNull(standbyJobSummary, data); StandbyJob standbyJob = standbyJobService.getJob(standbyJobSummary.getGroupName(), standbyJobSummary.getJobName(), standbyJobSummary.getJarFileName()); data.setJobOperationLogId(standbyJobLogService.saveJobLog(standbyJobSummary)); data.setPackagesToScan(standbyJob.getPackagesToScan()); data.setContainerType(standbyJob.getContainerType()); StandbyJobSummary param = new StandbyJobSummary(); param.setGroupName(data.getGroupName()); param.setJobName(data.getJobName()); StandbyJobSummary standbyJobSummaryInDb = baseDao.getUnique(StandbyJobSummary.class, param); standbyJobSummaryInDb.setJobState("Executing"); baseDao.update(standbyJobSummaryInDb); standbyApiFactory.jobApi().saveJob(standbyJobSummary.getGroupName(), standbyJobSummary.getJobName(), data); }  @Override List<StandbyJobSummary> getAllJobSummaries(); @Override synchronized void saveJobSummary(StandbyJobSummary standbyJobSummary); @Override void updateJobSummary(StandbyJobData.Data data); @Override StandbyJobSummary getJobSummary(String id); @Override void updateJobSummary(String id);  }
@Test public void saveJobSummary() { standbyJobService.saveJob(getSampleJarFile(), "com.zuoxiaolong"); List<StandbyJobSummary> jobSummaries = standbyJobSummaryService.getAllJobSummaries(); StandbyJobSummary jobSummary = jobSummaries.get(0); jobSummary.setJobCron("0 * * * * ?"); jobSummary.setMisfirePolicy("None"); jobSummary.setJarFileName("niubi-job-sample-spring.jar"); jobSummary.setOriginalJarFileName("niubi-job-sample-spring.jar"); jobSummary.setJobOperation("Start"); jobSummary.setContainerType("Spring"); standbyJobSummaryService.saveJobSummary(jobSummary); jobSummary = baseDao.get(StandbyJobSummary.class, jobSummary.getId()); Assert.assertNotNull(jobSummary); Assert.assertEquals("Executing", jobSummary.getJobState()); }