Java Code Examples for org.pentaho.di.job.JobMeta#setSharedObjects()
The following examples show how to use
org.pentaho.di.job.JobMeta#setSharedObjects() .
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: KettleDatabaseRepositoryJobDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public SharedObjects readSharedObjects( JobMeta jobMeta ) throws KettleException { jobMeta.setSharedObjects( jobMeta.readSharedObjects() ); readDatabases( jobMeta, true ); readSlaves( jobMeta, true ); return jobMeta.getSharedObjects(); }
Example 2
Source File: SharedObjectSyncUtilTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Test public void synchronizeSlaveServerRenameRepository() throws Exception { try { spoon.rep = repository; final String objectId = "object-id"; final String serverName = "SharedServer"; JobMeta job1 = createJobMeta(); job1.setRepository( repository ); job1.setSharedObjects( createSharedObjects( SHARED_OBJECTS_FILE ) ); SlaveServer server1 = createSlaveServer( serverName, false ); server1.setObjectId( new StringObjectId( objectId ) ); job1.addOrReplaceSlaveServer( server1 ); spoonDelegates.jobs.addJob( job1 ); JobMeta job2 = createJobMeta(); job2.setRepository( repository ); job2.setSharedObjects( createSharedObjects( SHARED_OBJECTS_FILE ) ); SlaveServer server2 = createSlaveServer( serverName, false ); server2.setObjectId( new StringObjectId( objectId ) ); spoonDelegates.jobs.addJob( job2 ); server2.setName( AFTER_SYNC_VALUE ); sharedUtil.synchronizeSlaveServers( server2 ); job2.addOrReplaceSlaveServer( server2 ); assertEquals( AFTER_SYNC_VALUE, job1.getSlaveServers().get( 0 ).getName() ); } finally { spoon.rep = null; } }
Example 3
Source File: JobDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@SuppressWarnings( "unchecked" ) public SharedObjects loadSharedObjects( final RepositoryElementInterface element, final Map<RepositoryObjectType, List<? extends SharedObjectInterface>> sharedObjectsByType ) throws KettleException { JobMeta jobMeta = (JobMeta) element; jobMeta.setSharedObjects( jobMeta.readSharedObjects() ); // Repository objects take priority so let's overwrite them... // readDatabases( jobMeta, true, (List<DatabaseMeta>) sharedObjectsByType.get( RepositoryObjectType.DATABASE ) ); readSlaves( jobMeta, true, (List<SlaveServer>) sharedObjectsByType.get( RepositoryObjectType.SLAVE_SERVER ) ); return jobMeta.getSharedObjects(); }
Example 4
Source File: SharedObjectSyncUtilTest.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Test public void synchronizeSlaveServerDeleteFromRepository() throws Exception { try { spoon.rep = repository; when( spoon.getRepository() ).thenReturn( repository ); final String objectId = "object-id"; final String serverName = "SharedServer"; TransMeta trans = createTransMeta(); trans.setRepository( repository ); trans.setSharedObjects( createSharedObjects( SHARED_OBJECTS_FILE ) ); SlaveServer server1 = createSlaveServer( serverName, false ); server1.setObjectId( new StringObjectId( objectId ) ); trans.addOrReplaceSlaveServer( server1 ); spoon.delegates.trans.addTransformation( trans ); JobMeta job = createJobMeta(); job.setRepository( repository ); job.setSharedObjects( createSharedObjects( SHARED_OBJECTS_FILE ) ); SlaveServer server3 = createSlaveServer( serverName, false ); server3.setObjectId( new StringObjectId( objectId ) ); job.addOrReplaceSlaveServer( server3 ); spoon.delegates.jobs.addJob( job ); TransMeta trans2 = createTransMeta(); trans2.setRepository( repository ); trans2.setSharedObjects( createSharedObjects( SHARED_OBJECTS_FILE ) ); SlaveServer server2 = createSlaveServer( serverName, false ); server2.setObjectId( new StringObjectId( objectId ) ); trans2.addOrReplaceSlaveServer( server2 ); spoon.delegates.trans.addTransformation( trans2 ); assertFalse( trans.getSlaveServers().isEmpty() ); assertFalse( job.getSlaveServers().isEmpty() ); spoon.delegates.slaves.delSlaveServer( trans2, server2 ); verify( repository ).deleteSlave( server2.getObjectId() ); assertTrue( trans.getSlaveServers().isEmpty() ); assertTrue( job.getSlaveServers().isEmpty() ); } finally { spoon.rep = null; when( spoon.getRepository() ).thenReturn( null ); } }