@Test public void testGetXmlNamedCluster_NoNPEWhenNCIsNull() { StringBuilder ncString = new StringBuilder(); try { namedClusterLoadSaveUtil.getXmlNamedCluster( null, namedClusterService, null, logChannelInterface, ncString ); assertEquals( "It should not be added any NamedCluster info but it was:" + ncString.toString(), 0, ncString .length() ); } catch ( NullPointerException ex ) { fail( "NPE occured but should not: " + ex ); } }
public void getXmlNamedCluster( NamedCluster namedCluster, NamedClusterService namedClusterService, IMetaStore metaStore, LogChannelInterface logChannelInterface, StringBuilder retval ) { if ( namedCluster != null ) { String namedClusterName = namedCluster.getName(); if ( !Const.isEmpty( namedClusterName ) ) { retval.append( " " ).append( XMLHandler.addTagValue( CLUSTER_NAME, namedClusterName ) ); } try { if ( metaStore != null && !StringUtils.isEmpty( namedClusterName ) && namedClusterService .contains( namedClusterName, metaStore ) ) { namedCluster = namedClusterService.read( namedClusterName, metaStore ); } } catch ( MetaStoreException e ) { logChannelInterface.logDebug( e.getMessage(), e ); } retval.append( " " ).append( XMLHandler.addTagValue( HDFS_HOSTNAME, namedCluster.getHdfsHost() ) ); retval.append( " " ).append( XMLHandler.addTagValue( HDFS_PORT, namedCluster.getHdfsPort() ) ); retval.append( " " ).append( XMLHandler.addTagValue( JOB_TRACKER_HOSTNAME, namedCluster .getJobTrackerHost() ) ); retval.append( " " ).append( XMLHandler.addTagValue( JOB_TRACKER_PORT, namedCluster.getJobTrackerPort() ) ); } }
NamedClusterLoadSaveUtil { public void getXmlNamedCluster( NamedCluster namedCluster, NamedClusterService namedClusterService, IMetaStore metaStore, LogChannelInterface logChannelInterface, StringBuilder retval ) { if ( namedCluster != null ) { String namedClusterName = namedCluster.getName(); if ( !Const.isEmpty( namedClusterName ) ) { retval.append( " " ).append( XMLHandler.addTagValue( CLUSTER_NAME, namedClusterName ) ); } try { if ( metaStore != null && !StringUtils.isEmpty( namedClusterName ) && namedClusterService .contains( namedClusterName, metaStore ) ) { namedCluster = namedClusterService.read( namedClusterName, metaStore ); } } catch ( MetaStoreException e ) { logChannelInterface.logDebug( e.getMessage(), e ); } retval.append( " " ).append( XMLHandler.addTagValue( HDFS_HOSTNAME, namedCluster.getHdfsHost() ) ); retval.append( " " ).append( XMLHandler.addTagValue( HDFS_PORT, namedCluster.getHdfsPort() ) ); retval.append( " " ).append( XMLHandler.addTagValue( JOB_TRACKER_HOSTNAME, namedCluster .getJobTrackerHost() ) ); retval.append( " " ).append( XMLHandler.addTagValue( JOB_TRACKER_PORT, namedCluster.getJobTrackerPort() ) ); } } }
NamedClusterLoadSaveUtil { public void getXmlNamedCluster( NamedCluster namedCluster, NamedClusterService namedClusterService, IMetaStore metaStore, LogChannelInterface logChannelInterface, StringBuilder retval ) { if ( namedCluster != null ) { String namedClusterName = namedCluster.getName(); if ( !Const.isEmpty( namedClusterName ) ) { retval.append( " " ).append( XMLHandler.addTagValue( CLUSTER_NAME, namedClusterName ) ); } try { if ( metaStore != null && !StringUtils.isEmpty( namedClusterName ) && namedClusterService .contains( namedClusterName, metaStore ) ) { namedCluster = namedClusterService.read( namedClusterName, metaStore ); } } catch ( MetaStoreException e ) { logChannelInterface.logDebug( e.getMessage(), e ); } retval.append( " " ).append( XMLHandler.addTagValue( HDFS_HOSTNAME, namedCluster.getHdfsHost() ) ); retval.append( " " ).append( XMLHandler.addTagValue( HDFS_PORT, namedCluster.getHdfsPort() ) ); retval.append( " " ).append( XMLHandler.addTagValue( JOB_TRACKER_HOSTNAME, namedCluster .getJobTrackerHost() ) ); retval.append( " " ).append( XMLHandler.addTagValue( JOB_TRACKER_PORT, namedCluster.getJobTrackerPort() ) ); } }  }
NamedClusterLoadSaveUtil { public void getXmlNamedCluster( NamedCluster namedCluster, NamedClusterService namedClusterService, IMetaStore metaStore, LogChannelInterface logChannelInterface, StringBuilder retval ) { if ( namedCluster != null ) { String namedClusterName = namedCluster.getName(); if ( !Const.isEmpty( namedClusterName ) ) { retval.append( " " ).append( XMLHandler.addTagValue( CLUSTER_NAME, namedClusterName ) ); } try { if ( metaStore != null && !StringUtils.isEmpty( namedClusterName ) && namedClusterService .contains( namedClusterName, metaStore ) ) { namedCluster = namedClusterService.read( namedClusterName, metaStore ); } } catch ( MetaStoreException e ) { logChannelInterface.logDebug( e.getMessage(), e ); } retval.append( " " ).append( XMLHandler.addTagValue( HDFS_HOSTNAME, namedCluster.getHdfsHost() ) ); retval.append( " " ).append( XMLHandler.addTagValue( HDFS_PORT, namedCluster.getHdfsPort() ) ); retval.append( " " ).append( XMLHandler.addTagValue( JOB_TRACKER_HOSTNAME, namedCluster .getJobTrackerHost() ) ); retval.append( " " ).append( XMLHandler.addTagValue( JOB_TRACKER_PORT, namedCluster.getJobTrackerPort() ) ); } }  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 void getXmlNamedCluster( NamedCluster namedCluster, NamedClusterService namedClusterService, IMetaStore metaStore, LogChannelInterface logChannelInterface, StringBuilder retval ) { if ( namedCluster != null ) { String namedClusterName = namedCluster.getName(); if ( !Const.isEmpty( namedClusterName ) ) { retval.append( " " ).append( XMLHandler.addTagValue( CLUSTER_NAME, namedClusterName ) ); } try { if ( metaStore != null && !StringUtils.isEmpty( namedClusterName ) && namedClusterService .contains( namedClusterName, metaStore ) ) { namedCluster = namedClusterService.read( namedClusterName, metaStore ); } } catch ( MetaStoreException e ) { logChannelInterface.logDebug( e.getMessage(), e ); } retval.append( " " ).append( XMLHandler.addTagValue( HDFS_HOSTNAME, namedCluster.getHdfsHost() ) ); retval.append( " " ).append( XMLHandler.addTagValue( HDFS_PORT, namedCluster.getHdfsPort() ) ); retval.append( " " ).append( XMLHandler.addTagValue( JOB_TRACKER_HOSTNAME, namedCluster .getJobTrackerHost() ) ); retval.append( " " ).append( XMLHandler.addTagValue( JOB_TRACKER_PORT, namedCluster.getJobTrackerPort() ) ); } }  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; }