Search in sources :

Example 1 with RepositoryImporterExtension

use of org.pentaho.di.trans.steps.metainject.RepositoryImporterExtension in project pentaho-kettle by pentaho.

the class RepositoryImporterTest method testPatchTransSteps_with_meta_inject_step.

@Test
public void testPatchTransSteps_with_meta_inject_step() throws Exception {
    Repository repository = mock(Repository.class);
    LogChannelInterface log = mock(LogChannelInterface.class);
    RepositoryImporter importer = spy(new RepositoryImporter(repository, log));
    importer.setBaseDirectory(mock(RepositoryDirectoryInterface.class));
    doReturn("TEST_PATH").when(importer).resolvePath(anyString(), anyString());
    MetaInjectMeta metaInjectMeta = mock(MetaInjectMeta.class);
    doReturn(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME).when(metaInjectMeta).getSpecificationMethod();
    StepMeta stepMeta = mock(StepMeta.class);
    doReturn(metaInjectMeta).when(stepMeta).getStepMetaInterface();
    doReturn(true).when(stepMeta).isEtlMetaInject();
    TransMeta transMeta = mock(TransMeta.class);
    doReturn(Collections.singletonList(stepMeta)).when(transMeta).getSteps();
    Object[] object = new Object[4];
    object[0] = "TEST_PATH";
    object[1] = mock(RepositoryDirectoryInterface.class);
    object[2] = stepMeta;
    object[3] = true;
    RepositoryImporterExtension repositoryImporterExtension = new RepositoryImporterExtension();
    repositoryImporterExtension.callExtensionPoint(log, object);
    verify(metaInjectMeta).setDirectoryPath("TEST_PATH");
}
Also used : MetaInjectMeta(org.pentaho.di.trans.steps.metainject.MetaInjectMeta) TransMeta(org.pentaho.di.trans.TransMeta) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) StepMeta(org.pentaho.di.trans.step.StepMeta) RepositoryImporterExtension(org.pentaho.di.trans.steps.metainject.RepositoryImporterExtension) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)1 TransMeta (org.pentaho.di.trans.TransMeta)1 StepMeta (org.pentaho.di.trans.step.StepMeta)1 MetaInjectMeta (org.pentaho.di.trans.steps.metainject.MetaInjectMeta)1 RepositoryImporterExtension (org.pentaho.di.trans.steps.metainject.RepositoryImporterExtension)1