org.pentaho.di.core.database.Database.cleanupLogRecords()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中org.pentaho.di.core.database.Database.cleanupLogRecords()方法的一些代码示例,展示了Database.cleanupLogRecords()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Database.cleanupLogRecords()方法的具体详情如下:
包路径:org.pentaho.di.core.database.Database
类名称:Database
方法名:cleanupLogRecords

Database.cleanupLogRecords介绍

暂无

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

  1. @Test
  2. public void testRecordsCleanUpMethodIsCalled() throws Exception {
  3. Database mockedDataBase = mock( Database.class );
  4. Trans trans = mock( Trans.class );
  5. StepLogTable stepLogTable =
  6. StepLogTable.getDefault( mock( VariableSpace.class ), mock( HasDatabasesInterface.class ) );
  7. stepLogTable.setConnectionName( "connection" );
  8. TransMeta transMeta = new TransMeta();
  9. transMeta.setStepLogTable( stepLogTable );
  10. when( trans.getTransMeta() ).thenReturn( transMeta );
  11. when( trans.createDataBase( any( DatabaseMeta.class ) ) ).thenReturn( mockedDataBase );
  12. when( trans.getSteps() ).thenReturn( new ArrayList<>() );
  13. doCallRealMethod().when( trans ).writeStepLogInformation();
  14. trans.writeStepLogInformation();
  15. verify( mockedDataBase ).cleanupLogRecords( stepLogTable );
  16. }

代码示例来源:origin: pentaho/pentaho-kettle

  1. @Test
  2. public void recordsCleanUpMethodIsCalled_JobLogTable() throws Exception {
  3. JobLogTable jobLogTable = JobLogTable.getDefault( mockedVariableSpace, hasDatabasesInterface );
  4. setAllTableParamsDefault( jobLogTable );
  5. doCallRealMethod().when( mockedJob ).writeLogTableInformation( jobLogTable, LogStatus.END );
  6. mockedJob.writeLogTableInformation( jobLogTable, LogStatus.END );
  7. verify( mockedDataBase ).cleanupLogRecords( jobLogTable );
  8. }

代码示例来源:origin: pentaho/pentaho-kettle

  1. @Test
  2. public void recordsCleanUpMethodIsCalled_JobEntryLogTable() throws Exception {
  3. JobEntryLogTable jobEntryLogTable = JobEntryLogTable.getDefault( mockedVariableSpace, hasDatabasesInterface );
  4. setAllTableParamsDefault( jobEntryLogTable );
  5. JobMeta jobMeta = new JobMeta( );
  6. jobMeta.setJobEntryLogTable( jobEntryLogTable );
  7. when( mockedJob.getJobMeta() ).thenReturn( jobMeta );
  8. doCallRealMethod().when( mockedJob ).writeJobEntryLogInformation();
  9. mockedJob.writeJobEntryLogInformation();
  10. verify( mockedDataBase ).cleanupLogRecords( jobEntryLogTable );
  11. }

代码示例来源:origin: pentaho/pentaho-kettle

  1. db.cleanupLogRecords( metricsLogTable );
  2. } catch ( Exception e ) {
  3. throw new KettleException( BaseMessages.getString( PKG,

代码示例来源:origin: pentaho/pentaho-kettle

  1. ldb.cleanupLogRecords( performanceLogTable );

代码示例来源:origin: pentaho/pentaho-kettle

  1. /**
  2. * Writes step information to a step logging table (if one has been configured).
  3. *
  4. * @throws KettleException if any errors occur during logging
  5. */
  6. protected void writeStepLogInformation() throws KettleException {
  7. Database db = null;
  8. StepLogTable stepLogTable = getTransMeta().getStepLogTable();
  9. try {
  10. db = createDataBase( stepLogTable.getDatabaseMeta() );
  11. db.shareVariablesWith( this );
  12. db.connect();
  13. db.setCommit( logCommitSize );
  14. for ( StepMetaDataCombi combi : getSteps() ) {
  15. db.writeLogRecord( stepLogTable, LogStatus.START, combi, null );
  16. }
  17. db.cleanupLogRecords( stepLogTable );
  18. } catch ( Exception e ) {
  19. throw new KettleException( BaseMessages.getString( PKG,
  20. "Trans.Exception.UnableToWriteStepInformationToLogTable" ), e );
  21. } finally {
  22. disconnectDb( db );
  23. }
  24. }

代码示例来源:origin: pentaho/pentaho-kettle

  1. /**
  2. * Writes information to Job Log table. Cleans old records, in case job is finished.
  3. */
  4. protected void writeLogTableInformation( JobLogTable jobLogTable, LogStatus status ) throws KettleJobException,
  5. KettleDatabaseException {
  6. boolean cleanLogRecords = status.equals( LogStatus.END );
  7. String tableName = jobLogTable.getActualTableName();
  8. DatabaseMeta logcon = jobLogTable.getDatabaseMeta();
  9. Database ldb = createDataBase( logcon );
  10. ldb.shareVariablesWith( this );
  11. try {
  12. ldb.connect();
  13. ldb.setCommit( logCommitSize );
  14. ldb.writeLogRecord( jobLogTable, status, this, null );
  15. if ( cleanLogRecords ) {
  16. ldb.cleanupLogRecords( jobLogTable );
  17. }
  18. } catch ( KettleDatabaseException dbe ) {
  19. addErrors( 1 );
  20. throw new KettleJobException( "Unable to end processing by writing log record to table " + tableName, dbe );
  21. } finally {
  22. if ( !ldb.isAutoCommit() ) {
  23. ldb.commitLog( true, jobLogTable );
  24. }
  25. ldb.disconnect();
  26. }
  27. }

代码示例来源:origin: pentaho/pentaho-kettle

  1. /**
  2. * Write job entry log information.
  3. *
  4. * @throws KettleException
  5. * the kettle exception
  6. */
  7. protected void writeJobEntryLogInformation() throws KettleException {
  8. Database db = null;
  9. JobEntryLogTable jobEntryLogTable = getJobMeta().getJobEntryLogTable();
  10. try {
  11. db = createDataBase( jobEntryLogTable.getDatabaseMeta() );
  12. db.shareVariablesWith( this );
  13. db.connect();
  14. db.setCommit( logCommitSize );
  15. for ( JobEntryCopy copy : getJobMeta().getJobCopies() ) {
  16. db.writeLogRecord( jobEntryLogTable, LogStatus.START, copy, this );
  17. }
  18. db.cleanupLogRecords( jobEntryLogTable );
  19. } catch ( Exception e ) {
  20. throw new KettleException( BaseMessages.getString( PKG, "Job.Exception.UnableToJobEntryInformationToLogTable" ),
  21. e );
  22. } finally {
  23. if ( !db.isAutoCommit() ) {
  24. db.commitLog( true, jobEntryLogTable );
  25. }
  26. db.disconnect();
  27. }
  28. }

代码示例来源:origin: pentaho/pentaho-kettle

  1. db.cleanupLogRecords( channelLogTable );

代码示例来源:origin: pentaho/pentaho-kettle

  1. ldb.cleanupLogRecords( transLogTable );

代码示例来源:origin: pentaho/pentaho-kettle

  1. db.cleanupLogRecords( channelLogTable );
  2. } catch ( Exception e ) {
  3. throw new KettleException( BaseMessages.getString( PKG,

相关文章