use of org.pentaho.di.job.JobMeta 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.JobMeta in project pentaho-kettle by pentaho.
the class KettleFileRepositoryTest method testCurrentDirJob.
@Test
public void testCurrentDirJob() throws Exception {
final String dirName = "dirName";
final String jobName = "job";
JobMeta setupJobMeta = new JobMeta();
setupJobMeta.setName(jobName);
RepositoryDirectoryInterface repoDir = repository.createRepositoryDirectory(new RepositoryDirectory(), dirName);
setupJobMeta.setRepositoryDirectory(repoDir);
repository.save(setupJobMeta, "");
JobMeta jobMeta = repository.loadJob(jobName, repoDir, null, "");
assertEquals(repository, jobMeta.getRepository());
assertEquals(repoDir.getPath(), jobMeta.getRepositoryDirectory().getPath());
jobMeta.setInternalKettleVariables();
String currentDir = jobMeta.getVariable(Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY);
assertEquals(repoDir.getPath(), currentDir);
}
use of org.pentaho.di.job.JobMeta 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.JobMeta 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.JobMeta 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