agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/submission/AbstractJobSubmissionTest.java
/**
     * Generic submission test used by all the methods testing job submission is some
     * form or fashion.
     * 
     * @param job the job to submit
     * @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 submission is some
form or fashion.

@param job the job to submit
@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 submission is some form or fashion . @param job the job to submit @param message message if the assertion fails @param shouldThrowException true if it should fail false otherwise @return the submitted job
protected Job genericRemoteSubmissionTestCase(Job job, JobStatusType expectedStatus, 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(), expectedStatus,
                    "Job status did not match " + expectedStatus + " after submission");
            if (expectedStatus == JobStatusType.RUNNING || 
                    expectedStatus == JobStatusType.QUEUED ) {
                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();
            if (StringUtils.isBlank(job.getWorkPath())) {
                try {
                    JobManager jobManager = new JobManager();
                    ExecutionSystem executionSystem = jobManager.getJobExecutionSystem(job);
                    job.setWorkPath(jobManager.calculateJobRemoteWorkPath(job, executionSystem));
                } catch (SystemUnavailableException | JobException e) {
                    e.printStackTrace();
                }
            }
        }
        Assert.assertEquals(shouldThrowException, actuallyThrewException, exceptionMsg);
		return job;
	}
protected Job genericRemoteSubmissionTestCase ( Job job , JobStatusType expectedStatus , 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 ( ) , expectedStatus , "Job status did not match " + expectedStatus + " after submission" ) ; if ( expectedStatus == JobStatusType . RUNNING || expectedStatus == JobStatusType . QUEUED ) { 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 ( ) ; if ( StringUtils . isBlank ( job . getWorkPath ( ) ) ) { try { JobManager jobManager = new JobManager ( ) ; ExecutionSystem executionSystem = jobManager . getJobExecutionSystem ( job ) ; job . setWorkPath ( jobManager . calculateJobRemoteWorkPath ( job , executionSystem ) ) ; } catch ( SystemUnavailableException | JobException e ) { e . printStackTrace ( ) ; } } } Assert . assertEquals ( shouldThrowException , actuallyThrewException , exceptionMsg ) ; return job ; }
Generic submission test used by all the methods testing job submission is some
 form or fashion.
Generic submission test used by all the methods testing job submission is some form or fashion .
//		    job.setArchivePath(job.getOwner() + "/archive/jobs/job-" + job.getUuid() + "-" + Slug.toSlug(job.getName())); //		     //			JobDao.persist(job); //			 //        System.out.println(" exception thrown?  expected " + shouldThrowException + " actual " + actuallyThrewException);