use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobFileListener method processLinkedTrans.
protected JobMeta processLinkedTrans(JobMeta jobMeta) {
for (int i = 0; i < jobMeta.nrJobEntries(); i++) {
JobEntryCopy jec = jobMeta.getJobEntry(i);
if (jec.getEntry() instanceof JobEntryTrans) {
JobEntryTrans jet = (JobEntryTrans) jec.getEntry();
ObjectLocationSpecificationMethod specMethod = jet.getSpecificationMethod();
// If the reference is by filename, change it to Repository By Name. Otherwise it's fine so leave it alone
if (specMethod == ObjectLocationSpecificationMethod.FILENAME) {
jet.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
String filename = jet.getFilename();
// handle any exceptions that arise from this
if (filename.indexOf("/") > -1) {
String jobname = filename.substring(filename.lastIndexOf("/") + 1, filename.lastIndexOf('.'));
String directory = filename.substring(0, filename.lastIndexOf("/"));
jet.setTransname(jobname);
jet.setDirectory(directory);
} else {
jet.setTransname(filename);
}
jobMeta.setJobEntry(i, jec);
}
}
}
return jobMeta;
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class RepositoryImporterTest method createRepositoryImporter.
private static RepositoryImporter createRepositoryImporter(final JobEntryInterface jobEntryInterface, final StepMetaInterface stepMetaInterface, final boolean needToCheckPathForVariables) {
Repository repository = mock(Repository.class);
LogChannelInterface log = mock(LogChannelInterface.class);
RepositoryImporter importer = new RepositoryImporter(repository, log) {
@Override
JobMeta createJobMetaForNode(Node jobnode) throws KettleXMLException {
JobMeta meta = mock(JobMeta.class);
JobEntryCopy jec = mock(JobEntryCopy.class);
when(jec.isTransformation()).thenReturn(true);
when(jec.getEntry()).thenReturn(jobEntryInterface);
when(meta.getJobCopies()).thenReturn(Collections.singletonList(jec));
return meta;
}
@Override
TransMeta createTransMetaForNode(Node transnode) throws KettleMissingPluginsException, KettleXMLException {
TransMeta meta = mock(TransMeta.class);
StepMeta stepMeta = mock(StepMeta.class);
when(stepMeta.isMapping()).thenReturn(true);
when(stepMeta.getStepMetaInterface()).thenReturn(stepMetaInterface);
when(meta.getSteps()).thenReturn(Collections.singletonList(stepMeta));
return meta;
}
@Override
protected void replaceSharedObjects(JobMeta transMeta) throws KettleException {
}
@Override
protected void replaceSharedObjects(TransMeta transMeta) throws KettleException {
}
@Override
boolean needToCheckPathForVariables() {
return needToCheckPathForVariables;
}
};
return importer;
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobEntryFilesExistTest method setUp.
@Before
public void setUp() throws Exception {
job = new Job(null, new JobMeta());
entry = new JobEntryFilesExist();
job.getJobMeta().addJobEntry(new JobEntryCopy(entry));
entry.setParentJob(job);
JobMeta mockJobMeta = mock(JobMeta.class);
entry.setParentJobMeta(mockJobMeta);
job.setStopped(false);
existingFile1 = TestUtils.createRamFile(getClass().getSimpleName() + "/existingFile1.ext", entry);
existingFile2 = TestUtils.createRamFile(getClass().getSimpleName() + "/existingFile2.ext", entry);
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobEntryFolderIsEmptyTest method setUp.
@Before
public void setUp() throws Exception {
job = new Job(null, new JobMeta());
entry = new JobEntryFolderIsEmpty();
job.getJobMeta().addJobEntry(new JobEntryCopy(entry));
entry.setParentJob(job);
JobMeta mockJobMeta = mock(JobMeta.class);
entry.setParentJobMeta(mockJobMeta);
job.setStopped(false);
File dir = Files.createTempDirectory("dir", new FileAttribute<?>[0]).toFile();
dir.deleteOnExit();
emptyDir = dir.getPath();
dir = Files.createTempDirectory("dir", new FileAttribute<?>[0]).toFile();
dir.deleteOnExit();
nonEmptyDir = dir.getPath();
File file = File.createTempFile("existingFile", "ext", dir);
file.deleteOnExit();
}
use of org.pentaho.di.job.entry.JobEntryCopy in project pentaho-kettle by pentaho.
the class JobEntryFTPTest method setUp.
@Before
public void setUp() throws Exception {
job = new Job(null, new JobMeta());
entry = new MockedJobEntryFTP();
job.getJobMeta().addJobEntry(new JobEntryCopy(entry));
entry.setParentJob(job);
job.setStopped(false);
entry.setServerName("some.server");
entry.setUserName("anonymous");
entry.setFtpDirectory(".");
entry.setWildcard("robots.txt");
entry.setBinaryMode(false);
entry.setSuccessCondition("success_if_no_errors");
existingDir = TestUtils.createTempDir();
}
Aggregations