@Test public void testRun() throws Exception { when( mockJob.isStopped() ).thenReturn( true ); jobRunner.run(); when( mockJob.isStopped() ).thenReturn( false ); when( mockJob.getParentJob() ).thenReturn( null ); jobRunner.run(); when( parentJob.isStopped() ).thenReturn( true ); when( mockJob.getParentJob() ).thenReturn( parentJob ); jobRunner.run(); when( parentJob.isStopped() ).thenReturn( false ); when( mockJob.execute( Mockito.anyInt(), Mockito.any( Result.class ) ) ).thenReturn( mockResult ); jobRunner.run(); }
public void run() { try { if ( job.isStopped() || ( job.getParentJob() != null && job.getParentJob().isStopped() ) ) { return; } ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobStart.id, getJob() ); job.fireJobStartListeners(); result = job.execute( entryNr + 1, result ); } catch ( KettleException e ) { e.printStackTrace(); log.logError( "An error occurred executing this job entry : ", e ); result.setResult( false ); result.setNrErrors( 1 ); } finally { job.setResult( result ); try { ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobFinish.id, getJob() ); job.fireJobFinishListeners(); } catch ( Exception e ) { result.setNrErrors( 1 ); result.setResult( false ); log.logError( BaseMessages.getString( PKG, "Job.Log.ErrorExecJob", e.getMessage() ), e ); } job.setFinished( true ); } finished = true; }
JobEntryJobRunner implements Runnable { public void run() { try { if ( job.isStopped() || ( job.getParentJob() != null && job.getParentJob().isStopped() ) ) { return; } ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobStart.id, getJob() ); job.fireJobStartListeners(); result = job.execute( entryNr + 1, result ); } catch ( KettleException e ) { e.printStackTrace(); log.logError( "An error occurred executing this job entry : ", e ); result.setResult( false ); result.setNrErrors( 1 ); } finally { job.setResult( result ); try { ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobFinish.id, getJob() ); job.fireJobFinishListeners(); } catch ( Exception e ) { result.setNrErrors( 1 ); result.setResult( false ); log.logError( BaseMessages.getString( PKG, "Job.Log.ErrorExecJob", e.getMessage() ), e ); } job.setFinished( true ); } finished = true; } }
JobEntryJobRunner implements Runnable { public void run() { try { if ( job.isStopped() || ( job.getParentJob() != null && job.getParentJob().isStopped() ) ) { return; } ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobStart.id, getJob() ); job.fireJobStartListeners(); result = job.execute( entryNr + 1, result ); } catch ( KettleException e ) { e.printStackTrace(); log.logError( "An error occurred executing this job entry : ", e ); result.setResult( false ); result.setNrErrors( 1 ); } finally { job.setResult( result ); try { ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobFinish.id, getJob() ); job.fireJobFinishListeners(); } catch ( Exception e ) { result.setNrErrors( 1 ); result.setResult( false ); log.logError( BaseMessages.getString( PKG, "Job.Log.ErrorExecJob", e.getMessage() ), e ); } job.setFinished( true ); } finished = true; } JobEntryJobRunner( Job job, Result result, int entryNr, LogChannelInterface log ); }
JobEntryJobRunner implements Runnable { public void run() { try { if ( job.isStopped() || ( job.getParentJob() != null && job.getParentJob().isStopped() ) ) { return; } ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobStart.id, getJob() ); job.fireJobStartListeners(); result = job.execute( entryNr + 1, result ); } catch ( KettleException e ) { e.printStackTrace(); log.logError( "An error occurred executing this job entry : ", e ); result.setResult( false ); result.setNrErrors( 1 ); } finally { job.setResult( result ); try { ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobFinish.id, getJob() ); job.fireJobFinishListeners(); } catch ( Exception e ) { result.setNrErrors( 1 ); result.setResult( false ); log.logError( BaseMessages.getString( PKG, "Job.Log.ErrorExecJob", e.getMessage() ), e ); } job.setFinished( true ); } finished = true; } JobEntryJobRunner( Job job, Result result, int entryNr, LogChannelInterface log ); void run(); void setResult( Result result ); Result getResult(); LogChannelInterface getLog(); void setLog( LogChannelInterface log ); Job getJob(); void setJob( Job job ); int getEntryNr(); void setEntryNr( int entryNr ); boolean isFinished(); void waitUntilFinished(); }
JobEntryJobRunner implements Runnable { public void run() { try { if ( job.isStopped() || ( job.getParentJob() != null && job.getParentJob().isStopped() ) ) { return; } ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobStart.id, getJob() ); job.fireJobStartListeners(); result = job.execute( entryNr + 1, result ); } catch ( KettleException e ) { e.printStackTrace(); log.logError( "An error occurred executing this job entry : ", e ); result.setResult( false ); result.setNrErrors( 1 ); } finally { job.setResult( result ); try { ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.JobFinish.id, getJob() ); job.fireJobFinishListeners(); } catch ( Exception e ) { result.setNrErrors( 1 ); result.setResult( false ); log.logError( BaseMessages.getString( PKG, "Job.Log.ErrorExecJob", e.getMessage() ), e ); } job.setFinished( true ); } finished = true; } JobEntryJobRunner( Job job, Result result, int entryNr, LogChannelInterface log ); void run(); void setResult( Result result ); Result getResult(); LogChannelInterface getLog(); void setLog( LogChannelInterface log ); Job getJob(); void setJob( Job job ); int getEntryNr(); void setEntryNr( int entryNr ); boolean isFinished(); void waitUntilFinished();  }