Search in sources :

Example 1 with JobNode

use of org.pentaho.metaverse.frames.JobNode 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)

Example 2 with JobNode

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

the class MetaverseValidationIT method testJobs.

@Test
public void testJobs() throws Exception {
    for (JobNode node : root.getJobs()) {
        assertEquals("Incorrect entity type", DictionaryConst.NODE_TYPE_JOB, node.getEntity().getName());
        // get the TransMeta for this node
        FileInputStream fis = new FileInputStream(node.getPath());
        JobMeta jm = new JobMeta(fis, null, null);
        assertNotNull(jm);
        assertEquals(jm.getName(), node.getName());
        assertEquals(jm.getJobversion(), node.getVersion());
        assertEquals(convertNumericStatusToString(jm.getJobstatus()), node.getStatus());
        assertEquals(jm.getDescription(), node.getDescription());
        assertEquals(jm.getExtendedDescription(), node.getExtendedDescription());
        assertEquals(String.valueOf(jm.getModifiedDate().getTime()), node.getLastModified());
        assertEquals(jm.getModifiedUser(), node.getLastModifiedBy());
        assertEquals(String.valueOf(jm.getCreatedDate().getTime()), node.getCreated());
        assertEquals(jm.getCreatedUser(), node.getCreatedBy());
        // params?
        String[] params = jm.listParameters();
        for (String param : params) {
            assertNotNull("Parameter is missing [" + param + "]", node.getParameter("parameter_" + param));
        }
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobNode(org.pentaho.metaverse.frames.JobNode) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Aggregations

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