agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/submission/AbstractJobSubmissionTest.java
/**
     * Generic submission test used by all the methods testing job launching in some form or fashion.
     * 
     * @param job the job to submit
     * @param queuedOrRunning true if the job should be queued or running after submission
     * @param message message if the assertion fails
     * @param shouldThrowException true if it should fail, false otherwise
     * @return the submitted job
     */
Generic submission test used by all the methods testing job launching in some form or fashion.


Generic submission test used by all the methods testing job launching in some form or fashion .
protected Job genericRemoteSubmissionTestCase(Job job, boolean queuedOrRunning, String message, boolean shouldThrowException) 
	{
		boolean actuallyThrewException = false;
		String exceptionMsg = message;
		SubmissionAction submissionAction = new SubmissionAction(job);
		try
        {
			submissionAction.run();
            job = submissionAction.getJob();
            Assert.assertEquals(job.getStatus() == JobStatusType.RUNNING || 
        			job.getStatus() == JobStatusType.QUEUED, queuedOrRunning, 
                    "Job status did not match queued or running after submission");
            if (queuedOrRunning) {
            	Assert.assertNotNull(submissionAction.getJob().getLocalJobId(),
                        "Local job id was not obtained during submission");
                Assert.assertEquals((int) job.getRetries(), 0, "Job should only submit once when it does not fail during submission");
                Assert.assertNotNull(job.getSubmitTime(),
                    "Job submit time was not updated during job submission");
            } else {
                Assert.assertNull(job.getLocalJobId(),
                        "Local job id should be null if submission fails");
                Assert.assertNull(job.getSubmitTime(),
                    "Job submit time should not be updated if the job did not submit.");
            }
        }
        catch (Exception e)
		{
			actuallyThrewException = true;
            exceptionMsg = "Error placing job into queue on " + job.getSystem() + ": " + message;
            if (actuallyThrewException != shouldThrowException) e.printStackTrace();
		}
		finally {
		    job = submissionAction.getJob();
		}
        Assert.assertEquals(shouldThrowException, actuallyThrewException, exceptionMsg);
		return job;
	}
protected Job genericRemoteSubmissionTestCase ( Job job , boolean queuedOrRunning , String message , boolean shouldThrowException ) { boolean actuallyThrewException = false ; String exceptionMsg = message ; SubmissionAction submissionAction = new SubmissionAction ( job ) ; try { submissionAction . run ( ) ; job = submissionAction . getJob ( ) ; Assert . assertEquals ( job . getStatus ( ) == JobStatusType . RUNNING || job . getStatus ( ) == JobStatusType . QUEUED , queuedOrRunning , "Job status did not match queued or running after submission" ) ; if ( queuedOrRunning ) { Assert . assertNotNull ( submissionAction . getJob ( ) . getLocalJobId ( ) , "Local job id was not obtained during submission" ) ; Assert . assertEquals ( ( int ) job . getRetries ( ) , 0 , "Job should only submit once when it does not fail during submission" ) ; Assert . assertNotNull ( job . getSubmitTime ( ) , "Job submit time was not updated during job submission" ) ; } else { Assert . assertNull ( job . getLocalJobId ( ) , "Local job id should be null if submission fails" ) ; Assert . assertNull ( job . getSubmitTime ( ) , "Job submit time should not be updated if the job did not submit." ) ; } } catch ( Exception e ) { actuallyThrewException = true ; exceptionMsg = "Error placing job into queue on " + job . getSystem ( ) + ": " + message ; if ( actuallyThrewException != shouldThrowException ) e . printStackTrace ( ) ; } finally { job = submissionAction . getJob ( ) ; } Assert . assertEquals ( shouldThrowException , actuallyThrewException , exceptionMsg ) ; return job ; }
Generic submission test used by all the methods testing job launching in some form or fashion.
Generic submission test used by all the methods testing job launching in some form or fashion .
//        System.out.println(" exception thrown?  expected " + shouldThrowException + " actual " + actuallyThrewException);