org.pentaho.di.core.logging.LoggingObjectInterface Java Examples

The following examples show how to use org.pentaho.di.core.logging.LoggingObjectInterface. 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: JobExecutorTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  executor = StepMockUtil.getStep( JobExecutor.class, JobExecutorMeta.class, "TransExecutorUnitTest" );
  executor = spy( executor );
  executor.setInputRowMeta( mock( RowMetaInterface.class ) );

  doNothing().when( executor ).discardLogLines( any( JobExecutorData.class ) );

  meta = new JobExecutorMeta();
  data = new JobExecutorData();
  Job job = mock( Job.class );
  doReturn( job ).when( executor ).createJob( any( Repository.class ), any( JobMeta.class ),
    any( LoggingObjectInterface.class ) );
  doReturn( ArrayUtils.EMPTY_STRING_ARRAY ).when( job ).listParameters();

  data.groupBuffer = new ArrayList<>();
  data.groupSize = -1;
  data.groupTime = -1;
  data.groupField = null;
}
 
Example #2
Source File: XMLInputStreamTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws KettleException {
  stepMockHelper =
      new StepMockHelper<XMLInputStreamMeta, XMLInputStreamData>( "XMLInputStreamTest", XMLInputStreamMeta.class,
          XMLInputStreamData.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
      stepMockHelper.logChannelInterface );
  when( stepMockHelper.trans.isRunning() ).thenReturn( true );

  xmlInputStreamMeta = new XMLInputStreamMeta();
  xmlInputStreamMeta.setDefault();

  xmlInputStreamData = new XMLInputStreamData();
  rl = new TestRowListener();

  // Turn off several options.
  // So there are fields: xml_data_type_description - xml_path - xml_data_name - xml_data_value
  xmlInputStreamMeta.setIncludeXmlParentPathField( false );
  xmlInputStreamMeta.setIncludeXmlParentElementIDField( false );
  xmlInputStreamMeta.setIncludeXmlElementIDField( false );
  xmlInputStreamMeta.setIncludeXmlElementLevelField( false );
}
 
Example #3
Source File: XMLOutputTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {

  stepMockHelper =
      new StepMockHelper<XMLOutputMeta, XMLOutputData>( "XML_OUTPUT_TEST", XMLOutputMeta.class, XMLOutputData.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
      stepMockHelper.logChannelInterface );
  StepMeta mockMeta = mock( StepMeta.class );
  when( stepMockHelper.transMeta.findStep( Matchers.anyString() ) ).thenReturn( mockMeta );
  when( trans.getLogLevel() ).thenReturn( LogLevel.DEBUG );

  // Create and set Meta with some realistic data
  xmlOutputMeta = new XMLOutputMeta();
  xmlOutputMeta.setOutputFields( initOutputFields( rowWithData.length, ContentType.Attribute ) );
  // Set as true to prevent unnecessary for this test checks at initialization
  xmlOutputMeta.setDoNotOpenNewFileInit( false );

  xmlOutputData = new XMLOutputData();
  xmlOutputData.formatRowMeta = initRowMeta( rowWithData.length );
  xmlOutputData.fieldnrs = initFieldNmrs( rowWithData.length );
  xmlOutputData.OpenedNewFile = true;

  StepMeta stepMeta = new StepMeta( "StepMetaId", "StepMetaName", xmlOutputMeta );
  xmlOutput = spy( new XMLOutput( stepMeta, xmlOutputData, 0, stepMockHelper.transMeta, stepMockHelper.trans ) );
}
 
