Java Code Examples for org.pentaho.di.job.JobMeta#getObjectRevision()
The following examples show how to use
org.pentaho.di.job.JobMeta#getObjectRevision() .
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: RepositoryTestBase.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Test @Ignore public void testGetAcl() throws Exception { RepositoryDirectoryInterface rootDir = initRepo(); JobMeta jobMeta = createJobMeta( EXP_JOB_NAME ); RepositoryDirectoryInterface jobsDir = rootDir.findDirectory( DIR_JOBS ); repository.save( jobMeta, VERSION_COMMENT_V1, null ); deleteStack.push( jobMeta ); assertNotNull( jobMeta.getObjectId() ); ObjectRevision version = jobMeta.getObjectRevision(); assertNotNull( version ); assertTrue( hasVersionWithComment( jobMeta, VERSION_COMMENT_V1 ) ); assertTrue( repository.exists( EXP_JOB_NAME, jobsDir, RepositoryObjectType.JOB ) ); ObjectAcl acl = ( (IAclService) repository ).getAcl( jobMeta.getObjectId(), false ); assertNotNull( acl ); }
Example 2
Source File: RepositoryTestBase.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Test @Ignore public void testSetAcl() throws Exception { RepositoryDirectoryInterface rootDir = initRepo(); JobMeta jobMeta = createJobMeta( EXP_JOB_NAME ); RepositoryDirectoryInterface jobsDir = rootDir.findDirectory( DIR_JOBS ); repository.save( jobMeta, VERSION_COMMENT_V1, null ); deleteStack.push( jobMeta ); assertNotNull( jobMeta.getObjectId() ); ObjectRevision version = jobMeta.getObjectRevision(); assertNotNull( version ); assertTrue( hasVersionWithComment( jobMeta, VERSION_COMMENT_V1 ) ); assertTrue( repository.exists( EXP_JOB_NAME, jobsDir, RepositoryObjectType.JOB ) ); ObjectAcl acl = ( (IAclService) repository ).getAcl( jobMeta.getObjectId(), false ); assertNotNull( acl ); acl.setEntriesInheriting( false ); ObjectAce ace = new RepositoryObjectAce( new RepositoryObjectRecipient( "suzy", Type.USER ), EnumSet .of( RepositoryFilePermission.READ ) ); List<ObjectAce> aceList = new ArrayList<ObjectAce>(); aceList.add( ace ); acl.setAces( aceList ); ( (IAclService) repository ).setAcl( jobMeta.getObjectId(), acl ); ObjectAcl acl1 = ( (IAclService) repository ).getAcl( jobMeta.getObjectId(), false ); assertEquals( Boolean.FALSE, acl1.isEntriesInheriting() ); assertEquals( 1, acl1.getAces().size() ); ObjectAce ace1 = acl1.getAces().get( 0 ); assertEquals( ace1.getRecipient().getName(), "suzy" ); assertTrue( ace1.getPermissions().contains( RepositoryFilePermission.READ ) ); }
Example 3
Source File: PurRepositoryIT.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Test public void testExport() throws Exception { final String exportFileName = new File( "test.export" ).getAbsolutePath(); //$NON-NLS-1$ RepositoryDirectoryInterface rootDir = initRepo(); String uniqueTransName = EXP_TRANS_NAME.concat( EXP_DBMETA_NAME ); TransMeta transMeta = createTransMeta( EXP_DBMETA_NAME ); // Create a database association DatabaseMeta dbMeta = createDatabaseMeta( EXP_DBMETA_NAME ); repository.save( dbMeta, VERSION_COMMENT_V1, null ); TableInputMeta tableInputMeta = new TableInputMeta(); tableInputMeta.setDatabaseMeta( dbMeta ); transMeta.addStep( new StepMeta( EXP_TRANS_STEP_1_NAME, tableInputMeta ) ); RepositoryDirectoryInterface transDir = rootDir.findDirectory( DIR_TRANSFORMATIONS ); repository.save( transMeta, VERSION_COMMENT_V1, null ); deleteStack.push( transMeta ); // So this transformation is cleaned up afterward assertNotNull( transMeta.getObjectId() ); ObjectRevision version = transMeta.getObjectRevision(); assertNotNull( version ); assertTrue( hasVersionWithComment( transMeta, VERSION_COMMENT_V1 ) ); assertTrue( repository.exists( uniqueTransName, transDir, RepositoryObjectType.TRANSFORMATION ) ); JobMeta jobMeta = createJobMeta( EXP_JOB_NAME ); RepositoryDirectoryInterface jobsDir = rootDir.findDirectory( DIR_JOBS ); repository.save( jobMeta, VERSION_COMMENT_V1, null ); deleteStack.push( jobMeta ); assertNotNull( jobMeta.getObjectId() ); version = jobMeta.getObjectRevision(); assertNotNull( version ); assertTrue( hasVersionWithComment( jobMeta, VERSION_COMMENT_V1 ) ); assertTrue( repository.exists( EXP_JOB_NAME, jobsDir, RepositoryObjectType.JOB ) ); LogListener errorLogListener = new LogListener( LogLevel.ERROR ); KettleLogStore.getAppender().addLoggingEventListener( errorLogListener ); try { repository.getExporter().exportAllObjects( new MockProgressMonitorListener(), exportFileName, null, "all" ); //$NON-NLS-1$ FileObject exportFile = KettleVFS.getFileObject( exportFileName ); assertFalse( "file left open", exportFile.getContent().isOpen() ); assertNotNull( exportFile ); MockRepositoryExportParser parser = new MockRepositoryExportParser(); SAXParserFactory.newInstance().newSAXParser().parse( KettleVFS.getInputStream( exportFile ), parser ); if ( parser.getFatalError() != null ) { throw parser.getFatalError(); } assertNotNull( "No nodes found in export", parser.getNodeNames() ); //$NON-NLS-1$ assertTrue( "No nodes found in export", !parser.getNodeNames().isEmpty() ); //$NON-NLS-1$ assertEquals( "Incorrect number of nodes", 5, parser.getNodeNames().size() ); //$NON-NLS-1$ assertEquals( "Incorrect number of transformations", 1, parser.getNodesWithName( "transformation" ).size() ); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals( "Incorrect number of jobs", 1, parser.getNodesWithName( "job" ).size() ); //$NON-NLS-1$ //$NON-NLS-2$ assertTrue( "log error", errorLogListener.getEvents().isEmpty() ); } finally { KettleVFS.getFileObject( exportFileName ).delete(); KettleLogStore.getAppender().removeLoggingEventListener( errorLogListener ); } }