agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/managers/launchers/HPCLauncherTest.java
/**
     * Ceates a mock {@link Job} for testing using the given system and software.
     * @param executionSystem the system on which the app runs
     * @param software the app to run
     * @return a mock job instance for use in testing
     */
Ceates a mock  Job for testing using the given system and software.
@param executionSystem the system on which the app runs
@param software the app to run
@return a mock job instance for use in testing
Ceates a mock Job for testing using the given system and software . @param executionSystem the system on which the app runs @param software the app to run @return a mock job instance for use in testing
private Job createMockJob(ExecutionSystem executionSystem, Software software) throws JobException {
        Job job = mock(Job.class);
        String jobUuid = new AgaveUUID(UUIDType.JOB).toString();
        when(job.getSoftwareName()).thenReturn(software.getUniqueName());
        when(job.getSystem()).thenReturn(executionSystem.getSystemId());
        when(job.getExecutionType()).thenReturn(executionSystem.getExecutionType());
        when(job.getSchedulerType()).thenReturn(executionSystem.getScheduler());
        when(job.getUuid()).thenReturn(jobUuid);
        when(job.getId()).thenReturn(1L);
        when(job.getWorkPath()).thenReturn("/scratch/" + JSONTestDataUtil.TEST_OWNER + "/job-" + jobUuid);
        when(job.isArchiveOutput()).thenReturn(false);
        when(job.getName()).thenReturn(UUID.randomUUID().toString());
        BatchQueue queue = executionSystem.getDefaultQueue();
        when(job.getBatchQueue()).thenReturn(queue.getName());
        when(job.getMemoryPerNode()).thenReturn(1D);
        when(job.getNodeCount()).thenReturn(1L);
        when(job.getMaxRunTime()).thenReturn("00:01:00");
        when(job.getProcessorsPerNode()).thenReturn(1L);
        final ObjectNode jsonParams = mapper.createObjectNode();
        software.getParameters().forEach(param -> {
            if (param.getType() == SoftwareParameterType.bool) {
                jsonParams.put(param.getKey(), false);
            } else {
                jsonParams.put(param.getKey(), param.getDefaultValueAsJsonArray());
            }
        });
        when(job.getParametersAsJsonObject()).thenReturn(jsonParams);
        final ObjectNode jsonInputs = mapper.createObjectNode();
        software.getInputs().forEach(input -> {
            jsonInputs.set(input.getKey(), input.getDefaultValueAsJsonArray());
        });
        when(job.getInputsAsJsonObject()).thenReturn(jsonInputs);
        return job;
    }
private Job createMockJob ( ExecutionSystem executionSystem , Software software ) throws JobException { Job job = mock ( Job . class ) ; String jobUuid = new AgaveUUID ( UUIDType . JOB ) . toString ( ) ; when ( job . getSoftwareName ( ) ) . thenReturn ( software . getUniqueName ( ) ) ; when ( job . getSystem ( ) ) . thenReturn ( executionSystem . getSystemId ( ) ) ; when ( job . getExecutionType ( ) ) . thenReturn ( executionSystem . getExecutionType ( ) ) ; when ( job . getSchedulerType ( ) ) . thenReturn ( executionSystem . getScheduler ( ) ) ; when ( job . getUuid ( ) ) . thenReturn ( jobUuid ) ; when ( job . getId ( ) ) . thenReturn ( 1L ) ; when ( job . getWorkPath ( ) ) . thenReturn ( "/scratch/" + JSONTestDataUtil . TEST_OWNER + "/job-" + jobUuid ) ; when ( job . isArchiveOutput ( ) ) . thenReturn ( false ) ; when ( job . getName ( ) ) . thenReturn ( UUID . randomUUID ( ) . toString ( ) ) ; BatchQueue queue = executionSystem . getDefaultQueue ( ) ; when ( job . getBatchQueue ( ) ) . thenReturn ( queue . getName ( ) ) ; when ( job . getMemoryPerNode ( ) ) . thenReturn ( 1D ) ; when ( job . getNodeCount ( ) ) . thenReturn ( 1L ) ; when ( job . getMaxRunTime ( ) ) . thenReturn ( "00:01:00" ) ; when ( job . getProcessorsPerNode ( ) ) . thenReturn ( 1L ) ; final ObjectNode jsonParams = mapper . createObjectNode ( ) ; software . getParameters ( ) . forEach ( param -> { if ( param . getType ( ) == SoftwareParameterType . bool ) { jsonParams . put ( param . getKey ( ) , false ) ; } else { jsonParams . put ( param . getKey ( ) , param . getDefaultValueAsJsonArray ( ) ) ; } } ) ; when ( job . getParametersAsJsonObject ( ) ) . thenReturn ( jsonParams ) ; final ObjectNode jsonInputs = mapper . createObjectNode ( ) ; software . getInputs ( ) . forEach ( input -> { jsonInputs . set ( input . getKey ( ) , input . getDefaultValueAsJsonArray ( ) ) ; } ) ; when ( job . getInputsAsJsonObject ( ) ) . thenReturn ( jsonInputs ) ; return job ; }
Ceates a mock {@link Job} for testing using the given system and software.
Ceates a mock { @link Job } for testing using the given system and software .