Example #4
Source File: JsonOutputTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void testNpeIsNotThrownOnNullInput() throws Exception {
  StepMockHelper<JsonOutputMeta, JsonOutputData> mockHelper =
      new StepMockHelper<JsonOutputMeta, JsonOutputData>( "jsonOutput", JsonOutputMeta.class, JsonOutputData.class );
  when( mockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
      mockHelper.logChannelInterface );
  when( mockHelper.trans.isRunning() ).thenReturn( true );
  when( mockHelper.stepMeta.getStepMetaInterface() ).thenReturn( new JsonOutputMeta() );

  JsonOutput step =
      new JsonOutput( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans );
  step = spy( step );

  doReturn( null ).when( step ).getRow();

  step.processRow( mockHelper.processRowsStepMetaInterface, mockHelper.processRowsStepDataInterface );
}
 
Example #5
Source File: TextFileOutputTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  stepMockHelper =
    new StepMockHelper<>( "TEXT FILE OUTPUT TEST", TextFileOutputMeta.class, TextFileOutputData.class );
  Mockito.when( stepMockHelper.logChannelInterfaceFactory.create( Mockito.any(), Mockito.any( LoggingObjectInterface.class ) ) ).thenReturn(
      stepMockHelper.logChannelInterface );
  Mockito.verify( stepMockHelper.logChannelInterface, Mockito.never() ).logError( Mockito.anyString() );
  Mockito.verify( stepMockHelper.logChannelInterface, Mockito.never() ).logError( Mockito.anyString(), Mockito.any( Object[].class ) );
  Mockito.verify( stepMockHelper.logChannelInterface, Mockito.never() ).logError( Mockito.anyString(), Mockito.any( Throwable.class ) );
  Mockito.when( stepMockHelper.trans.isRunning() ).thenReturn( true );
  Mockito.verify( stepMockHelper.trans, Mockito.never() ).stopAll();
  Mockito.when( stepMockHelper.processRowsStepMetaInterface.getSeparator() ).thenReturn( " " );
  Mockito.when( stepMockHelper.processRowsStepMetaInterface.getEnclosure() ).thenReturn( "\"" );
  Mockito.when( stepMockHelper.processRowsStepMetaInterface.getNewline() ).thenReturn( "\n" );
  Mockito.when( stepMockHelper.transMeta.listVariables() ).thenReturn( new String[0] );
}
 
Example #6
Source File: Trans.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the parent logging object.
 *
 * @param parent the new parent
 */
public void setParent( LoggingObjectInterface parent ) {
  this.parent = parent;

  this.log = new LogChannel( this, parent );
  this.logLevel = log.getLogLevel();

  if ( this.containerObjectId == null ) {
    this.containerObjectId = log.getContainerObjectId();
  }

  if ( log.isDetailed() ) {
    log.logDetailed( BaseMessages.getString( PKG, "Trans.Log.TransformationIsPreloaded" ) );
  }
  if ( log.isDebug() ) {
    log.logDebug( BaseMessages.getString( PKG, "Trans.Log.NumberOfStepsToRun", String.valueOf( transMeta.nrSteps() ),
      String.valueOf( transMeta.nrTransHops() ) ) );
  }

}
 
Example #7
Source File: Trans.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Initializes a transformation from transformation meta-data defined in memory. Also take into account the parent log
 * channel interface (job or transformation) for logging lineage purposes.
 *
 * @param transMeta the transformation meta-data to use.
 * @param parent    the parent job that is executing this transformation
 */
public Trans( TransMeta transMeta, LoggingObjectInterface parent ) {
  this();
  this.transMeta = transMeta;
  this.containerObjectId = transMeta.getContainerObjectId();

  setParent( parent );

  initializeVariablesFrom( transMeta );
  copyParametersFrom( transMeta );
  transMeta.activateParameters();

  // Get a valid transactionId in case we run database transactional.
  transactionId = calculateTransactionId();
  threadName = transactionId; // / backward compatibility but deprecated!
}
 
