MasterSlaveJobLogServiceImpl extends AbstractService implements MasterSlaveJobLogService { @Override public void updateJobLog(MasterSlaveJobData.Data data) { if (StringHelper.isEmpty(data.getJobOperationLogId())) { return; } MasterSlaveJobLog masterSlaveJobLog = baseDao.get(MasterSlaveJobLog.class, data.getJobOperationLogId()); if (masterSlaveJobLog == null) { return; } int retryTimes = 10; ReflectHelper.copyFieldValuesSkipNull(data, masterSlaveJobLog); while (retryTimes-- > 0) { try { baseDao.update(masterSlaveJobLog); } catch (IllegalArgumentException e) { try { Thread.sleep(1000); } catch (InterruptedException e1) { } } } data.clearOperationLog(); masterSlaveApiFactory.jobApi().updateJob(data.getGroupName(), data.getJobName(), data); }  @Override List<MasterSlaveJobLog> getAllJobLogs(); @Override String saveJobLog(MasterSlaveJobSummary masterSlaveJobSummary); @Override void updateJobLog(MasterSlaveJobData.Data data);  }
@Test public void updateJobLog() { masterSlaveJobService.saveJob(getSampleJarFile(), "com.zuoxiaolong"); List<MasterSlaveJobSummary> jobSummaries = masterSlaveJobSummaryService.getAllJobSummaries(); MasterSlaveJobSummary 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"); masterSlaveJobSummaryService.saveJobSummary(jobSummary); String jobLogId = masterSlaveJobLogService.saveJobLog(jobSummary); MasterSlaveApiFactory apiFactory = new MasterSlaveApiFactoryImpl(client); MasterSlaveJobData.Data data = apiFactory.jobApi().getJob(jobSummary.getGroupName(), jobSummary.getJobName()).getData(); masterSlaveJobLogService.updateJobLog(data); MasterSlaveJobLog jobLog = baseDao.get(MasterSlaveJobLog.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"); }