Search in sources :

Example 56 with JobEntryCopy

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));
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) Test(org.junit.Test)

Example 57 with JobEntryCopy

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;
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryInterface(org.pentaho.di.job.entry.JobEntryInterface)

Example 58 with JobEntryCopy

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));
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) Test(org.junit.Test)

Example 59 with JobEntryCopy

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;
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryInterface(org.pentaho.di.job.entry.JobEntryInterface)

Example 60 with 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;
    }
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryEmpty(org.pentaho.di.job.entries.empty.JobEntryEmpty)

Aggregations

JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)149 Point (org.pentaho.di.core.gui.Point)54 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)51 JobMeta (org.pentaho.di.job.JobMeta)47 KettleException (org.pentaho.di.core.exception.KettleException)30 Test (org.junit.Test)28 JobEntryInterface (org.pentaho.di.job.entry.JobEntryInterface)28 NotePadMeta (org.pentaho.di.core.NotePadMeta)24 JobHopMeta (org.pentaho.di.job.JobHopMeta)24 ArrayList (java.util.ArrayList)18 Job (org.pentaho.di.job.Job)18 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)16 JobEntryTrans (org.pentaho.di.job.entries.trans.JobEntryTrans)15 MessageBox (org.eclipse.swt.widgets.MessageBox)13 PluginInterface (org.pentaho.di.core.plugins.PluginInterface)10 Result (org.pentaho.di.core.Result)8 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)8 AreaOwner (org.pentaho.di.core.gui.AreaOwner)8 JobEntrySpecial (org.pentaho.di.job.entries.special.JobEntrySpecial)8 Before (org.junit.Before)7