agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/queue/actions/SubmissionActionIT.java
/**
     * Tests that submission fails and the job requeues when the execution 
     * system is not available.
     * 
     * @throws Exception
     */
Tests that submission fails and the job requeues when the execution
system is not available.

@throws Exception
Tests that submission fails and the job requeues when the execution system is not available . @throws Exception
@Test
    public void submitJobStaysStagedWhenExecutionSystemIsUnavailable() 
    throws Exception
    {
        Software software = null;
        ExecutionSystem executionSystem = null;
        Job job = null;
        try
        {
            executionSystem = getNewInstanceOfExecutionSystem("submitTestApplicationExecutionSystemChecks");
            executionSystem.setSystemId("submitTestApplicationExecutionSystemChecks");
            systemDao.persist(executionSystem);
            software = SoftwareDao.getUserApps(SYSTEM_OWNER, true).get(0).clone();
            software.setName("submitTestApplicationStorageSystemChecks");
            software.setExecutionSystem(executionSystem);
            software.setDefaultQueue(executionSystem.getDefaultQueue().getName());
            SoftwareDao.persist(software);
            for (SystemStatusType systemStatus: SystemStatusType.values()) {
                if (systemStatus == SystemStatusType.UP) continue; 
                executionSystem = (ExecutionSystem)systemDao.findById(executionSystem.getId());
                executionSystem.setStatus(systemStatus);
                systemDao.merge(executionSystem);
                try 
                {
                    job = createJob(JobStatusType.STAGED, software, SYSTEM_OWNER);
                    JobDao.persist(job);
                    job = genericRemoteSubmissionTestCase(job, JobStatusType.STAGED, 
                            "Job submission should stay in a STAGED state while the execution system is " 
                                    + systemStatus.name(), false);
                    Assert.assertEquals(job.getStatus(), JobStatusType.STAGED, 
                            "Job should remain STAGED until the execution system comes " 
                                    + systemStatus.name() + " again.");
                } catch (Throwable e) {
                    Assert.fail("Job submission should stay in a STAGED state when the execution system is " 
                            + systemStatus.name(), e);
                }
                finally {
                    try { deleteJobWorkDirectory(job); } catch (Exception e) {}
                    try { JobDao.delete(job); } catch (Exception e) {}
                }
            }
        }
        finally {
            try { SoftwareDao.delete(software); } catch (Exception e) {}
            try { systemDao.remove(executionSystem); } catch (Exception e) {}
        }
    }
@ Test public void submitJobStaysStagedWhenExecutionSystemIsUnavailable ( ) throws Exception { Software software = null ; ExecutionSystem executionSystem = null ; Job job = null ; try { executionSystem = getNewInstanceOfExecutionSystem ( "submitTestApplicationExecutionSystemChecks" ) ; executionSystem . setSystemId ( "submitTestApplicationExecutionSystemChecks" ) ; systemDao . persist ( executionSystem ) ; software = SoftwareDao . getUserApps ( SYSTEM_OWNER , true ) . get ( 0 ) . clone ( ) ; software . setName ( "submitTestApplicationStorageSystemChecks" ) ; software . setExecutionSystem ( executionSystem ) ; software . setDefaultQueue ( executionSystem . getDefaultQueue ( ) . getName ( ) ) ; SoftwareDao . persist ( software ) ; for ( SystemStatusType systemStatus : SystemStatusType . values ( ) ) { if ( systemStatus == SystemStatusType . UP ) continue ; executionSystem = ( ExecutionSystem ) systemDao . findById ( executionSystem . getId ( ) ) ; executionSystem . setStatus ( systemStatus ) ; systemDao . merge ( executionSystem ) ; try { job = createJob ( JobStatusType . STAGED , software , SYSTEM_OWNER ) ; JobDao . persist ( job ) ; job = genericRemoteSubmissionTestCase ( job , JobStatusType . STAGED , "Job submission should stay in a STAGED state while the execution system is " + systemStatus . name ( ) , false ) ; Assert . assertEquals ( job . getStatus ( ) , JobStatusType . STAGED , "Job should remain STAGED until the execution system comes " + systemStatus . name ( ) + " again." ) ; } catch ( Throwable e ) { Assert . fail ( "Job submission should stay in a STAGED state when the execution system is " + systemStatus . name ( ) , e ) ; } finally { try { deleteJobWorkDirectory ( job ) ; } catch ( Exception e ) { } try { JobDao . delete ( job ) ; } catch ( Exception e ) { } } } } finally { try { SoftwareDao . delete ( software ) ; } catch ( Exception e ) { } try { systemDao . remove ( executionSystem ) ; } catch ( Exception e ) { } } }
Tests that submission fails and the job requeues when the execution
 system is not available.
Tests that submission fails and the job requeues when the execution system is not available .