Java Code Examples for org.pentaho.di.trans.TransMeta#setSharedObjects()
The following examples show how to use
org.pentaho.di.trans.TransMeta#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: TransDelegate.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@SuppressWarnings( "unchecked" ) public SharedObjects loadSharedObjects( final RepositoryElementInterface element, final Map<RepositoryObjectType, List<? extends SharedObjectInterface>> sharedObjectsByType ) throws KettleException { TransMeta transMeta = (TransMeta) element; transMeta.setSharedObjects( transMeta.readSharedObjects() ); // Repository objects take priority so let's overwrite them... // readDatabases( transMeta, true, (List<DatabaseMeta>) sharedObjectsByType.get( RepositoryObjectType.DATABASE ) ); readPartitionSchemas( transMeta, true, (List<PartitionSchema>) sharedObjectsByType .get( RepositoryObjectType.PARTITION_SCHEMA ) ); readSlaves( transMeta, true, (List<SlaveServer>) sharedObjectsByType.get( RepositoryObjectType.SLAVE_SERVER ) ); readClusters( transMeta, true, (List<ClusterSchema>) sharedObjectsByType.get( RepositoryObjectType.CLUSTER_SCHEMA ) ); return transMeta.getSharedObjects(); }
Example 2
Source File: KettleDatabaseRepositoryTransDelegate.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public SharedObjects readTransSharedObjects( TransMeta transMeta ) throws KettleException { transMeta.setSharedObjectsFile( getTransAttributeString( transMeta.getObjectId(), 0, "SHARED_FILE" ) ); transMeta.setSharedObjects( transMeta.readSharedObjects() ); // Repository objects take priority so let's overwrite them... // readDatabases( transMeta, true ); readPartitionSchemas( transMeta, true ); readSlaves( transMeta, true ); readClusters( transMeta, true ); return transMeta.getSharedObjects(); }
Example 3
Source File: SharedObjectSyncUtilTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Test public void synchronizePartitionSchemasDeleteFromRepository() throws Exception { try { spoon.rep = repository; when( spoon.getRepository() ).thenReturn( repository ); final String objectId = "object-id"; final String partitionName = "partsch"; TransMeta trans1 = createTransMeta(); trans1.setRepository( repository ); trans1.setSharedObjects( createSharedObjects( SHARED_OBJECTS_FILE ) ); PartitionSchema part1 = createPartitionSchema( partitionName, false ); part1.setObjectId( new StringObjectId( objectId ) ); trans1.addOrReplacePartitionSchema( part1 ); spoon.delegates.trans.addTransformation( trans1 ); TransMeta trans2 = createTransMeta(); trans2.setRepository( repository ); trans2.setSharedObjects( createSharedObjects( SHARED_OBJECTS_FILE ) ); PartitionSchema part2 = createPartitionSchema( partitionName, false ); part2.setObjectId( new StringObjectId( objectId ) ); trans2.addOrReplacePartitionSchema( part2 ); spoon.delegates.trans.addTransformation( trans2 ); assertFalse( trans1.getPartitionSchemas().isEmpty() ); spoon.delegates.partitions.delPartitionSchema( trans2, part2 ); verify( repository ).deletePartitionSchema( part2.getObjectId() ); assertTrue( trans1.getPartitionSchemas().isEmpty() ); } finally { spoon.rep = null; when( spoon.getRepository() ).thenReturn( null ); } }
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 ); } }