Example #8
Source File: InsertUpdateMetaTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Test
public void testErrorProcessRow() throws KettleException {
  Mockito.when( mockHelper.logChannelInterfaceFactory.create( Mockito.any(), Mockito.any( LoggingObjectInterface.class ) ) )
    .thenReturn(
      mockHelper.logChannelInterface );
  Mockito.when( mockHelper.stepMeta.getStepMetaInterface() ).thenReturn( new InsertUpdateMeta() );

  InsertUpdate insertUpdateStep =
    new InsertUpdate( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans );
  insertUpdateStep = Mockito.spy( insertUpdateStep );

  Mockito.doReturn( new Object[] {} ).when( insertUpdateStep ).getRow();
  insertUpdateStep.first = false;
  mockHelper.processRowsStepDataInterface.lookupParameterRowMeta = Mockito.mock( RowMetaInterface.class );
  mockHelper.processRowsStepDataInterface.keynrs = new int[] {};
  mockHelper.processRowsStepDataInterface.db = Mockito.mock( Database.class );
  mockHelper.processRowsStepDataInterface.valuenrs = new int[] {};
  Mockito.doThrow( new KettleStepException( "Test exception" ) ).when( insertUpdateStep ).putRow( Mockito.any(), Mockito.any() );

  boolean result =
    insertUpdateStep.processRow( mockHelper.processRowsStepMetaInterface, mockHelper.processRowsStepDataInterface );
  Assert.assertFalse( result );
}
 
Example #9
Source File: OraBulkLoaderTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  stepMockHelper = new StepMockHelper<OraBulkLoaderMeta, OraBulkLoaderData>( "TEST_CREATE_COMMANDLINE",
    OraBulkLoaderMeta.class, OraBulkLoaderData.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
    stepMockHelper.logChannelInterface );
  when( stepMockHelper.trans.isRunning() ).thenReturn( true );
  oraBulkLoader = spy( new OraBulkLoader( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0,
    stepMockHelper.transMeta, stepMockHelper.trans ) );

  tempControlFile = TempFile.createTempFile( "control", "test" );
  tempControlFile.deleteOnExit();
  tempDataFile = TempFile.createTempFile( "data", "test" );
  tempDataFile.deleteOnExit();
  tempControlFilepath = tempControlFile.getAbsolutePath();
  tempDataFilepath = tempDataFile.getAbsolutePath();
  tempControlVfsFilepath = "file:///" + tempControlFilepath;
  tempDataVfsFilepath = "file:///" + tempDataFilepath;
}
 
Example #10
Source File: SubtransExecutorTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Test
public void stopsAll() throws KettleException {
  TransMeta parentMeta =
    new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() );
  TransMeta subMeta =
    new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() );
  LoggingObjectInterface loggingObject = new LoggingObject( "anything" );
  Trans parentTrans = new Trans( parentMeta, loggingObject );
  SubtransExecutor subtransExecutor =
    new SubtransExecutor( "subtransname", parentTrans, subMeta, true, new TransExecutorParameters(), "", 1001 );
  subtransExecutor.running = Mockito.spy( subtransExecutor.running );
  RowMetaInterface rowMeta = parentMeta.getStepFields( "Data Grid" );
  List<RowMetaAndData> rows = Arrays.asList(
    new RowMetaAndData( rowMeta, "Pentaho", 1L ),
    new RowMetaAndData( rowMeta, "Pentaho", 2L ),
    new RowMetaAndData( rowMeta, "Pentaho", 3L ),
    new RowMetaAndData( rowMeta, "Pentaho", 4L ) );
  subtransExecutor.execute( rows );
  verify( subtransExecutor.running ).add( any() );
  subtransExecutor.stop();
  assertTrue( subtransExecutor.running.isEmpty() );
}
 
Example #11
Source File: Job.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public Job( Repository repository, JobMeta jobMeta, LoggingObjectInterface parentLogging ) {
  this.rep = repository;
  this.jobMeta = jobMeta;
  this.containerObjectId = jobMeta.getContainerObjectId();
  this.parentLoggingObject = parentLogging;

  init();

  jobTracker = new JobTracker( jobMeta );

  this.log = new LogChannel( this, parentLogging );
  this.logLevel = log.getLogLevel();

  if ( this.containerObjectId == null ) {
    this.containerObjectId = log.getContainerObjectId();
  }
}
 
