@Test( timeout = 5000 ) public void testProcessRow() throws KettleException { Object[] row1 = new Object[] { 0, 1 }; Object[] row2 = new Object[] { 1, 0 }; when( stepMockHelper.processRowsStepDataInterface.getInValueOrdinal() ).thenReturn( 1 ); RowSet mockInputRowSet = stepMockHelper.getMockInputRowSet( row1, row2 ); hadoopExit.addRowSetToInputRowSets( mockInputRowSet ); RowSet outputRowSet = mock( RowSet.class ); hadoopExit.addRowSetToOutputRowSets( outputRowSet ); RowMetaInterface rowMetaInterface = mock( RowMetaInterface.class ); when( rowMetaInterface.clone() ).thenReturn( rowMetaInterface ); when( stepMockHelper.processRowsStepDataInterface.getOutputRowMeta() ).thenReturn( rowMetaInterface ); when( outputRowSet.putRow( eq( rowMetaInterface ), aryEq( row1 ) ) ).thenReturn( true ); when( outputRowSet.putRow( eq( rowMetaInterface ), aryEq( row2 ) ) ).thenReturn( true ); assertTrue( hadoopExit .processRow( stepMockHelper.processRowsStepMetaInterface, stepMockHelper.processRowsStepDataInterface ) ); assertTrue( hadoopExit .processRow( stepMockHelper.processRowsStepMetaInterface, stepMockHelper.processRowsStepDataInterface ) ); assertFalse( hadoopExit .processRow( stepMockHelper.processRowsStepMetaInterface, stepMockHelper.processRowsStepDataInterface ) ); verify( stepMockHelper.processRowsStepDataInterface ) .init( any( RowMetaInterface.class ), eq( stepMockHelper.processRowsStepMetaInterface ), eq( hadoopExit ) ); verify( outputRowSet ).putRow( eq( rowMetaInterface ), aryEq( row1 ) ); verify( outputRowSet ).putRow( eq( rowMetaInterface ), aryEq( row2 ) ); }
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (HadoopExitMeta) smi; data = (HadoopExitData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { runtimeInit(); first = false; } Object[] outputRow = new Object[2]; outputRow[HadoopExitData.getOutKeyOrdinal()] = r[data.getInKeyOrdinal()]; outputRow[HadoopExitData.getOutValueOrdinal()] = r[data.getInValueOrdinal()]; putRow( data.getOutputRowMeta(), outputRow ); if ( checkFeedback( getLinesRead() ) ) { logBasic( BaseMessages.getString( PKG, "HadoopExit.Linenr", getLinesRead() ) ); } return true; }
HadoopExit extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (HadoopExitMeta) smi; data = (HadoopExitData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { runtimeInit(); first = false; } Object[] outputRow = new Object[2]; outputRow[HadoopExitData.getOutKeyOrdinal()] = r[data.getInKeyOrdinal()]; outputRow[HadoopExitData.getOutValueOrdinal()] = r[data.getInValueOrdinal()]; putRow( data.getOutputRowMeta(), outputRow ); if ( checkFeedback( getLinesRead() ) ) { logBasic( BaseMessages.getString( PKG, "HadoopExit.Linenr", getLinesRead() ) ); } return true; } }
HadoopExit extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (HadoopExitMeta) smi; data = (HadoopExitData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { runtimeInit(); first = false; } Object[] outputRow = new Object[2]; outputRow[HadoopExitData.getOutKeyOrdinal()] = r[data.getInKeyOrdinal()]; outputRow[HadoopExitData.getOutValueOrdinal()] = r[data.getInValueOrdinal()]; putRow( data.getOutputRowMeta(), outputRow ); if ( checkFeedback( getLinesRead() ) ) { logBasic( BaseMessages.getString( PKG, "HadoopExit.Linenr", getLinesRead() ) ); } return true; } HadoopExit( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); }
HadoopExit extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (HadoopExitMeta) smi; data = (HadoopExitData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { runtimeInit(); first = false; } Object[] outputRow = new Object[2]; outputRow[HadoopExitData.getOutKeyOrdinal()] = r[data.getInKeyOrdinal()]; outputRow[HadoopExitData.getOutValueOrdinal()] = r[data.getInValueOrdinal()]; putRow( data.getOutputRowMeta(), outputRow ); if ( checkFeedback( getLinesRead() ) ) { logBasic( BaseMessages.getString( PKG, "HadoopExit.Linenr", getLinesRead() ) ); } return true; } HadoopExit( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); void runtimeInit(); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); }
HadoopExit extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (HadoopExitMeta) smi; data = (HadoopExitData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { runtimeInit(); first = false; } Object[] outputRow = new Object[2]; outputRow[HadoopExitData.getOutKeyOrdinal()] = r[data.getInKeyOrdinal()]; outputRow[HadoopExitData.getOutValueOrdinal()] = r[data.getInValueOrdinal()]; putRow( data.getOutputRowMeta(), outputRow ); if ( checkFeedback( getLinesRead() ) ) { logBasic( BaseMessages.getString( PKG, "HadoopExit.Linenr", getLinesRead() ) ); } return true; } HadoopExit( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); void runtimeInit(); boolean processRow( StepMetaInterface smi, StepDataInterface sdi );  }