@Test public void testGetXml_WithoutClusterName() throws Exception { when( namedCluster.getZooKeeperHost() ).thenReturn( ZOOKEPER_HOST ); when( namedCluster.getZooKeeperPort() ).thenReturn( ZOOKEEPER_PORT ); StringBuilder retval = new StringBuilder(); util.getXml( retval, ncs, namedCluster, metaStore, log ); assertTrue( retval.toString().contains( ZOOKEEPER_PORT ) ); assertTrue( retval.toString().contains( ZOOKEPER_HOST ) ); }
public void getXml( StringBuilder retval, NamedClusterService namedClusterService, NamedCluster namedCluster, IMetaStore metaStore, LogChannelInterface logChannelInterface ) { String namedClusterName = namedCluster.getName(); String m_zookeeperHosts = namedCluster.getZooKeeperHost(); String m_zookeeperPort = namedCluster.getZooKeeperPort(); if ( !StringUtils.isEmpty( namedClusterName ) ) { retval.append( "\n " ) .append( XMLHandler.addTagValue( CLUSTER_NAME, namedClusterName ) ); try { if ( metaStore != null && namedClusterService.contains( namedClusterName, metaStore ) ) { NamedCluster nc = namedClusterService.read( namedClusterName, metaStore ); if ( nc != null ) { m_zookeeperHosts = nc.getZooKeeperHost(); m_zookeeperPort = nc.getZooKeeperPort(); } } } catch ( MetaStoreException e ) { logChannelInterface.logDebug( e.getMessage(), e ); } } if ( !Utils.isEmpty( m_zookeeperHosts ) ) { retval.append( "\n " ).append( XMLHandler.addTagValue( ZOOKEEPER_HOSTS, m_zookeeperHosts ) ); } if ( !Utils.isEmpty( m_zookeeperPort ) ) { retval.append( "\n " ).append( XMLHandler.addTagValue( ZOOKEEPER_PORT, m_zookeeperPort ) ); } }
NamedClusterLoadSaveUtil { public void getXml( StringBuilder retval, NamedClusterService namedClusterService, NamedCluster namedCluster, IMetaStore metaStore, LogChannelInterface logChannelInterface ) { String namedClusterName = namedCluster.getName(); String m_zookeeperHosts = namedCluster.getZooKeeperHost(); String m_zookeeperPort = namedCluster.getZooKeeperPort(); if ( !StringUtils.isEmpty( namedClusterName ) ) { retval.append( "\n " ) .append( XMLHandler.addTagValue( CLUSTER_NAME, namedClusterName ) ); try { if ( metaStore != null && namedClusterService.contains( namedClusterName, metaStore ) ) { NamedCluster nc = namedClusterService.read( namedClusterName, metaStore ); if ( nc != null ) { m_zookeeperHosts = nc.getZooKeeperHost(); m_zookeeperPort = nc.getZooKeeperPort(); } } } catch ( MetaStoreException e ) { logChannelInterface.logDebug( e.getMessage(), e ); } } if ( !Utils.isEmpty( m_zookeeperHosts ) ) { retval.append( "\n " ).append( XMLHandler.addTagValue( ZOOKEEPER_HOSTS, m_zookeeperHosts ) ); } if ( !Utils.isEmpty( m_zookeeperPort ) ) { retval.append( "\n " ).append( XMLHandler.addTagValue( ZOOKEEPER_PORT, m_zookeeperPort ) ); } } }
NamedClusterLoadSaveUtil { public void getXml( StringBuilder retval, NamedClusterService namedClusterService, NamedCluster namedCluster, IMetaStore metaStore, LogChannelInterface logChannelInterface ) { String namedClusterName = namedCluster.getName(); String m_zookeeperHosts = namedCluster.getZooKeeperHost(); String m_zookeeperPort = namedCluster.getZooKeeperPort(); if ( !StringUtils.isEmpty( namedClusterName ) ) { retval.append( "\n " ) .append( XMLHandler.addTagValue( CLUSTER_NAME, namedClusterName ) ); try { if ( metaStore != null && namedClusterService.contains( namedClusterName, metaStore ) ) { NamedCluster nc = namedClusterService.read( namedClusterName, metaStore ); if ( nc != null ) { m_zookeeperHosts = nc.getZooKeeperHost(); m_zookeeperPort = nc.getZooKeeperPort(); } } } catch ( MetaStoreException e ) { logChannelInterface.logDebug( e.getMessage(), e ); } } if ( !Utils.isEmpty( m_zookeeperHosts ) ) { retval.append( "\n " ).append( XMLHandler.addTagValue( ZOOKEEPER_HOSTS, m_zookeeperHosts ) ); } if ( !Utils.isEmpty( m_zookeeperPort ) ) { retval.append( "\n " ).append( XMLHandler.addTagValue( ZOOKEEPER_PORT, m_zookeeperPort ) ); } }  }
NamedClusterLoadSaveUtil { public void getXml( StringBuilder retval, NamedClusterService namedClusterService, NamedCluster namedCluster, IMetaStore metaStore, LogChannelInterface logChannelInterface ) { String namedClusterName = namedCluster.getName(); String m_zookeeperHosts = namedCluster.getZooKeeperHost(); String m_zookeeperPort = namedCluster.getZooKeeperPort(); if ( !StringUtils.isEmpty( namedClusterName ) ) { retval.append( "\n " ) .append( XMLHandler.addTagValue( CLUSTER_NAME, namedClusterName ) ); try { if ( metaStore != null && namedClusterService.contains( namedClusterName, metaStore ) ) { NamedCluster nc = namedClusterService.read( namedClusterName, metaStore ); if ( nc != null ) { m_zookeeperHosts = nc.getZooKeeperHost(); m_zookeeperPort = nc.getZooKeeperPort(); } } } catch ( MetaStoreException e ) { logChannelInterface.logDebug( e.getMessage(), e ); } } if ( !Utils.isEmpty( m_zookeeperHosts ) ) { retval.append( "\n " ).append( XMLHandler.addTagValue( ZOOKEEPER_HOSTS, m_zookeeperHosts ) ); } if ( !Utils.isEmpty( m_zookeeperPort ) ) { retval.append( "\n " ).append( XMLHandler.addTagValue( ZOOKEEPER_PORT, m_zookeeperPort ) ); } }  NamedCluster loadClusterConfig( NamedClusterService namedClusterService, ObjectId id_jobentry, Repository rep,
                                         IMetaStore metaStore, Node entrynode,
                                         LogChannelInterface logChannelInterface ); void getXml( StringBuilder retval, NamedClusterService namedClusterService, NamedCluster namedCluster,
                      IMetaStore metaStore, LogChannelInterface logChannelInterface ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step,
                       NamedClusterService namedClusterService, NamedCluster namedCluster,
                       LogChannelInterface logChannelInterface ); }
