本文整理了Java中org.pentaho.di.job.Job.execute()
方法的一些代码示例,展示了Job.execute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Job.execute()
方法的具体详情如下:
包路径:org.pentaho.di.job.Job
类名称:Job
方法名:execute
[英]Execute a job without previous results. This is a job entry point (not recursive)
[中]在没有先前结果的情况下执行作业。这是作业入口点(非递归)
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testRunSetsResult() throws Exception {
when( mockJob.isStopped() ).thenReturn( false );
when( mockJob.getParentJob() ).thenReturn( parentJob );
when( parentJob.isStopped() ).thenReturn( false );
when( mockJob.execute( Mockito.anyInt(), Mockito.any( Result.class ) ) ).thenReturn( mockResult );
jobRunner.run();
verify( mockJob, times( 1 ) ).setResult( Mockito.any( Result.class ) );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testRunWithExceptionOnExecuteAndFireJobSetsResult() throws KettleException {
when( mockJob.isStopped() ).thenReturn( false );
when( mockJob.getParentJob() ).thenReturn( parentJob );
when( parentJob.isStopped() ).thenReturn( false );
when( mockJob.execute( Mockito.anyInt(), Mockito.any( Result.class ) ) ).thenReturn( mockResult );
doThrow( KettleException.class ).when( mockJob ).execute( anyInt(), any( Result.class ) );
doThrow( Exception.class ).when( mockJob ).fireJobFinishListeners();
jobRunner.run();
verify( mockJob, times( 1 ) ).setResult( Mockito.any( Result.class ) );
assertTrue( jobRunner.isFinished() );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testRunWithExceptionOnExecuteSetsResult() throws Exception {
when( mockJob.isStopped() ).thenReturn( false );
when( mockJob.getParentJob() ).thenReturn( parentJob );
when( parentJob.isStopped() ).thenReturn( false );
doThrow( KettleException.class ).when( mockJob ).execute( anyInt(), any( Result.class ) );
jobRunner.run();
verify( mockJob, times( 1 ) ).setResult( Mockito.any( Result.class ) );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testWaitUntilFinished() throws Exception {
when( mockJob.isStopped() ).thenReturn( true );
when( mockJob.getParentJob() ).thenReturn( parentJob );
when( parentJob.isStopped() ).thenReturn( false );
when( mockJob.execute( Mockito.anyInt(), Mockito.any( Result.class ) ) ).thenReturn( mockResult );
jobRunner.waitUntilFinished();
}
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testRunWithException() throws Exception {
when( mockJob.isStopped() ).thenReturn( false );
when( mockJob.getParentJob() ).thenReturn( parentJob );
when( mockJob.getJobMeta() ).thenReturn( mockJobMeta );
when( parentJob.isStopped() ).thenReturn( false );
doThrow( KettleException.class ).when( mockJob ).execute( anyInt(), any( Result.class ) );
jobRunner.run();
verify( mockResult, times( 1 ) ).setNrErrors( Mockito.anyInt() );
//[PDI-14981] catch more general exception to prevent thread hanging
doThrow( Exception.class ).when( mockJob ).fireJobFinishListeners();
jobRunner.run();
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testRunWithExceptionOnFireJobSetsResult() throws KettleException {
when( mockJob.isStopped() ).thenReturn( false );
when( mockJob.getParentJob() ).thenReturn( parentJob );
when( parentJob.isStopped() ).thenReturn( false );
when( mockJob.execute( Mockito.anyInt(), Mockito.any( Result.class ) ) ).thenReturn( mockResult );
doThrow( Exception.class ).when( mockJob ).fireJobFinishListeners();
jobRunner.run();
verify( mockJob, times( 1 ) ).setResult( Mockito.any( Result.class ) );
assertTrue( jobRunner.isFinished() );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testIsFinished() throws Exception {
assertFalse( jobRunner.isFinished() );
when( mockJob.isStopped() ).thenReturn( false );
when( mockJob.getParentJob() ).thenReturn( parentJob );
when( parentJob.isStopped() ).thenReturn( false );
when( mockJob.execute( Mockito.anyInt(), Mockito.any( Result.class ) ) ).thenReturn( mockResult );
jobRunner.run();
assertTrue( jobRunner.isFinished() );
}
代码示例来源:origin: pentaho/pentaho-kettle
private void executeWithPreviousResultsTest( boolean repeat ) {
setupJobMockExecution();
try {
when( mockedJobEntrySpecial.execute( any( Result.class ), anyInt() ) ).thenReturn( new Result( ) );
when( mockedJob.execute( anyInt(), any( Result.class ) ) ).thenCallRealMethod();
when( mockedJobEntrySpecial.isRepeat() ).thenReturn( repeat );
if ( repeat ) {
//The job will repeat its execution until it is stopped
scheduleStopJobExecution();
}
mockedJob.execute( 0, new Result( ) );
//Test expected invocations. If repeat setActive(false) will be called at least twice. With no repeat, only once.
verify( mockedJob, repeat ? atLeast( 2 ) : times( 1 ) ).setActive( false );
} catch ( KettleException e ) {
Assert.fail( "Could not execute job" );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testRun() throws Exception {
// Call all the NO-OP paths
when( mockJob.isStopped() ).thenReturn( true );
jobRunner.run();
when( mockJob.isStopped() ).thenReturn( false );
when( mockJob.getParentJob() ).thenReturn( null );
when( mockJob.getJobMeta() ).thenReturn( mockJobMeta );
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();
}
代码示例来源:origin: pentaho/pentaho-kettle
res = execute( nr + 1, newResult, nextEntry, jobEntryCopy, nextComment );
} catch ( Throwable e ) {
log.logError( Const.getStackTracker( e ) );
代码示例来源:origin: pentaho/pentaho-kettle
Result res;
do {
res = execute( nr, result, startpoint, null, BaseMessages.getString( PKG, "Job.Reason.StartOfJobentry" ) );
setActive( false );
} while ( jes.isRepeat() && !isStopped() );
代码示例来源:origin: pentaho/pentaho-kettle
result = job.execute( entryNr + 1, result );
} catch ( KettleException e ) {
e.printStackTrace();
代码示例来源:origin: pentaho/pentaho-kettle
result = data.executorJob.execute( 0, result );
} catch ( KettleException e ) {
log.logError( "An error occurred executing the job: ", e );
代码示例来源:origin: pentaho/pentaho-kettle
result = execute();
} catch ( Throwable je ) {
log.logError( BaseMessages.getString( PKG, "Job.Log.ErrorExecJob", je.getMessage() ), je );
代码示例来源:origin: pentaho/pentaho-kettle
while ( ( jes.isRepeat() || isFirst ) && !isStopped() ) {
isFirst = false;
res = execute( 0, null, startpoint, null, BaseMessages.getString( PKG, "Job.Reason.Started" ) );
BaseMessages.getString( PKG, "Job.Reason.Finished" ), null, 0, null );
} else {
res = execute( 0, res, startpoint, null, BaseMessages.getString( PKG, "Job.Reason.Started" ) );
jerEnd =
new JobEntryResult( res, startpoint.getEntry().getLogChannel().getLogChannelId(), BaseMessages.getString(
内容来源于网络,如有侵权,请联系作者删除!