use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobTrackerTest method findJobTracker_EntryNameFound.
@Test
public void findJobTracker_EntryNameFound() {
JobTracker jobTracker = createTracker();
JobTracker[] children = new JobTracker[] { createTracker("0", 1), createTracker("1", 1), createTracker("2", 1) };
for (JobTracker child : children) {
jobTracker.addJobTracker(child);
}
JobEntryCopy copy = createEntryCopy("1");
assertEquals(children[1], jobTracker.findJobTracker(copy));
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobTrackerTest method createEntryCopy.
private static JobEntryCopy createEntryCopy(String entryName) {
JobEntryInterface entry = mock(JobEntryInterface.class);
when(entry.getName()).thenReturn(entryName);
JobEntryCopy copy = new JobEntryCopy(entry);
copy.setNr(1);
return copy;
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobMetaTest method testHasLoop_loopInPrevSteps.
@Test
public void testHasLoop_loopInPrevSteps() throws Exception {
// main->2->3->4->3
JobMeta jobMetaSpy = spy(jobMeta);
JobEntryCopy jobEntryCopyMain = createJobEntryCopy("mainStep");
JobEntryCopy jobEntryCopy2 = createJobEntryCopy("step2");
JobEntryCopy jobEntryCopy3 = createJobEntryCopy("step3");
JobEntryCopy jobEntryCopy4 = createJobEntryCopy("step4");
when(jobMetaSpy.findNrPrevJobEntries(jobEntryCopyMain)).thenReturn(1);
when(jobMetaSpy.findPrevJobEntry(jobEntryCopyMain, 0)).thenReturn(jobEntryCopy2);
when(jobMetaSpy.findNrPrevJobEntries(jobEntryCopy2)).thenReturn(1);
when(jobMetaSpy.findPrevJobEntry(jobEntryCopy2, 0)).thenReturn(jobEntryCopy3);
when(jobMetaSpy.findNrPrevJobEntries(jobEntryCopy3)).thenReturn(1);
when(jobMetaSpy.findPrevJobEntry(jobEntryCopy3, 0)).thenReturn(jobEntryCopy4);
when(jobMetaSpy.findNrPrevJobEntries(jobEntryCopy4)).thenReturn(1);
when(jobMetaSpy.findPrevJobEntry(jobEntryCopy4, 0)).thenReturn(jobEntryCopy3);
// check no StackOverflow error
assertFalse(jobMetaSpy.hasLoop(jobEntryCopyMain));
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobMetaTest method createJobEntryCopy.
private JobEntryCopy createJobEntryCopy(String name) {
JobEntryInterface jobEntry = mock(JobEntryInterface.class);
JobEntryCopy jobEntryCopy = new JobEntryCopy(jobEntry);
when(jobEntryCopy.getName()).thenReturn(name);
jobEntryCopy.setNr(0);
return jobEntryCopy;
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobMetaTest method testPath.
private boolean testPath(String branch) {
JobEntryEmpty je1 = new JobEntryEmpty();
je1.setName("je1");
JobEntryEmpty je2 = new JobEntryEmpty();
je2.setName("je2");
JobHopMeta hop = new JobHopMeta(new JobEntryCopy(je1), new JobEntryCopy(je2));
jobMeta.addJobHop(hop);
JobEntryEmpty je3 = new JobEntryEmpty();
je3.setName("je3");
hop = new JobHopMeta(new JobEntryCopy(je1), new JobEntryCopy(je3));
jobMeta.addJobHop(hop);
JobEntryEmpty je4 = new JobEntryEmpty();
je4.setName("je4");
hop = new JobHopMeta(new JobEntryCopy(je3), new JobEntryCopy(je4));
jobMeta.addJobHop(hop);
if (branch.equals("je1-je4")) {
return jobMeta.isPathExist(je1, je4);
} else if (branch.equals("je2-je4")) {
return jobMeta.isPathExist(je2, je4);
} else {
return false;
}
}
Aggregations