Example #12
Source File: MemoryGroupByNewAggregateTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  mockHelper =
      new StepMockHelper<MemoryGroupByMeta, MemoryGroupByData>( "Memory Group By", MemoryGroupByMeta.class,
          MemoryGroupByData.class );
  when( mockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
      mockHelper.logChannelInterface );
  when( mockHelper.trans.isRunning() ).thenReturn( true );

  // In this step we will distinct String aggregations from numeric ones
  strings = new ArrayList<Integer>();
  strings.add( MemoryGroupByMeta.TYPE_GROUP_CONCAT_COMMA );
  strings.add( MemoryGroupByMeta.TYPE_GROUP_CONCAT_STRING );

  // Statistics will be initialized with collections...
  statistics = new ArrayList<Integer>();
  statistics.add( MemoryGroupByMeta.TYPE_GROUP_MEDIAN );
  statistics.add( MemoryGroupByMeta.TYPE_GROUP_PERCENTILE );
}
 
Example #13
Source File: DatabaseLookupUTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private StepMockHelper<DatabaseLookupMeta, DatabaseLookupData> createMockHelper() {
  StepMockHelper<DatabaseLookupMeta, DatabaseLookupData> mockHelper =
    new StepMockHelper<DatabaseLookupMeta, DatabaseLookupData>( "test DatabaseLookup", DatabaseLookupMeta.class,
      DatabaseLookupData.class );
  when( mockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) )
    .thenReturn( mockHelper.logChannelInterface );
  when( mockHelper.trans.isRunning() ).thenReturn( true );

  RowMeta inputRowMeta = new RowMeta();
  RowSet rowSet = mock( RowSet.class );
  when( rowSet.getRowWait( anyLong(), any( TimeUnit.class ) ) ).thenReturn( new Object[ 0 ] ).thenReturn( null );
  when( rowSet.getRowMeta() ).thenReturn( inputRowMeta );

  when( mockHelper.trans.findRowSet( anyString(), anyInt(), anyString(), anyInt() ) ).thenReturn( rowSet );

  when( mockHelper.transMeta.findNextSteps( Matchers.any( StepMeta.class ) ) )
    .thenReturn( Collections.singletonList( mock( StepMeta.class ) ) );
  when( mockHelper.transMeta.findPreviousSteps( any( StepMeta.class ), anyBoolean() ) )
    .thenReturn( Collections.singletonList( mock( StepMeta.class ) ) );

  return mockHelper;
}
 
Example #14
Source File: MappingInputFieldsTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  meta = new MappingInputMeta();
  meta.setFieldName( new String[] { "n2", "n4" } );
  meta.setFieldType( new int[] { ValueMetaInterface.TYPE_INTEGER, ValueMetaInterface.TYPE_INTEGER } );
  meta.setFieldLength( new int[] { 0, 0 } );
  meta.setFieldPrecision( new int[] { 0, 0 } );

  StepMeta sm = new StepMeta( "MappingInput", "SubTrans", meta );
  TransMeta tm = new TransMeta();
  tm.addStep( sm );
  LoggingObjectInterface loi = new SimpleLoggingObject( "lo", LoggingObjectType.STEP, null );
  Trans tr = new Trans( tm, loi );

  step = new MappingInput( sm, null, 0, tm, tr );
  step.getTrans().setRunning( true );
}
 
