@Test public void testLoadClusterConfigNoMetastore() throws MetaStoreException, KettleException { String testName = "testName"; String testHost = "testHost"; String hdfsPort = "8080"; String jobTrackerHost = "jobTrackerHost"; String jobTrackerPort = "8081"; MetaStoreException metaStoreException = new MetaStoreException( "msg" ); when( namedClusterService.contains( testName, metaStore ) ).thenReturn( true ); when( namedClusterService.read( testName, metaStore ) ).thenThrow( metaStoreException ); when( namedClusterService.getClusterTemplate() ).thenReturn( namedCluster ); when( repository.getJobEntryAttributeString( objectId, JobEntryHadoopJobExecutor.CLUSTER_NAME ) ).thenReturn( testName ); when( repository.getJobEntryAttributeString( objectId, JobEntryHadoopJobExecutor.HDFS_HOSTNAME ) ).thenReturn( testHost ); when( repository.getJobEntryAttributeString( objectId, JobEntryHadoopJobExecutor.HDFS_PORT ) ).thenReturn( hdfsPort ); when( repository.getJobEntryAttributeString( objectId, JobEntryHadoopJobExecutor.JOB_TRACKER_HOSTNAME ) ) .thenReturn( jobTrackerHost ); when( repository.getJobEntryAttributeString( objectId, JobEntryHadoopJobExecutor.JOB_TRACKER_PORT ) ) .thenReturn( jobTrackerPort ); assertEquals( namedCluster, namedClusterLoadSaveUtil.loadClusterConfig( namedClusterService, objectId, repository, null, null, logChannelInterface ) ); verify( namedClusterService, never() ).read( eq( testName ), any( IMetaStore.class ) ); verify( namedCluster ).setHdfsHost( testHost ); verify( namedCluster ).setHdfsPort( hdfsPort ); verify( namedCluster ).setJobTrackerHost( jobTrackerHost ); verify( namedCluster ).setJobTrackerPort( jobTrackerPort ); }
public NamedCluster loadClusterConfig( NamedClusterService namedClusterService, ObjectId id_jobentry, Repository rep, IMetaStore metaStore, Node entrynode, LogChannelInterface logChannelInterface ) { boolean configLoaded = false; try { String clusterName = null; if ( entrynode != null ) { clusterName = XMLHandler.getTagValue( entrynode, CLUSTER_NAME ); } else if ( rep != null ) { clusterName = rep.getJobEntryAttributeString( id_jobentry, CLUSTER_NAME ); } NamedCluster nc = null; if ( !StringUtils.isEmpty( clusterName ) && namedClusterService.contains( clusterName, metaStore ) ) { nc = namedClusterService.read( clusterName, metaStore ); } if ( nc != null ) { return nc; } } catch ( Throwable t ) { logChannelInterface.logDebug( t.getMessage(), t ); } NamedCluster namedCluster = namedClusterService.getClusterTemplate(); if ( entrynode != null ) { namedCluster.setHdfsHost( XMLHandler.getTagValue( entrynode, HDFS_HOSTNAME ) ); namedCluster.setHdfsPort( XMLHandler.getTagValue( entrynode, HDFS_PORT ) ); namedCluster.setJobTrackerHost( XMLHandler.getTagValue( entrynode, JOB_TRACKER_HOSTNAME ) ); namedCluster.setJobTrackerPort( XMLHandler.getTagValue( entrynode, JOB_TRACKER_PORT ) ); } else if ( rep != null ) { try { namedCluster.setHdfsHost( rep.getJobEntryAttributeString( id_jobentry, HDFS_HOSTNAME ) ); namedCluster.setHdfsPort( rep.getJobEntryAttributeString( id_jobentry, HDFS_PORT ) ); namedCluster .setJobTrackerHost( rep.getJobEntryAttributeString( id_jobentry, JOB_TRACKER_HOSTNAME ) ); namedCluster .setJobTrackerPort( rep.getJobEntryAttributeString( id_jobentry, JOB_TRACKER_PORT ) ); } catch ( KettleException ke ) { logChannelInterface.logError( ke.getMessage(), ke ); } } return namedCluster; }
NamedClusterLoadSaveUtil { public NamedCluster loadClusterConfig( NamedClusterService namedClusterService, ObjectId id_jobentry, Repository rep, IMetaStore metaStore, Node entrynode, LogChannelInterface logChannelInterface ) { boolean configLoaded = false; try { String clusterName = null; if ( entrynode != null ) { clusterName = XMLHandler.getTagValue( entrynode, CLUSTER_NAME ); } else if ( rep != null ) { clusterName = rep.getJobEntryAttributeString( id_jobentry, CLUSTER_NAME ); } NamedCluster nc = null; if ( !StringUtils.isEmpty( clusterName ) && namedClusterService.contains( clusterName, metaStore ) ) { nc = namedClusterService.read( clusterName, metaStore ); } if ( nc != null ) { return nc; } } catch ( Throwable t ) { logChannelInterface.logDebug( t.getMessage(), t ); } NamedCluster namedCluster = namedClusterService.getClusterTemplate(); if ( entrynode != null ) { namedCluster.setHdfsHost( XMLHandler.getTagValue( entrynode, HDFS_HOSTNAME ) ); namedCluster.setHdfsPort( XMLHandler.getTagValue( entrynode, HDFS_PORT ) ); namedCluster.setJobTrackerHost( XMLHandler.getTagValue( entrynode, JOB_TRACKER_HOSTNAME ) ); namedCluster.setJobTrackerPort( XMLHandler.getTagValue( entrynode, JOB_TRACKER_PORT ) ); } else if ( rep != null ) { try { namedCluster.setHdfsHost( rep.getJobEntryAttributeString( id_jobentry, HDFS_HOSTNAME ) ); namedCluster.setHdfsPort( rep.getJobEntryAttributeString( id_jobentry, HDFS_PORT ) ); namedCluster .setJobTrackerHost( rep.getJobEntryAttributeString( id_jobentry, JOB_TRACKER_HOSTNAME ) ); namedCluster .setJobTrackerPort( rep.getJobEntryAttributeString( id_jobentry, JOB_TRACKER_PORT ) ); } catch ( KettleException ke ) { logChannelInterface.logError( ke.getMessage(), ke ); } } return namedCluster; } }
NamedClusterLoadSaveUtil { public NamedCluster loadClusterConfig( NamedClusterService namedClusterService, ObjectId id_jobentry, Repository rep, IMetaStore metaStore, Node entrynode, LogChannelInterface logChannelInterface ) { boolean configLoaded = false; try { String clusterName = null; if ( entrynode != null ) { clusterName = XMLHandler.getTagValue( entrynode, CLUSTER_NAME ); } else if ( rep != null ) { clusterName = rep.getJobEntryAttributeString( id_jobentry, CLUSTER_NAME ); } NamedCluster nc = null; if ( !StringUtils.isEmpty( clusterName ) && namedClusterService.contains( clusterName, metaStore ) ) { nc = namedClusterService.read( clusterName, metaStore ); } if ( nc != null ) { return nc; } } catch ( Throwable t ) { logChannelInterface.logDebug( t.getMessage(), t ); } NamedCluster namedCluster = namedClusterService.getClusterTemplate(); if ( entrynode != null ) { namedCluster.setHdfsHost( XMLHandler.getTagValue( entrynode, HDFS_HOSTNAME ) ); namedCluster.setHdfsPort( XMLHandler.getTagValue( entrynode, HDFS_PORT ) ); namedCluster.setJobTrackerHost( XMLHandler.getTagValue( entrynode, JOB_TRACKER_HOSTNAME ) ); namedCluster.setJobTrackerPort( XMLHandler.getTagValue( entrynode, JOB_TRACKER_PORT ) ); } else if ( rep != null ) { try { namedCluster.setHdfsHost( rep.getJobEntryAttributeString( id_jobentry, HDFS_HOSTNAME ) ); namedCluster.setHdfsPort( rep.getJobEntryAttributeString( id_jobentry, HDFS_PORT ) ); namedCluster .setJobTrackerHost( rep.getJobEntryAttributeString( id_jobentry, JOB_TRACKER_HOSTNAME ) ); namedCluster .setJobTrackerPort( rep.getJobEntryAttributeString( id_jobentry, JOB_TRACKER_PORT ) ); } catch ( KettleException ke ) { logChannelInterface.logError( ke.getMessage(), ke ); } } return namedCluster; }  }
NamedClusterLoadSaveUtil { public NamedCluster loadClusterConfig( NamedClusterService namedClusterService, ObjectId id_jobentry, Repository rep, IMetaStore metaStore, Node entrynode, LogChannelInterface logChannelInterface ) { boolean configLoaded = false; try { String clusterName = null; if ( entrynode != null ) { clusterName = XMLHandler.getTagValue( entrynode, CLUSTER_NAME ); } else if ( rep != null ) { clusterName = rep.getJobEntryAttributeString( id_jobentry, CLUSTER_NAME ); } NamedCluster nc = null; if ( !StringUtils.isEmpty( clusterName ) && namedClusterService.contains( clusterName, metaStore ) ) { nc = namedClusterService.read( clusterName, metaStore ); } if ( nc != null ) { return nc; } } catch ( Throwable t ) { logChannelInterface.logDebug( t.getMessage(), t ); } NamedCluster namedCluster = namedClusterService.getClusterTemplate(); if ( entrynode != null ) { namedCluster.setHdfsHost( XMLHandler.getTagValue( entrynode, HDFS_HOSTNAME ) ); namedCluster.setHdfsPort( XMLHandler.getTagValue( entrynode, HDFS_PORT ) ); namedCluster.setJobTrackerHost( XMLHandler.getTagValue( entrynode, JOB_TRACKER_HOSTNAME ) ); namedCluster.setJobTrackerPort( XMLHandler.getTagValue( entrynode, JOB_TRACKER_PORT ) ); } else if ( rep != null ) { try { namedCluster.setHdfsHost( rep.getJobEntryAttributeString( id_jobentry, HDFS_HOSTNAME ) ); namedCluster.setHdfsPort( rep.getJobEntryAttributeString( id_jobentry, HDFS_PORT ) ); namedCluster .setJobTrackerHost( rep.getJobEntryAttributeString( id_jobentry, JOB_TRACKER_HOSTNAME ) ); namedCluster .setJobTrackerPort( rep.getJobEntryAttributeString( id_jobentry, JOB_TRACKER_PORT ) ); } catch ( KettleException ke ) { logChannelInterface.logError( ke.getMessage(), ke ); } } return namedCluster; }  void saveNamedClusterRep( NamedCluster namedCluster, NamedClusterService namedClusterService, Repository rep,
      IMetaStore metaStore, ObjectId id_job, ObjectId objectId, LogChannelInterface logChannelInterface ); void getXmlNamedCluster( NamedCluster namedCluster, NamedClusterService namedClusterService, IMetaStore metaStore,
      LogChannelInterface logChannelInterface, StringBuilder retval ); NamedCluster loadClusterConfig( NamedClusterService namedClusterService, ObjectId id_jobentry, Repository rep,
                                         IMetaStore metaStore, Node entrynode,
                                         LogChannelInterface logChannelInterface ); }
