コード例 #1
0
 public void onefailAndOnePassedBuildInstances(Stage instance) {
   final JobInstance first = instance.getJobInstances().get(0);
   final JobInstance second = instance.getJobInstances().get(1);
   first.completing(Failed);
   second.completing(Failed);
   first.completed(new Date());
   second.completed(new Date());
   jobInstanceDao.updateStateAndResult(first);
   jobInstanceDao.updateStateAndResult(second);
 }
コード例 #2
0
 public void failStage(Stage stage, Date completionDate) {
   for (JobInstance job : stage.getJobInstances()) {
     job.completing(Failed, completionDate);
     job.completed(completionDate);
     jobInstanceDao.updateStateAndResult(job);
   }
   stage.calculateResult();
   updateResultInTransaction(stage, StageResult.Failed);
 }
コード例 #3
0
 public void buildInstanceWithDiscontinuedState(Stage instance) {
   final JobInstance first = instance.getJobInstances().get(0);
   final JobInstance second = instance.getJobInstances().get(1);
   first.completing(JobResult.Passed);
   second.changeState(JobState.Discontinued);
   second.setResult(JobResult.Passed);
   first.completed(new Date());
   jobInstanceDao.updateStateAndResult(first);
   jobInstanceDao.updateStateAndResult(second);
   updateResultInTransaction(instance, StageResult.Passed);
 }
コード例 #4
0
 public StageResult completeAllJobs(Stage stage, JobResult jobResult) {
   for (JobInstance job : stage.getJobInstances()) {
     JobInstanceMother.setBuildingState(job);
     job.setAgentUuid(AGENT_UUID);
     job.completing(jobResult);
     job.completed(new DateTime().plusMinutes(5).toDate());
     jobInstanceDao.updateAssignedInfo(job);
   }
   StageResult stageResult;
   switch (jobResult) {
     case Failed:
       stageResult = StageResult.Failed;
       break;
     case Cancelled:
       stageResult = StageResult.Cancelled;
       break;
     default:
       stageResult = StageResult.Passed;
   }
   stage.calculateResult();
   return stageResult;
 }