Example #15
Source File: JobTrackerExecution.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Before
public void setUpBeforeClass() throws Exception {
  KettleEnvironment.init();
  LoggingObjectInterface log = new SimpleLoggingObject( "junit", LoggingObjectType.GENERAL, null );

  File file = File.createTempFile( JobTrackerExecution.class.getSimpleName(), "" );
  file.deleteOnExit();
  DatabaseMeta databaseMeta =
      new DatabaseMeta( NAME, "Hypersonic", "JDBC", null, "mem:HSQLDB-JUNIT-LOGJOB", null, null, null );
  Database logDataBase = new Database( log, databaseMeta );
  logDataBase.connect();

  // run sql create for database
  InputStream input = JobTrackerExecution.class.getClassLoader().getResourceAsStream( PKG + CREATE );
  String sql = getStringFromInput( input );
  logDataBase.execStatements( sql );
  logDataBase.commit( true );

  logDataBase.disconnect();
}
 
Example #16
Source File: ReplaceStringTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  stepMockHelper = new StepMockHelper<>( "REPLACE STRING TEST", ReplaceStringMeta.class, ReplaceStringData.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
    stepMockHelper.logChannelInterface );
  verify( stepMockHelper.logChannelInterface, never() ).logError( anyString() );
  verify( stepMockHelper.logChannelInterface, never() ).logError( anyString(), any( Object[].class ) );
  verify( stepMockHelper.logChannelInterface, never() ).logError( anyString(), (Throwable) anyObject() );
  when( stepMockHelper.trans.isRunning() ).thenReturn( true );
}
 
Example #17
Source File: BaseStepTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void testBaseStepGetLogLevelWontThrowNPEWithNullLog() {
  when( mockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenAnswer(
    new Answer<LogChannelInterface>() {

      @Override
      public LogChannelInterface answer( InvocationOnMock invocation ) throws Throwable {
        ( (BaseStep) invocation.getArguments()[ 0 ] ).getLogLevel();
        return mockHelper.logChannelInterface;
      }
    } );
  new BaseStep( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans )
    .getLogLevel();
}
 
Example #18
Source File: ReplaceStringProcessRowUnicodeTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  stepMockHelper = new StepMockHelper<>( "REPLACE STRING TEST", ReplaceStringMeta.class, ReplaceStringData.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
    stepMockHelper.logChannelInterface );
  verify( stepMockHelper.logChannelInterface, never() ).logError( anyString() );
  verify( stepMockHelper.logChannelInterface, never() ).logError( anyString(), any( Object[].class ) );
  verify( stepMockHelper.logChannelInterface, never() ).logError( anyString(), (Throwable) anyObject() );
  when( stepMockHelper.trans.isRunning() ).thenReturn( true );
}
 
Example #19
Source File: GPBulkLoaderTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  mockHelper =
    new StepMockHelper<GPBulkLoaderMeta, GPBulkLoaderData>(
      "GPBulkLoad", GPBulkLoaderMeta.class, GPBulkLoaderData.class );
  when( mockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
    mockHelper.logChannelInterface );
  when( mockHelper.trans.isRunning() ).thenReturn( true );
}
 
Example #20
Source File: PGBulkLoaderTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  stepMockHelper = new StepMockHelper<>( "PostgreSQL Bulk Loader", PGBulkLoaderMeta.class, PGBulkLoaderData.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn( stepMockHelper.logChannelInterface );
  when( stepMockHelper.trans.isRunning() ).thenReturn( true );
  pgBulkLoader = new PGBulkLoader( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans );
}
 
Example #21
Source File: LDAPInputTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setup() {
  stepMockHelper =
    new StepMockHelper<LDAPInputMeta, LDAPInputData>(
      "LDAP INPUT TEST", LDAPInputMeta.class, LDAPInputData.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) )
    .thenReturn( stepMockHelper.logChannelInterface );
  when( stepMockHelper.trans.isRunning() ).thenReturn( true );
}
 
Example #22
Source File: ExcelWriterStepTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  String path = TestUtils.createRamFile( getClass().getSimpleName() + "/testXLSProtect.xls" );
  FileObject xlsFile = TestUtils.getFileObject( path );
  wb = createWorkbook( xlsFile );
  mockHelper = new StepMockHelper<>( "Excel Writer Test", ExcelWriterStepMeta.class, ExcelWriterStepData.class );
  when( mockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
    mockHelper.logChannelInterface );
  step = spy( new ExcelWriterStep(
    mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ) );

  stepMeta = new ExcelWriterStepMeta();
  metaMock = mock( ExcelWriterStepMeta.class );
  dataMock = mock( ExcelWriterStepData.class );
}
 