NamedClusterLoadSaveUtil { public void getXml( StringBuilder retval, NamedClusterService namedClusterService, NamedCluster namedCluster, IMetaStore metaStore, LogChannelInterface logChannelInterface ) { String namedClusterName = namedCluster.getName(); String m_zookeeperHosts = namedCluster.getZooKeeperHost(); String m_zookeeperPort = namedCluster.getZooKeeperPort(); if ( !StringUtils.isEmpty( namedClusterName ) ) { retval.append( "\n " ) .append( XMLHandler.addTagValue( CLUSTER_NAME, namedClusterName ) ); try { if ( metaStore != null && namedClusterService.contains( namedClusterName, metaStore ) ) { NamedCluster nc = namedClusterService.read( namedClusterName, metaStore ); if ( nc != null ) { m_zookeeperHosts = nc.getZooKeeperHost(); m_zookeeperPort = nc.getZooKeeperPort(); } } } catch ( MetaStoreException e ) { logChannelInterface.logDebug( e.getMessage(), e ); } } if ( !Utils.isEmpty( m_zookeeperHosts ) ) { retval.append( "\n " ).append( XMLHandler.addTagValue( ZOOKEEPER_HOSTS, m_zookeeperHosts ) ); } if ( !Utils.isEmpty( m_zookeeperPort ) ) { retval.append( "\n " ).append( XMLHandler.addTagValue( ZOOKEEPER_PORT, m_zookeeperPort ) ); } }  NamedCluster loadClusterConfig( NamedClusterService namedClusterService, ObjectId id_jobentry, Repository rep,
                                         IMetaStore metaStore, Node entrynode,
                                         LogChannelInterface logChannelInterface ); void getXml( StringBuilder retval, NamedClusterService namedClusterService, NamedCluster namedCluster,
                      IMetaStore metaStore, LogChannelInterface logChannelInterface ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step,
                       NamedClusterService namedClusterService, NamedCluster namedCluster,
                       LogChannelInterface logChannelInterface ); static final String CLUSTER_NAME; static final String ZOOKEEPER_HOSTS; static final String ZOOKEEPER_PORT; }