JobInfoConverter { public static JobStatusEnum parseToJobStatus(ExecutableState state) { switch (state) { case READY: return JobStatusEnum.PENDING; case RUNNING: return JobStatusEnum.RUNNING; case ERROR: return JobStatusEnum.ERROR; case DISCARDED: return JobStatusEnum.DISCARDED; case SUCCEED: return JobStatusEnum.FINISHED; case STOPPED: return JobStatusEnum.STOPPED; default: throw new RuntimeException("invalid state:" + state); } }  static JobInstance parseToJobInstanceQuietly(CubingJob job, Map<String, Output> outputs); static JobInstance parseToJobInstanceQuietly(CheckpointExecutable job, Map<String, Output> outputs); static JobInstance parseToJobInstance(CubingJob job, Map<String, Output> outputs); static JobInstance parseToJobInstance(CheckpointExecutable job, Map<String, Output> outputs); static JobInstance.JobStep parseToJobStep(AbstractExecutable task, int i, Output stepOutput); static JobStatusEnum parseToJobStatus(ExecutableState state); static JobStepStatusEnum parseToJobStepStatus(ExecutableState state); static JobSearchResult parseToJobSearchResult(DefaultChainedExecutable job, Map<String, ExecutableOutputPO> outputs);  }
@Test public void testParseToJobStatusReturnsJobStatusStopped() { ExecutableState executableState = ExecutableState.STOPPED; JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState); assertEquals(32, jobStatusEnum.getCode()); assertEquals(JobStatusEnum.STOPPED, jobStatusEnum); }
@Test public void testParseToJobStatusReturnsJobStatusFinished() { ExecutableState executableState = ExecutableState.SUCCEED; JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState); assertEquals(4, jobStatusEnum.getCode()); assertEquals(JobStatusEnum.FINISHED, jobStatusEnum); }
@Test public void testParseToJobStatusReturnsJobStatusError() { ExecutableState executableState = ExecutableState.ERROR; JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState); assertEquals(8, jobStatusEnum.getCode()); assertEquals(JobStatusEnum.ERROR, jobStatusEnum); }
@Test public void testParseToJobStatusReturnsJobStatusRunning() { ExecutableState executableState = ExecutableState.RUNNING; JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState); assertEquals(2, jobStatusEnum.getCode()); assertEquals(JobStatusEnum.RUNNING, jobStatusEnum); }
@Test public void testParseToJobStatusReturnsJobStatusDiscarded() { ExecutableState executableState = ExecutableState.DISCARDED; JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState); assertEquals(16, jobStatusEnum.getCode()); assertEquals(JobStatusEnum.DISCARDED, jobStatusEnum); }
@Test public void testParseToJobStatusReturnsJobStatusPending() { ExecutableState executableState = ExecutableState.READY; JobStatusEnum jobStatusEnum = JobInfoConverter.parseToJobStatus(executableState); assertEquals(1, jobStatusEnum.getCode()); assertEquals(JobStatusEnum.PENDING, jobStatusEnum); }