@SuppressWarnings( "unchecked" ) @Test public void testProcessRow() throws Exception { fuzzyMatch = new FuzzyMatchHandler( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); fuzzyMatch.init( mockHelper.initStepMetaInterface, mockHelper.initStepDataInterface ); fuzzyMatch.getInputRowSets().add( mockHelper.getMockInputRowSet( rows ) ); fuzzyMatch.getInputRowSets().add( mockHelper.getMockInputRowSet( lookupRows ) ); when( mockHelper.processRowsStepMetaInterface.getAlgorithmType() ).thenReturn( 8 ); mockHelper.processRowsStepDataInterface.look = mock( HashSet.class ); when( mockHelper.processRowsStepDataInterface.look.iterator() ).thenReturn( lookupRows.iterator() ); fuzzyMatch.processRow( mockHelper.processRowsStepMetaInterface, mockHelper.processRowsStepDataInterface ); Assert.assertEquals( fuzzyMatch.resultRow[0], row3[0] ); }
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.UnableToReadDataFromLookupStream" ) ); setErrors( 1 ); stopAll(); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadValuesInMemory", data.look.size() ) ); } } Object[] r = getRow(); if ( r == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.StoppedProcessingWithEmpty", getLinesRead() ) ); } setOutputDone(); return false; } try { Object[] outputRow = lookupValues( getInputRowMeta(), r ); if ( outputRow == null ) { setOutputDone(); return false; } putRow( data.outputRowMeta, outputRow ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FuzzyMatch.Log.LineNumber" ) + getLinesRead() ); } } } catch ( KettleException e ) { boolean sendToErrorRow = false; String errorMessage = null; if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.ErrorInStepRunning" ) + e.getMessage() ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, meta.getMainStreamField(), "FuzzyMatch001" ); } } return true; }
FuzzyMatch extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.UnableToReadDataFromLookupStream" ) ); setErrors( 1 ); stopAll(); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadValuesInMemory", data.look.size() ) ); } } Object[] r = getRow(); if ( r == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.StoppedProcessingWithEmpty", getLinesRead() ) ); } setOutputDone(); return false; } try { Object[] outputRow = lookupValues( getInputRowMeta(), r ); if ( outputRow == null ) { setOutputDone(); return false; } putRow( data.outputRowMeta, outputRow ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FuzzyMatch.Log.LineNumber" ) + getLinesRead() ); } } } catch ( KettleException e ) { boolean sendToErrorRow = false; String errorMessage = null; if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.ErrorInStepRunning" ) + e.getMessage() ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, meta.getMainStreamField(), "FuzzyMatch001" ); } } return true; } }
FuzzyMatch extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.UnableToReadDataFromLookupStream" ) ); setErrors( 1 ); stopAll(); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadValuesInMemory", data.look.size() ) ); } } Object[] r = getRow(); if ( r == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.StoppedProcessingWithEmpty", getLinesRead() ) ); } setOutputDone(); return false; } try { Object[] outputRow = lookupValues( getInputRowMeta(), r ); if ( outputRow == null ) { setOutputDone(); return false; } putRow( data.outputRowMeta, outputRow ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FuzzyMatch.Log.LineNumber" ) + getLinesRead() ); } } } catch ( KettleException e ) { boolean sendToErrorRow = false; String errorMessage = null; if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.ErrorInStepRunning" ) + e.getMessage() ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, meta.getMainStreamField(), "FuzzyMatch001" ); } } return true; } FuzzyMatch( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
    Trans trans ); }
FuzzyMatch extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.UnableToReadDataFromLookupStream" ) ); setErrors( 1 ); stopAll(); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadValuesInMemory", data.look.size() ) ); } } Object[] r = getRow(); if ( r == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.StoppedProcessingWithEmpty", getLinesRead() ) ); } setOutputDone(); return false; } try { Object[] outputRow = lookupValues( getInputRowMeta(), r ); if ( outputRow == null ) { setOutputDone(); return false; } putRow( data.outputRowMeta, outputRow ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FuzzyMatch.Log.LineNumber" ) + getLinesRead() ); } } } catch ( KettleException e ) { boolean sendToErrorRow = false; String errorMessage = null; if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.ErrorInStepRunning" ) + e.getMessage() ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, meta.getMainStreamField(), "FuzzyMatch001" ); } } return true; } FuzzyMatch( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
    Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
FuzzyMatch extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.UnableToReadDataFromLookupStream" ) ); setErrors( 1 ); stopAll(); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadValuesInMemory", data.look.size() ) ); } } Object[] r = getRow(); if ( r == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.StoppedProcessingWithEmpty", getLinesRead() ) ); } setOutputDone(); return false; } try { Object[] outputRow = lookupValues( getInputRowMeta(), r ); if ( outputRow == null ) { setOutputDone(); return false; } putRow( data.outputRowMeta, outputRow ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FuzzyMatch.Log.LineNumber" ) + getLinesRead() ); } } } catch ( KettleException e ) { boolean sendToErrorRow = false; String errorMessage = null; if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.ErrorInStepRunning" ) + e.getMessage() ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, meta.getMainStreamField(), "FuzzyMatch001" ); } } return true; } FuzzyMatch( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
    Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi );  }