Search in sources :

Example 6 with JobEntryJob

use of org.pentaho.di.job.entries.job.JobEntryJob in project pentaho-kettle by pentaho.

the class JobFileListenerTest method testProcessLinkedJobsWithFilename.

@Test
public void testProcessLinkedJobsWithFilename() {
    JobEntryJob jobJobExecutor = spy(new JobEntryJob());
    jobJobExecutor.setFileName("/path/to/Job1.kjb");
    jobJobExecutor.setSpecificationMethod(ObjectLocationSpecificationMethod.FILENAME);
    JobEntryCopy jobEntry = mock(JobEntryCopy.class);
    when(jobEntry.getEntry()).thenReturn(jobJobExecutor);
    JobMeta parent = mock(JobMeta.class);
    when(parent.nrJobEntries()).thenReturn(1);
    when(parent.getJobEntry(0)).thenReturn(jobEntry);
    JobMeta result = jobFileListener.processLinkedJobs(parent);
    JobEntryCopy meta = result.getJobEntry(0);
    assertNotNull(meta);
    JobEntryJob resultExecMeta = (JobEntryJob) meta.getEntry();
    assertEquals(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, resultExecMeta.getSpecificationMethod());
    assertEquals(resultExecMeta.getDirectory(), "/path/to");
    assertEquals(resultExecMeta.getJobName(), "Job1");
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobMeta(org.pentaho.di.job.JobMeta) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob) Test(org.junit.Test)

Example 7 with JobEntryJob

use of org.pentaho.di.job.entries.job.JobEntryJob in project pentaho-kettle by pentaho.

the class RunConfigurationInjectExtensionPoint method callExtensionPoint.

@Override
public void callExtensionPoint(LogChannelInterface log, Object object) throws KettleException {
    if (!(object instanceof JobExecutionExtension)) {
        return;
    }
    JobExecutionExtension extension = (JobExecutionExtension) object;
    Job job = extension.job;
    JobMeta jobMeta = job.getJobMeta();
    final EmbeddedMetaStore embeddedMetaStore = jobMeta.getEmbeddedMetaStore();
    RunConfigurationManager embeddedRunConfigurationManager = EmbeddedRunConfigurationManager.build(embeddedMetaStore);
    // will load and save to meta all run configurations
    for (JobEntryTrans trans : job.getActiveJobEntryTransformations().values()) {
        RunConfiguration loadedRunConfiguration = runConfigurationManager.load(jobMeta.environmentSubstitute(trans.getRunConfiguration()));
        embeddedRunConfigurationManager.save(loadedRunConfiguration);
    }
    for (JobEntryJob subJob : job.getActiveJobEntryJobs().values()) {
        RunConfiguration loadedRunConfiguration = runConfigurationManager.load(jobMeta.environmentSubstitute(subJob.getRunConfiguration()));
        embeddedRunConfigurationManager.save(loadedRunConfiguration);
    }
}
Also used : JobExecutionExtension(org.pentaho.di.job.JobExecutionExtension) JobMeta(org.pentaho.di.job.JobMeta) RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) RunConfigurationManager(org.pentaho.di.engine.configuration.impl.RunConfigurationManager) EmbeddedRunConfigurationManager(org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager) JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob) Job(org.pentaho.di.job.Job) EmbeddedMetaStore(org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob)

Aggregations

JobEntryJob (org.pentaho.di.job.entries.job.JobEntryJob)7 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)5 JobMeta (org.pentaho.di.job.JobMeta)4 JobEntryTrans (org.pentaho.di.job.entries.trans.JobEntryTrans)3 FileObject (org.apache.commons.vfs2.FileObject)2 Test (org.junit.Test)2 KettleException (org.pentaho.di.core.exception.KettleException)2 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)2 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 FileSystemException (org.apache.commons.vfs2.FileSystemException)1 TableItem (org.eclipse.swt.widgets.TableItem)1 ObjectLocationSpecificationMethod (org.pentaho.di.core.ObjectLocationSpecificationMethod)1 EmbeddedMetaStore (org.pentaho.di.core.attributes.metastore.EmbeddedMetaStore)1 JobTracker (org.pentaho.di.core.gui.JobTracker)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 RunConfiguration (org.pentaho.di.engine.configuration.api.RunConfiguration)1 EmbeddedRunConfigurationManager (org.pentaho.di.engine.configuration.impl.EmbeddedRunConfigurationManager)1