Example #23
Source File: MappingInputTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  stepMockHelper =
    new StepMockHelper<MappingInputMeta, MappingInputData>( stepName, MappingInputMeta.class,
      MappingInputData.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
    stepMockHelper.logChannelInterface );
  // when( stepMockHelper.trans.isRunning() ).thenReturn( true );
  setProcessRowEnded( false );
}
 
Example #24
Source File: CsvInputDoubleLineEndTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUp() throws KettleException {
  stepMockHelper =
    StepMockUtil.getStepMockHelper( CsvInputMeta.class, "CsvInputDoubleLineEndTest" );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) )
    .thenReturn( stepMockHelper.logChannelInterface );
  when( stepMockHelper.trans.isRunning() ).thenReturn( true );
}
 
Example #25
Source File: PDI_11152_Test.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
  smh = new StepMockHelper<UpdateMeta, UpdateData>( "Update", UpdateMeta.class, UpdateData.class );
  when( smh.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
      smh.logChannelInterface );
  when( smh.trans.isRunning() ).thenReturn( true );
}
 
Example #26
Source File: MetricsUtil.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static List<MetricsDuration> getAllDurations( String parentLogChannelId ) {
  List<MetricsDuration> durations = new ArrayList<MetricsDuration>();

  List<String> logChannelIds = LoggingRegistry.getInstance().getLogChannelChildren( parentLogChannelId );
  for ( String logChannelId : logChannelIds ) {
    LoggingObjectInterface object = LoggingRegistry.getInstance().getLoggingObject( logChannelId );
    if ( object != null ) {
      durations.addAll( getDurations( logChannelId ) );
    }
  }

  return durations;
}
 
Example #27
Source File: StepMockUtil.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static <T extends StepMetaInterface, V extends BaseStep> StepMockHelper<T, StepDataInterface> getStepMockHelper( Class<T> meta, String name ) {
  StepMockHelper<T, StepDataInterface> stepMockHelper = new StepMockHelper<T, StepDataInterface>( name, meta, StepDataInterface.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn( stepMockHelper.logChannelInterface );
  when( stepMockHelper.logChannelInterfaceFactory.create( any() ) ).thenReturn( stepMockHelper.logChannelInterface );
  when( stepMockHelper.trans.isRunning() ).thenReturn( true );
  return stepMockHelper;
}
 
Example #28
Source File: PrioritizeStreamsTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setup() {
  stepMockHelper =
      new StepMockHelper<PrioritizeStreamsMeta, StepDataInterface>( "Priority Streams Test",
          PrioritizeStreamsMeta.class, StepDataInterface.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
      stepMockHelper.logChannelInterface );
  when( stepMockHelper.trans.isRunning() ).thenReturn( true );
}
 
Example #29
Source File: MailTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  stepMockHelper =
    new StepMockHelper<MailMeta, MailData>( "Test Mail", MailMeta.class, MailData.class );
  when( stepMockHelper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) )
    .thenReturn( stepMockHelper.logChannelInterface );
  when( stepMockHelper.trans.isRunning() ).thenReturn( true );
}
 
Example #30
Source File: ExcelOutputTemplateTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUp() throws KettleException {
  KettleEnvironment.init();
  helper =
      new StepMockHelper<ExcelOutputMeta, ExcelOutputData>( "ExcelOutputTest", ExcelOutputMeta.class,
          ExcelOutputData.class );
  when( helper.logChannelInterfaceFactory.create( any(), any( LoggingObjectInterface.class ) ) ).thenReturn(
      helper.logChannelInterface );
  when( helper.trans.isRunning() ).thenReturn( true );
}