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");
}
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);
}
}
Aggregations