agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/managers/monitors/DefaultJobMonitorTest.java
/**
     * Tests the job status is left unchanged, but the error message updated on a job when the remote status returned is
     * "UNKNOWN".
     * @param executionType the type of job to test
     * @param status the remote job status that should be returned from the remote scheduler
     * @param expectedJobStatus the resulting status that should be had after update.
     * @throws Exception if anything goes wrong, just let it fly
     */
Tests the job status is left unchanged, but the error message updated on a job when the remote status returned is
"UNKNOWN".
@param executionType the type of job to test
@param status the remote job status that should be returned from the remote scheduler
@param expectedJobStatus the resulting status that should be had after update.
@throws Exception if anything goes wrong, just let it fly
Tests the job status is left unchanged but the error message updated on a job when the remote status returned is " UNKNOWN " . @param executionType the type of job to test @param status the remote job status that should be returned from the remote scheduler @param expectedJobStatus the resulting status that should be had after update . @throws Exception if anything goes wrong just let it fly
@Test(dataProvider="testMonitorLeavesJobStatusUnchangedUpdatesMessageIfRemoteScheduleStatusUnknownProvider")
    public void testMonitorLeavesJobStatusUnchangedUpdatesMessageIfRemoteScheduleStatusUnknown(ExecutionType executionType, RemoteSchedulerJobStatus<?> status, JobStatusType expectedJobStatus) throws Exception {
        JobStatusType initialJobStatus = JobStatusType.QUEUED;
        DefaultJobMonitor monitor = _genericMonitorMockTestHandler(executionType, initialJobStatus, status, expectedJobStatus);
        String initalJobErrorMessage = "Mock job " + monitor.getJob().getUuid() + " " + initialJobStatus.name();
        verify(monitor, times(1)).updateJobStatus(eq(initialJobStatus), eq(initalJobErrorMessage));
        verify(monitor).updateJobStatus(eq(expectedJobStatus), not(eq(initalJobErrorMessage)));
    }
@ Test ( dataProvider = "testMonitorLeavesJobStatusUnchangedUpdatesMessageIfRemoteScheduleStatusUnknownProvider" ) public void testMonitorLeavesJobStatusUnchangedUpdatesMessageIfRemoteScheduleStatusUnknown ( ExecutionType executionType , RemoteSchedulerJobStatus < ? > status , JobStatusType expectedJobStatus ) throws Exception { JobStatusType initialJobStatus = JobStatusType . QUEUED ; DefaultJobMonitor monitor = _genericMonitorMockTestHandler ( executionType , initialJobStatus , status , expectedJobStatus ) ; String initalJobErrorMessage = "Mock job " + monitor . getJob ( ) . getUuid ( ) + " " + initialJobStatus . name ( ) ; verify ( monitor , times ( 1 ) ) . updateJobStatus ( eq ( initialJobStatus ) , eq ( initalJobErrorMessage ) ) ; verify ( monitor ) . updateJobStatus ( eq ( expectedJobStatus ) , not ( eq ( initalJobErrorMessage ) ) ) ; }
Tests the job status is left unchanged, but the error message updated on a job when the remote status returned is
 "UNKNOWN".
Tests the job status is left unchanged but the error message updated on a job when the remote status returned is " UNKNOWN " .
// job should be "touched" with the original status and error message when the method is first called // check that job is updated with the same status, but updated error message