NamedClusterLoadSaveUtil { public NamedCluster loadClusterConfig( NamedClusterService namedClusterService, ObjectId id_jobentry, Repository rep, IMetaStore metaStore, Node entrynode, LogChannelInterface logChannelInterface ) { boolean configLoaded = false; try { String clusterName = null; if ( entrynode != null ) { clusterName = XMLHandler.getTagValue( entrynode, CLUSTER_NAME ); } else if ( rep != null ) { clusterName = rep.getJobEntryAttributeString( id_jobentry, CLUSTER_NAME ); } NamedCluster nc = null; if ( !StringUtils.isEmpty( clusterName ) && namedClusterService.contains( clusterName, metaStore ) ) { nc = namedClusterService.read( clusterName, metaStore ); } if ( nc != null ) { return nc; } } catch ( Throwable t ) { logChannelInterface.logDebug( t.getMessage(), t ); } NamedCluster namedCluster = namedClusterService.getClusterTemplate(); if ( entrynode != null ) { namedCluster.setHdfsHost( XMLHandler.getTagValue( entrynode, HDFS_HOSTNAME ) ); namedCluster.setHdfsPort( XMLHandler.getTagValue( entrynode, HDFS_PORT ) ); namedCluster.setJobTrackerHost( XMLHandler.getTagValue( entrynode, JOB_TRACKER_HOSTNAME ) ); namedCluster.setJobTrackerPort( XMLHandler.getTagValue( entrynode, JOB_TRACKER_PORT ) ); } else if ( rep != null ) { try { namedCluster.setHdfsHost( rep.getJobEntryAttributeString( id_jobentry, HDFS_HOSTNAME ) ); namedCluster.setHdfsPort( rep.getJobEntryAttributeString( id_jobentry, HDFS_PORT ) ); namedCluster .setJobTrackerHost( rep.getJobEntryAttributeString( id_jobentry, JOB_TRACKER_HOSTNAME ) ); namedCluster .setJobTrackerPort( rep.getJobEntryAttributeString( id_jobentry, JOB_TRACKER_PORT ) ); } catch ( KettleException ke ) { logChannelInterface.logError( ke.getMessage(), ke ); } } return namedCluster; }  void saveNamedClusterRep( NamedCluster namedCluster, NamedClusterService namedClusterService, Repository rep,
      IMetaStore metaStore, ObjectId id_job, ObjectId objectId, LogChannelInterface logChannelInterface ); void getXmlNamedCluster( NamedCluster namedCluster, NamedClusterService namedClusterService, IMetaStore metaStore,
      LogChannelInterface logChannelInterface, StringBuilder retval ); NamedCluster loadClusterConfig( NamedClusterService namedClusterService, ObjectId id_jobentry, Repository rep,
                                         IMetaStore metaStore, Node entrynode,
                                         LogChannelInterface logChannelInterface ); static final String CLUSTER_NAME; static final String HDFS_HOSTNAME; static final String HDFS_PORT; static final String JOB_TRACKER_HOSTNAME; static final String JOB_TRACKER_PORT; }