Search in sources :

Example 1 with JobEntryNode

use of org.pentaho.metaverse.frames.JobEntryNode in project pentaho-metaverse by pentaho.

the class MetaverseValidationIT method testJobEntryNodes.

@Test
public void testJobEntryNodes() throws Exception {
    for (JobNode jobNode : root.getJobs()) {
        JobMeta jobMeta = new JobMeta(new FileInputStream(jobNode.getPath()), null, null);
        int numJobEntries = jobMeta.nrJobEntries();
        int matchCount = 0;
        for (int i = 0; i < numJobEntries; i++) {
            JobEntryCopy jobEntry = jobMeta.getJobEntry(i);
            assertNotNull(jobEntry);
            JobEntryNode jobEntryNode = jobNode.getJobEntryNode(jobEntry.getName());
            assertNotNull("Job Entry " + jobEntry.getName() + " should be in the graph!", jobEntryNode);
            assertEquals(jobEntry.getName(), jobEntryNode.getName());
            assertEquals(jobEntry.getDescription(), jobEntryNode.getDescription());
            assertEquals("Incorrect type", DictionaryConst.NODE_TYPE_JOB_ENTRY, jobEntryNode.getType());
            assertEquals("Incorrect entity type", DictionaryConst.NODE_TYPE_JOB_ENTRY, jobEntryNode.getEntity().getName());
            matchCount++;
        }
        assertEquals("Not all job entries are accounted for in the graph for Job [" + jobMeta.getName() + "]", numJobEntries, matchCount);
        assertEquals("Incorrect number of job entries for in the graph for Job [" + jobMeta.getName() + "]", numJobEntries, getIterableSize(jobNode.getJobEntryNodes()));
        // it should be contained in a "Locator" node
        jobNode.getLocator();
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryNode(org.pentaho.metaverse.frames.JobEntryNode) JobNode(org.pentaho.metaverse.frames.JobNode) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Aggregations

FileInputStream (java.io.FileInputStream)1 Test (org.junit.Test)1 JobMeta (org.pentaho.di.job.JobMeta)1 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)1 JobEntryNode (org.pentaho.metaverse.frames.JobEntryNode)1 JobNode (org.pentaho.metaverse.frames.JobNode)1