use of org.pentaho.di.trans.step.StepMetaInterface in project pentaho-kettle by pentaho.
the class RepositoryImporterTest method testImportTrans_patchTransEntries_when_directory_path_starts_with_variable.
@Test
public void testImportTrans_patchTransEntries_when_directory_path_starts_with_variable() throws KettleException {
JobEntryInterface jobEntryInterface = createJobEntry("");
StepMetaInterface stepMeta = createStepMeta("${USER_VARIABLE}/myDir");
RepositoryImporter importer = createRepositoryImporter(jobEntryInterface, stepMeta, true);
importer.setBaseDirectory(baseDirectory);
importer.importTransformation(entityNode, feedback);
verify((HasRepositoryDirectories) stepMeta).setDirectories(new String[] { "${USER_VARIABLE}/myDir" });
StepMetaInterface stepMeta2 = createStepMeta("${USER_VARIABLE}/myDir");
RepositoryImporter importerWithCompatibilityImportPath = createRepositoryImporter(jobEntryInterface, stepMeta2, false);
importerWithCompatibilityImportPath.setBaseDirectory(baseDirectory);
importerWithCompatibilityImportPath.importTransformation(entityNode, feedback);
verify((HasRepositoryDirectories) stepMeta2).setDirectories(new String[] { ROOT_PATH + "/${USER_VARIABLE}/myDir" });
}
use of org.pentaho.di.trans.step.StepMetaInterface in project pentaho-kettle by pentaho.
the class RepositoryImporterTest method testImportJob_patchJobEntries_with_variable.
@Test
public void testImportJob_patchJobEntries_with_variable() throws KettleException {
JobEntryInterface jobEntryInterface = createJobEntry("${USER_VARIABLE}");
StepMetaInterface stepMeta = createStepMeta("");
RepositoryImporter importer = createRepositoryImporter(jobEntryInterface, stepMeta, true);
importer.setBaseDirectory(baseDirectory);
importer.importJob(entityNode, feedback);
verify((HasRepositoryDirectories) jobEntryInterface).setDirectories(new String[] { "${USER_VARIABLE}" });
}
use of org.pentaho.di.trans.step.StepMetaInterface in project pentaho-kettle by pentaho.
the class RepositoryImporterTest method testImportJob_patchJobEntries_without_variables.
@Test
public void testImportJob_patchJobEntries_without_variables() throws KettleException {
JobEntryInterface jobEntry = createJobEntry("/userName");
StepMetaInterface stepMeta = createStepMeta("");
RepositoryImporter importer = createRepositoryImporter(jobEntry, stepMeta, true);
importer.setBaseDirectory(baseDirectory);
importer.importJob(entityNode, feedback);
verify((HasRepositoryDirectories) jobEntry).setDirectories(new String[] { ROOT_PATH + USER_NAME_PATH });
}
use of org.pentaho.di.trans.step.StepMetaInterface in project pentaho-kettle by pentaho.
the class RepositoryImporterTest method testImportTrans_patchTransEntries_when_directory_path_ends_with_variable.
@Test
public void testImportTrans_patchTransEntries_when_directory_path_ends_with_variable() throws KettleException {
JobEntryInterface jobEntryInterface = createJobEntry("");
StepMetaInterface stepMeta = createStepMeta("/myDir/${USER_VARIABLE}");
RepositoryImporter importer = createRepositoryImporter(jobEntryInterface, stepMeta, true);
importer.setBaseDirectory(baseDirectory);
importer.importTransformation(entityNode, feedback);
verify((HasRepositoryDirectories) stepMeta).setDirectories(new String[] { "/myDir/${USER_VARIABLE}" });
StepMetaInterface stepMeta2 = createStepMeta("/myDir/${USER_VARIABLE}");
RepositoryImporter importerWithCompatibilityImportPath = createRepositoryImporter(jobEntryInterface, stepMeta2, false);
importerWithCompatibilityImportPath.setBaseDirectory(baseDirectory);
importerWithCompatibilityImportPath.importTransformation(entityNode, feedback);
verify((HasRepositoryDirectories) stepMeta2).setDirectories(new String[] { ROOT_PATH + "/myDir/${USER_VARIABLE}" });
}
use of org.pentaho.di.trans.step.StepMetaInterface in project pentaho-kettle by pentaho.
the class TransMetaConverterTest method testDisabledHops.
@Test
public void testDisabledHops() {
TransMeta trans = new TransMeta();
StepMeta start = new StepMeta("Start", stepMetaInterface);
trans.addStep(start);
StepMeta withEnabledHop = new StepMeta("WithEnabledHop", stepMetaInterface);
trans.addStep(withEnabledHop);
StepMeta withDisabledHop = new StepMeta("WithDisabledHop", stepMetaInterface);
trans.addStep(withDisabledHop);
StepMeta shouldStay = new StepMeta("ShouldStay", stepMetaInterface);
trans.addStep(shouldStay);
StepMeta shouldNotStay = new StepMeta("ShouldNotStay", stepMetaInterface);
trans.addStep(shouldNotStay);
StepMeta withEnabledAndDisabledHops = new StepMeta("WithEnabledAndDisabledHops", stepMetaInterface);
trans.addStep(withEnabledAndDisabledHops);
StepMeta afterEnabledDisabled = new StepMeta("AfterEnabledDisabled", stepMetaInterface);
trans.addStep(afterEnabledDisabled);
trans.addTransHop(new TransHopMeta(start, withEnabledHop));
trans.addTransHop(new TransHopMeta(start, withDisabledHop, false));
trans.addTransHop(new TransHopMeta(withEnabledHop, shouldStay));
trans.addTransHop(new TransHopMeta(withDisabledHop, shouldStay));
trans.addTransHop(new TransHopMeta(withDisabledHop, shouldNotStay));
trans.addTransHop(new TransHopMeta(start, withEnabledAndDisabledHops));
trans.addTransHop(new TransHopMeta(withEnabledHop, withEnabledAndDisabledHops, false));
trans.addTransHop(new TransHopMeta(withEnabledAndDisabledHops, afterEnabledDisabled));
Transformation transformation = TransMetaConverter.convert(trans);
List<String> steps = transformation.getOperations().stream().map(op -> op.getId()).collect(Collectors.toList());
assertThat("Only 5 ops should exist", steps.size(), is(5));
assertThat(steps, hasItems("Start", "WithEnabledHop", "ShouldStay", "WithEnabledAndDisabledHops", "AfterEnabledDisabled"));
List<String> hops = transformation.getHops().stream().map(hop -> hop.getId()).collect(Collectors.toList());
assertThat("Only 4 hops should exist", hops.size(), is(4));
assertThat(hops, hasItems("Start -> WithEnabledHop", "WithEnabledHop -> ShouldStay", "Start -> WithEnabledAndDisabledHops", "WithEnabledAndDisabledHops -> AfterEnabledDisabled"));
}
Aggregations