Search in sources :

Example 1 with BaseFileMeta

use of org.pentaho.di.trans.steps.file.BaseFileMeta in project pentaho-metaverse by pentaho.

the class BaseStepExternalResourceConsumerTest method testGetResourcesFromMeta.

@Test
public void testGetResourcesFromMeta() throws Exception {
    Collection<IExternalResourceConsumer> resources = null;
    BaseStepMeta meta = null;
    // null meta
    resources = consumer.getResourcesFromMeta(meta);
    assertNotNull(resources);
    assertTrue(resources.isEmpty());
    // non-file meta
    meta = Mockito.mock(BaseStepMeta.class);
    resources = consumer.getResourcesFromMeta(meta);
    assertNotNull(resources);
    assertTrue(resources.isEmpty());
    Mockito.verify(meta, Mockito.times(0)).getParentStepMeta();
    // file meta
    meta = Mockito.mock(BaseFileMeta.class);
    TransMeta transMeta = Mockito.mock(TransMeta.class);
    StepMeta stepMeta = Mockito.mock(StepMeta.class);
    Mockito.when(((BaseFileMeta) meta).writesToFile()).thenReturn(true);
    Mockito.when(meta.getParentStepMeta()).thenReturn(stepMeta);
    Mockito.when(stepMeta.getParentTransMeta()).thenReturn(transMeta);
    consumer.getResourcesFromMeta(meta);
    Mockito.verify(meta, Mockito.times(2)).getParentStepMeta();
    Mockito.verify((BaseFileMeta) meta, Mockito.times(1)).getFilePaths(false);
}
Also used : BaseFileMeta(org.pentaho.di.trans.steps.file.BaseFileMeta) TransMeta(org.pentaho.di.trans.TransMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) IExternalResourceConsumer(org.pentaho.metaverse.api.analyzer.kettle.IExternalResourceConsumer) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 TransMeta (org.pentaho.di.trans.TransMeta)1 BaseStepMeta (org.pentaho.di.trans.step.BaseStepMeta)1 StepMeta (org.pentaho.di.trans.step.StepMeta)1 BaseFileMeta (org.pentaho.di.trans.steps.file.BaseFileMeta)1 IExternalResourceConsumer (org.pentaho.metaverse.api.analyzer.kettle.IExternalResourceConsumer)1