agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/managers/monitors/parsers/JobMonitorResponseParserFactoryTest.java
/**
     * Tests that job execution system is returned
     */
Tests that job execution system is returned
Tests that job execution system is returned
@Test
    public void testGetExecutionSystemReturnsJobSystem() throws Exception {
        ExecutionSystem executionSystem = createMockExecutionSystem(ExecutionType.HPC, LSF);
        Software software = createMockSoftware(executionSystem, ExecutionType.CLI);
        Job job = createMockJob(executionSystem, software);
        JobManager jobManager = mock(JobManager.class);
        when(jobManager.getJobExecutionSystem(eq(job))).thenReturn(executionSystem);
        JobMonitorResponseParserFactory factory = mock(JobMonitorResponseParserFactory.class);
        when(factory.getJobManager()).thenReturn(jobManager);
        when(factory.getExecutionSystem(eq(job))).thenCallRealMethod();
        ExecutionSystem testExecutionSystem = factory.getExecutionSystem(job);
        verify(jobManager, times(1)).getJobExecutionSystem(job);
        verify(factory, times(1)).getExecutionSystem(job);
        Assert.assertEquals(testExecutionSystem, executionSystem,
                "Test job execution system should be returned from factory call to getExecutionSystem");
    }
@ Test public void testGetExecutionSystemReturnsJobSystem ( ) throws Exception { ExecutionSystem executionSystem = createMockExecutionSystem ( ExecutionType . HPC , LSF ) ; Software software = createMockSoftware ( executionSystem , ExecutionType . CLI ) ; Job job = createMockJob ( executionSystem , software ) ; JobManager jobManager = mock ( JobManager . class ) ; when ( jobManager . getJobExecutionSystem ( eq ( job ) ) ) . thenReturn ( executionSystem ) ; JobMonitorResponseParserFactory factory = mock ( JobMonitorResponseParserFactory . class ) ; when ( factory . getJobManager ( ) ) . thenReturn ( jobManager ) ; when ( factory . getExecutionSystem ( eq ( job ) ) ) . thenCallRealMethod ( ) ; ExecutionSystem testExecutionSystem = factory . getExecutionSystem ( job ) ; verify ( jobManager , times ( 1 ) ) . getJobExecutionSystem ( job ) ; verify ( factory , times ( 1 ) ) . getExecutionSystem ( job ) ; Assert . assertEquals ( testExecutionSystem , executionSystem , "Test job execution system should be returned from factory call to getExecutionSystem" ) ; }
Tests that job execution system is returned
Tests that job execution system is returned
// mock the job manager so we can intercept the actual db calls // verify it was called once // verify the response was what we thought it would be