StandbyJobLogServiceImpl extends AbstractService implements StandbyJobLogService { @Override public void updateJobLog(StandbyJobData.Data data) { if (StringHelper.isEmpty(data.getJobOperationLogId())) { return; } StandbyJobLog standbyJobLog = baseDao.get(StandbyJobLog.class, data.getJobOperationLogId()); if (standbyJobLog == null) { return; } int retryTimes = 10; ReflectHelper.copyFieldValuesSkipNull(data, standbyJobLog); while (retryTimes-- > 0) { try { baseDao.update(standbyJobLog); } catch (IllegalArgumentException e) { try { Thread.sleep(1000); } catch (InterruptedException e1) { } } } data.clearOperationLog(); standbyApiFactory.jobApi().updateJob(data.getGroupName(), data.getJobName(), data); }  @Override List<StandbyJobLog> getAllJobLogs(); @Override String saveJobLog(StandbyJobSummary standbyJobSummary); @Override void updateJobLog(StandbyJobData.Data data);  }
@Test public void updateJobLog() { 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); String jobLogId = standbyJobLogService.saveJobLog(jobSummary); StandbyApiFactory apiFactory = new StandbyApiFactoryImpl(client); StandbyJobData.Data data = apiFactory.jobApi().getJob(jobSummary.getGroupName(), jobSummary.getJobName()).getData(); standbyJobLogService.updateJobLog(data); StandbyJobLog jobLog = baseDao.get(StandbyJobLog.class, jobLogId); Assert.assertEquals(jobLog.getJarFileName(), "niubi-job-sample-spring.jar"); Assert.assertEquals(jobLog.getJobName(), "test"); Assert.assertEquals(jobLog.getJobOperation(), "Start"); Assert.assertEquals(jobLog.getMisfirePolicy(), "None"); Assert.assertEquals(jobLog.getOriginalJarFileName(), "niubi-job-sample-spring.jar"); Assert.assertEquals(jobLog.getJobCron(), "0 * * * * ?"); Assert.assertEquals(jobLog.getContainerType(), "Spring"); Assert.assertEquals(jobLog.getGroupName(), "com.zuoxiaolong.niubi.job.sample.spring.job.Job1"); }