Java Code Examples for org.pentaho.di.job.JobMeta#setInternalKettleVariables()

The following examples show how to use org.pentaho.di.job.JobMeta#setInternalKettleVariables() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KettleFileRepositoryTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@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 );
}