Search in sources :

Example 1 with StreamLookupMeta

use of org.pentaho.di.trans.steps.streamlookup.StreamLookupMeta in project pentaho-kettle by pentaho.

the class TransMetaTest method testGetPreviousStepsWhenStreamLookupStepPassedShouldClearCacheAndCallFindPreviousStepsWithFalseParam.

@Test
public void testGetPreviousStepsWhenStreamLookupStepPassedShouldClearCacheAndCallFindPreviousStepsWithFalseParam() {
    TransMeta transMeta = mock(TransMeta.class);
    StepMeta stepMeta = new StepMeta("stream_lookup_id", "stream_lookup_name", new StreamLookupMeta());
    List<StepMeta> expectedResult = new ArrayList<>();
    List<StepMeta> invalidResult = new ArrayList<>();
    expectedResult.add(new StepMeta("correct_mock", "correct_mock", new TextFileOutputMeta()));
    invalidResult.add(new StepMeta("incorrect_mock", "incorrect_mock", new TextFileOutputMeta()));
    doNothing().when(transMeta).clearPreviousStepCache();
    when(transMeta.findPreviousSteps(any(StepMeta.class), eq(false))).thenReturn(expectedResult);
    when(transMeta.findPreviousSteps(any(StepMeta.class), eq(true))).thenReturn(invalidResult);
    when(transMeta.getPreviousSteps(any())).thenCallRealMethod();
    List<StepMeta> actualResult = transMeta.getPreviousSteps(stepMeta);
    verify(transMeta, times(1)).clearPreviousStepCache();
    assertEquals(expectedResult, actualResult);
}
Also used : TextFileOutputMeta(org.pentaho.di.trans.steps.textfileoutput.TextFileOutputMeta) StreamLookupMeta(org.pentaho.di.trans.steps.streamlookup.StreamLookupMeta) ArrayList(java.util.ArrayList) StepMeta(org.pentaho.di.trans.step.StepMeta) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 StepMeta (org.pentaho.di.trans.step.StepMeta)1 StreamLookupMeta (org.pentaho.di.trans.steps.streamlookup.StreamLookupMeta)1 TextFileOutputMeta (org.pentaho.di.trans.steps.textfileoutput.TextFileOutputMeta)1