Java Code Examples for org.pentaho.di.job.JobMeta#setName()
The following examples show how to use
org.pentaho.di.job.JobMeta#setName() .
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: KettleFileRepository.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Override public JobMeta loadJob( String jobname, RepositoryDirectoryInterface repdir, ProgressMonitorListener monitor, String versionName ) throws KettleException { // This is a standard load of a transformation serialized in XML... // String filename = calcDirectoryName( repdir ) + jobname + EXT_JOB; JobMeta jobMeta = new JobMeta( filename, this ); jobMeta.setFilename( null ); jobMeta.setName( jobname ); jobMeta.setObjectId( new StringObjectId( calcObjectId( repdir, jobname, EXT_JOB ) ) ); jobMeta.setRepository( this ); jobMeta.setMetaStore( getMetaStore() ); readDatabases( jobMeta, true ); jobMeta.clearChanged(); return jobMeta; }
Example 2
Source File: KettleFileRepositoryTest.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@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 ); }
Example 3
Source File: PurRepository.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private JobMeta buildJobMeta( final RepositoryFile file, final RepositoryDirectoryInterface parentDir, final NodeRepositoryFileData data, final ObjectRevision revision ) throws KettleException { JobMeta jobMeta = new JobMeta(); jobMeta.setName( file.getTitle() ); jobMeta.setFilename( file.getName() ); jobMeta.setDescription( file.getDescription() ); jobMeta.setObjectId( new StringObjectId( file.getId().toString() ) ); jobMeta.setObjectRevision( revision ); jobMeta.setRepository( this ); jobMeta.setRepositoryDirectory( parentDir ); jobMeta.setMetaStore( getMetaStore() ); readJobMetaSharedObjects( jobMeta ); // This should read from the local cache jobDelegate.dataNodeToElement( data.getNode(), jobMeta ); jobMeta.clearChanged(); return jobMeta; }
Example 4
Source File: ExecuteJobServletTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private JobMeta buildJobMeta() { JobMeta jobMeta = new JobMeta(); jobMeta.setCarteObjectId( JOB_ID ); jobMeta.setName( JOB_NAME ); JobEntryCopy jobEntryCopy = new JobEntryCopy( ); jobEntryCopy.setEntry( new JobEntryEmpty() ); jobEntryCopy.setLocation( 150, 50 ); jobMeta.addJobEntry( jobEntryCopy ); return jobMeta; }
Example 5
Source File: GetJobImageServletTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private Job buildJob() { JobMeta jobMeta = new JobMeta(); jobMeta.setCarteObjectId( JOB_ID ); jobMeta.setName( JOB_NAME ); JobEntryCopy jobEntryCopy = new JobEntryCopy( ); jobEntryCopy.setEntry( new JobEntryEmpty() ); jobEntryCopy.setLocation( 150, 50 ); jobMeta.addJobEntry( jobEntryCopy ); Job job = new Job( null, jobMeta ); job.setName( JOB_NAME ); return job; }
Example 6
Source File: GetRepositoryNamesTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private static void prepareFileRepository() throws IOException, KettleException { baseDirName = Files.createTempDirectory( "GetRepositoryNamesIT" ); RepositoryMeta repoMeta = new KettleFileRepositoryMeta( UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID() .toString(), baseDirName.toString() ); repo = new KettleFileRepository(); repo.init( repoMeta ); repo.connect( null, null ); // Populate RepositoryDirectoryInterface rootDir = repo.findDirectory( "/" ); RepositoryDirectoryInterface subdir1 = new RepositoryDirectory( rootDir, "subdir1" ); repo.saveRepositoryDirectory( subdir1 ); TransMeta transMeta1 = new TransMeta(); transMeta1.setName( "Trans1" ); transMeta1.setRepositoryDirectory( subdir1 ); repo.save( transMeta1, null, null ); JobMeta jobMeta1 = new JobMeta(); jobMeta1.setName( "Job1" ); jobMeta1.setRepositoryDirectory( subdir1 ); repo.save( jobMeta1, null, null ); RepositoryDirectoryInterface subdir2 = new RepositoryDirectory( subdir1, "subdir2" ); repo.saveRepositoryDirectory( subdir2 ); TransMeta transMeta2 = new TransMeta(); transMeta2.setName( "Trans2" ); transMeta2.setRepositoryDirectory( subdir2 ); repo.save( transMeta2, null, null ); JobMeta jobMeta2 = new JobMeta(); jobMeta2.setName( "Job2" ); jobMeta2.setRepositoryDirectory( subdir2 ); repo.save( jobMeta2, null, null ); }
Example 7
Source File: SharedObjectSyncUtilTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private JobMeta createJobMeta() throws Exception { JobMeta jobMeta = new JobMeta(); jobMeta.setName( UUID.randomUUID().toString() ); jobMeta.setFilename( UUID.randomUUID().toString() ); jobMeta.setRepositoryDirectory( mock( RepositoryDirectory.class ) ); // jobMeta.setSharedObjectsFile( SHARED_OBJECTS_FILE ); initSharedObjects( jobMeta, SHARED_OBJECTS_FILE ); when( spoon.getActiveMeta() ).thenReturn( jobMeta ); return jobMeta; }
Example 8
Source File: KettleFileRepositoryIT.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void verifyJobSamples( RepositoryDirectoryInterface samplesDirectory ) throws Exception { FileObject jobSamplesFolder = KettleVFS.getFileObject( "samples/jobs/" ); FileObject[] files = jobSamplesFolder.findFiles( new FileSelector() { @Override public boolean traverseDescendents( FileSelectInfo arg0 ) throws Exception { return true; } @Override public boolean includeFile( FileSelectInfo info ) throws Exception { return info.getFile().getName().getExtension().equalsIgnoreCase( "kjb" ); } } ); List<FileObject> filesList = Arrays.asList( files ); Collections.sort( filesList, new Comparator<FileObject>() { @Override public int compare( FileObject o1, FileObject o2 ) { return o1.getName().getPath().compareTo( o2.getName().getPath() ); } } ); for ( FileObject file : filesList ) { String jobFilename = file.getName().getPath(); System.out.println( "Storing/Loading/validating job '" + jobFilename + "'" ); // Load the JobMeta object... // JobMeta jobMeta = new JobMeta( jobFilename, repository ); jobMeta.setFilename( null ); // The name is sometimes empty in the file, duplicates are present too... // Replaces slashes and the like as well... // jobMeta.setName( Const.createName( file.getName().getBaseName() ) ); jobMeta.setName( jobMeta.getName().replace( '/', '-' ) ); if ( Utils.isEmpty( jobMeta.getName() ) ) { jobMeta.setName( Const.createName( file.getName().getBaseName() ) ); } if ( jobMeta.getName().contains( "/" ) ) { jobMeta.setName( jobMeta.getName().replace( '/', '-' ) ); } // Save it in the repository in the samples folder // jobMeta.setRepositoryDirectory( samplesDirectory ); repository.save( jobMeta, "unit testing" ); assertNotNull( jobMeta.getObjectId() ); // Load it back up again... // JobMeta repJobMeta = repository.loadJob( jobMeta.getObjectId(), null ); String oneXml = repJobMeta.getXML(); // Save & load it again // repository.save( jobMeta, "unit testing" ); repJobMeta = repository.loadJob( jobMeta.getObjectId(), null ); String twoXml = repJobMeta.getXML(); // The XML needs to be identical after loading // // storeFile(oneXml, "/tmp/one.ktr"); // storeFile(twoXml, "/tmp/two.ktr"); // assertEquals( oneXml, twoXml ); } // Verify the number of stored files, see if we can find them all again. // System.out.println( "Stored " + files.length + " job samples in folder " + samplesDirectory.getPath() ); String[] jobNames = repository.getJobNames( samplesDirectory.getObjectId(), false ); assertEquals( files.length, jobNames.length ); }
Example 9
Source File: RepositoryTestBase.java From pentaho-kettle with Apache License 2.0 | 4 votes |
protected JobMeta createJobMeta( String jobName ) throws Exception { RepositoryDirectoryInterface rootDir = loadStartDirectory(); JobMeta jobMeta = new JobMeta(); jobMeta.setName( jobName ); jobMeta.setDescription( EXP_JOB_DESC ); jobMeta.setExtendedDescription( EXP_JOB_EXTENDED_DESC ); jobMeta.setRepositoryDirectory( rootDir.findDirectory( DIR_JOBS ) ); jobMeta.setJobversion( EXP_JOB_VERSION ); jobMeta.setJobstatus( EXP_JOB_STATUS ); jobMeta.setCreatedUser( EXP_JOB_CREATED_USER ); jobMeta.setCreatedDate( EXP_JOB_CREATED_DATE ); jobMeta.setModifiedUser( EXP_JOB_MOD_USER ); jobMeta.setModifiedDate( EXP_JOB_MOD_DATE ); jobMeta.addParameterDefinition( EXP_JOB_PARAM_1_NAME, EXP_JOB_PARAM_1_DEF, EXP_JOB_PARAM_1_DESC ); // TODO mlowery other jobLogTable fields could be set for testing here JobLogTable jobLogTable = JobLogTable.getDefault( jobMeta, jobMeta ); jobLogTable.setConnectionName( EXP_JOB_LOG_TABLE_CONN_NAME ); jobLogTable.setLogInterval( EXP_JOB_LOG_TABLE_INTERVAL ); jobLogTable.setSchemaName( EXP_JOB_LOG_TABLE_SCHEMA_NAME ); jobLogTable.setLogSizeLimit( EXP_JOB_LOG_TABLE_SIZE_LIMIT ); jobLogTable.setTableName( EXP_JOB_LOG_TABLE_TABLE_NAME ); jobLogTable.setTimeoutInDays( EXP_JOB_LOG_TABLE_TIMEOUT_IN_DAYS ); jobMeta.setJobLogTable( jobLogTable ); // TODO mlowery other jobEntryLogTable fields could be set for testing here JobEntryLogTable jobEntryLogTable = JobEntryLogTable.getDefault( jobMeta, jobMeta ); jobEntryLogTable.setConnectionName( EXP_JOB_LOG_TABLE_CONN_NAME ); jobEntryLogTable.setSchemaName( EXP_JOB_LOG_TABLE_SCHEMA_NAME ); jobEntryLogTable.setTableName( EXP_JOB_LOG_TABLE_TABLE_NAME ); jobEntryLogTable.setTimeoutInDays( EXP_JOB_LOG_TABLE_TIMEOUT_IN_DAYS ); jobMeta.setJobEntryLogTable( jobEntryLogTable ); // TODO mlowery other channelLogTable fields could be set for testing here ChannelLogTable channelLogTable = ChannelLogTable.getDefault( jobMeta, jobMeta ); channelLogTable.setConnectionName( EXP_JOB_LOG_TABLE_CONN_NAME ); channelLogTable.setSchemaName( EXP_JOB_LOG_TABLE_SCHEMA_NAME ); channelLogTable.setTableName( EXP_JOB_LOG_TABLE_TABLE_NAME ); channelLogTable.setTimeoutInDays( EXP_JOB_LOG_TABLE_TIMEOUT_IN_DAYS ); jobMeta.setChannelLogTable( channelLogTable ); jobMeta.setBatchIdPassed( EXP_JOB_BATCH_ID_PASSED ); jobMeta.setSharedObjectsFile( EXP_JOB_SHARED_OBJECTS_FILE ); DatabaseMeta entryDbMeta = createDatabaseMeta( EXP_DBMETA_NAME_JOB.concat( jobName ) ); repository.save( entryDbMeta, VERSION_COMMENT_V1, null ); deleteStack.push( entryDbMeta ); JobEntryCopy jobEntryCopy1 = createJobEntry1Copy( entryDbMeta ); jobMeta.addJobEntry( jobEntryCopy1 ); JobEntryCopy jobEntryCopy2 = createJobEntry2Copy( entryDbMeta ); jobMeta.addJobEntry( jobEntryCopy2 ); jobMeta.addJobHop( createJobHopMeta( jobEntryCopy1, jobEntryCopy2 ) ); jobMeta.addNote( createNotePadMeta( jobName ) ); return jobMeta; }