Java Code Examples for org.pentaho.di.trans.TransMeta#getStepLogTable()

The following examples show how to use org.pentaho.di.trans.TransMeta#getStepLogTable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PentahoMapReduceJobBuilderImpl.java    From pentaho-hadoop-shims with Apache License 2.0 5 votes vote down vote up
private void deleteLogging( Optional<TransConfiguration> transConfiguration ) {
  if ( !transConfiguration.isPresent() ) {
    return;
  }
  TransMeta meta = transConfiguration.get().getTransMeta();
  if ( meta == null ) {
    return;
  }
  BaseLogTable table = meta.getStepLogTable();
  table.setConnectionName( null );
  meta.setStepLogTable( (StepLogTable) table );

  table = meta.getMetricsLogTable();
  table.setConnectionName( null );
  meta.setMetricsLogTable( (MetricsLogTable) table );

  table = meta.getPerformanceLogTable();
  table.setConnectionName( null );
  meta.setPerformanceLogTable( (PerformanceLogTable) table );

  table = meta.getTransLogTable();
  table.setConnectionName( null );
  meta.setTransLogTable( (TransLogTable) table );

  table = meta.getChannelLogTable();
  table.setConnectionName( null );
  meta.setChannelLogTable( (ChannelLogTable) table );

}
 
Example 2
Source File: XmlExportHelper.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * When exporting meta we should not export user global parameters.
 * Method makes clone for each table and deletes all global parameters.
 * We have to make clones of each table, because we don't want to change real tables content.
 *
 * @param transMeta
 *              meta, that contains log tables to be refactored before export
 */
public static void swapTables( TransMeta transMeta ) {
  TransLogTable transLogTable = transMeta.getTransLogTable();
  if ( transLogTable != null ) {
    TransLogTable cloneTransLogTable = (TransLogTable) transLogTable.clone();
    cloneTransLogTable.setAllGlobalParametersToNull();
    transMeta.setTransLogTable( cloneTransLogTable );
  }

  StepLogTable stepLogTable = transMeta.getStepLogTable();
  if ( stepLogTable != null ) {
    StepLogTable cloneStepLogTable = (StepLogTable) stepLogTable.clone();
    cloneStepLogTable.setAllGlobalParametersToNull();
    transMeta.setStepLogTable( cloneStepLogTable );
  }

  PerformanceLogTable performanceLogTable = transMeta.getPerformanceLogTable();
  if ( performanceLogTable != null ) {
    PerformanceLogTable clonePerformanceLogTable = (PerformanceLogTable) performanceLogTable.clone();
    clonePerformanceLogTable.setAllGlobalParametersToNull();
    transMeta.setPerformanceLogTable( clonePerformanceLogTable );
  }

  ChannelLogTable channelLogTable = transMeta.getChannelLogTable();
  if ( channelLogTable != null ) {
    ChannelLogTable cloneChannelLogTable = (ChannelLogTable) channelLogTable.clone();
    cloneChannelLogTable.setAllGlobalParametersToNull();
    transMeta.setChannelLogTable( cloneChannelLogTable );
  }

  MetricsLogTable metricsLogTable = transMeta.getMetricsLogTable();
  if ( metricsLogTable != null ) {
    MetricsLogTable cloneMetricsLogTable = (MetricsLogTable) metricsLogTable.clone();
    cloneMetricsLogTable.setAllGlobalParametersToNull();
    transMeta.setMetricsLogTable( cloneMetricsLogTable );
  }
}
 
Example 3
Source File: SpoonExportXmlTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void savingTransToXmlNotChangesLogTables() {
  TransMeta transMeta = new TransMeta();
  initTables( transMeta );

  TransLogTable originTransLogTable = transMeta.getTransLogTable();
  StepLogTable originStepLogTable = transMeta.getStepLogTable();
  PerformanceLogTable originPerformanceLogTable = transMeta.getPerformanceLogTable();
  ChannelLogTable originChannelLogTable = transMeta.getChannelLogTable();
  MetricsLogTable originMetricsLogTable = transMeta.getMetricsLogTable();

  when( spoon.getActiveTransformation() ).thenReturn( transMeta );
  when( spoon.saveXMLFile( any( TransMeta.class ), anyBoolean() ) ).thenReturn( true );
  when( spoon.saveXMLFile( anyBoolean() ) ).thenCallRealMethod();

  spoon.saveXMLFile( true );

  tablesCommonValuesEqual( originTransLogTable, transMeta.getTransLogTable() );
  assertEquals( originTransLogTable.getLogInterval(), transMeta.getTransLogTable().getLogInterval() );
  assertEquals( originTransLogTable.getLogSizeLimit(), transMeta.getTransLogTable().getLogSizeLimit() );

  tablesCommonValuesEqual( originStepLogTable, transMeta.getStepLogTable() );

  tablesCommonValuesEqual( originPerformanceLogTable, transMeta.getPerformanceLogTable() );
  assertEquals( originPerformanceLogTable.getLogInterval(), transMeta.getPerformanceLogTable().getLogInterval() );

  tablesCommonValuesEqual( originChannelLogTable, transMeta.getChannelLogTable() );

  tablesCommonValuesEqual( originMetricsLogTable, transMeta.getMetricsLogTable() );
}