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 app deployment 
     * system is not available.
     * 
     * @throws Exception
     */
Tests that submission fails and the job requeues when the app deployment
system is not available.

@throws Exception
Tests that submission fails and the job requeues when the app deployment system is not available . @throws Exception
@Test
    public void submitJobStaysStagedWhenSoftwareDeploymentSystemIsUnavailable() 
    throws Exception
    {
        Software software = null;
        StorageSystem storageSystem = null;
        Job job = null;
        try
        {
            storageSystem = getNewInstanceOfStorageSystem("submitTestApplicationStorageSystemChecks");
            storageSystem.setSystemId("submitTestApplicationStorageSystemChecks");
            systemDao.persist(storageSystem);
            software = SoftwareDao.getUserApps(SYSTEM_OWNER, true).get(0).clone();
            software.setName("submitTestApplicationStorageSystemChecks");
            software.setStorageSystem(storageSystem);
            SoftwareDao.persist(software);
            for (SystemStatusType systemStatus: SystemStatusType.values()) {
                if (systemStatus == SystemStatusType.UP) continue; 
                storageSystem.setStatus(systemStatus);
                systemDao.merge(storageSystem);
                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 software deployment system is " 
                                    + systemStatus.name(), false);
                    Assert.assertEquals(job.getStatus(), JobStatusType.STAGED, 
                            "Job should remain STAGED until the software deployment system comes " 
                                    + systemStatus.name() + " again.");
                } catch (Throwable e) {
                    Assert.fail("Job submission should stay in a STAGED state when the software storage system is down", 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(storageSystem); } catch (Exception e) {}
        }
    }
@ Test public void submitJobStaysStagedWhenSoftwareDeploymentSystemIsUnavailable ( ) throws Exception { Software software = null ; StorageSystem storageSystem = null ; Job job = null ; try { storageSystem = getNewInstanceOfStorageSystem ( "submitTestApplicationStorageSystemChecks" ) ; storageSystem . setSystemId ( "submitTestApplicationStorageSystemChecks" ) ; systemDao . persist ( storageSystem ) ; software = SoftwareDao . getUserApps ( SYSTEM_OWNER , true ) . get ( 0 ) . clone ( ) ; software . setName ( "submitTestApplicationStorageSystemChecks" ) ; software . setStorageSystem ( storageSystem ) ; SoftwareDao . persist ( software ) ; for ( SystemStatusType systemStatus : SystemStatusType . values ( ) ) { if ( systemStatus == SystemStatusType . UP ) continue ; storageSystem . setStatus ( systemStatus ) ; systemDao . merge ( storageSystem ) ; 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 software deployment system is " + systemStatus . name ( ) , false ) ; Assert . assertEquals ( job . getStatus ( ) , JobStatusType . STAGED , "Job should remain STAGED until the software deployment system comes " + systemStatus . name ( ) + " again." ) ; } catch ( Throwable e ) { Assert . fail ( "Job submission should stay in a STAGED state when the software storage system is down" , 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 ( storageSystem ) ; } catch ( Exception e ) { } } }
Tests that submission fails and the job requeues when the app deployment
 system is not available.
Tests that submission fails and the job requeues when the app deployment system is not available .