StandbyJobSummaryServiceImpl extends AbstractService implements StandbyJobSummaryService { @Override public StandbyJobSummary getJobSummary(String id) { StandbyJobSummary standbyJobSummary = baseDao.get(StandbyJobSummary.class, id); StandbyJobData standbyJobData = standbyApiFactory.jobApi().getJob(standbyJobSummary.getGroupName(), standbyJobSummary.getJobName()); if (standbyJobData != null) { ReflectHelper.copyFieldValues(standbyJobData.getData(), standbyJobSummary); standbyJobSummary.setOriginalJarFileName(standbyJobData.getData().getJarFileName()); } else { List<String> jarFileNameList = standbyJobService.getJarFileNameList(standbyJobSummary.getGroupName(), standbyJobSummary.getJobName()); if (ListHelper.isEmpty(jarFileNameList)) { throw new ServiceException("job detail not found."); } else { standbyJobSummary.setOriginalJarFileName(jarFileNameList.get(0)); } } return standbyJobSummary; }  @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 getJobSummary() { standbyJobService.saveJob(getSampleJarFile(), "com.zuoxiaolong"); List<StandbyJobSummary> jobSummaries = standbyJobSummaryService.getAllJobSummaries(); StandbyJobSummary jobSummary = jobSummaries.get(0); String id = jobSummary.getId(); 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 = standbyJobSummaryService.getJobSummary(id); Assert.assertNotNull(jobSummary); Assert.assertEquals(jobSummary.getJobState(), "Shutdown"); StandbyApiFactory apiFactory = new StandbyApiFactoryImpl(client); StandbyJobData.Data data = new StandbyJobData.Data(); data.setJobState("Startup"); apiFactory.jobApi().updateJob(jobSummary.getGroupName(), jobSummary.getJobName(), data); jobSummary = standbyJobSummaryService.getJobSummary(id); Assert.assertNotNull(jobSummary); Assert.assertEquals(jobSummary.getJobState(), "Startup"); }