/**
  * @param ExitStatus $exitStatus
  *
  * @return $this
  */
 public function setExitStatus(ExitStatus $exitStatus)
 {
     $this->exitStatus = $exitStatus;
     $this->exitCode = $exitStatus->getExitCode();
     $this->exitDescription = $exitStatus->getExitDescription();
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Default mapping from throwable to {@link ExitStatus}. Clients can modify the exit code using a
  * {@link StepExecutionListener}.
  *
  * @param \Exception $e the cause of the failure
  *
  * @return ExitStatus an {@link ExitStatus}
  */
 private function getDefaultExitStatusForFailure(\Exception $e)
 {
     $exitStatus = new ExitStatus();
     if ($e instanceof JobInterruptedException || $e->getPrevious() instanceof JobInterruptedException) {
         $exitStatus = new ExitStatus(ExitStatus::STOPPED);
         $exitStatus->addExitDescription(get_class(new JobInterruptedException()));
     } else {
         $exitStatus = new ExitStatus(ExitStatus::FAILED);
         $exitStatus->addExitDescription($e);
     }
     return $exitStatus;
 }
Ejemplo n.º 3
0
 public function testUnkownIsRunning()
 {
     $unknown = new ExitStatus(ExitStatus::UNKNOWN);
     $this->assertTrue($unknown->isRunning());
 }