public virtual void SetupCluster()
        {
            SecurityUtilTestHelper.SetTokenServiceUseIp(true);
            conf.SetBoolean(DFSConfigKeys.DfsNamenodeDelegationTokenAlwaysUseKey, true);
            conf.Set(CommonConfigurationKeysPublic.HadoopSecurityAuthToLocal, "RULE:[2:$1@$0](JobTracker@.*FOO.COM)s/@.*//"
                     + "DEFAULT");
            cluster = new MiniDFSCluster.Builder(conf).NnTopology(MiniDFSNNTopology.SimpleHATopology
                                                                      ()).NumDataNodes(0).Build();
            cluster.WaitActive();
            string logicalName = HATestUtil.GetLogicalHostname(cluster);

            HATestUtil.SetFailoverConfigurations(cluster, conf, logicalName, 0);
            nn0 = cluster.GetNameNode(0);
            nn1 = cluster.GetNameNode(1);
            fs  = HATestUtil.ConfigureFailoverFs(cluster, conf);
            dfs = (DistributedFileSystem)fs;
            cluster.TransitionToActive(0);
            dtSecretManager = NameNodeAdapter.GetDtSecretManager(nn0.GetNamesystem());
        }
        /// <summary>
        /// This test also serves to test
        /// <see cref="Org.Apache.Hadoop.Hdfs.HAUtil.GetProxiesForAllNameNodesInNameservice(Org.Apache.Hadoop.Conf.Configuration, string)
        ///     "/>
        /// and
        /// <see cref="Org.Apache.Hadoop.Hdfs.DFSUtil.GetRpcAddressesForNameserviceId(Org.Apache.Hadoop.Conf.Configuration, string, string)
        ///     "/>
        /// by virtue of the fact that it wouldn't work properly if the proxies
        /// returned were not for the correct NNs.
        /// </summary>
        /// <exception cref="System.Exception"/>
        public virtual void TestIsAtLeastOneActive()
        {
            MiniDFSCluster cluster = new MiniDFSCluster.Builder(new HdfsConfiguration()).NnTopology
                                         (MiniDFSNNTopology.SimpleHATopology()).NumDataNodes(0).Build();

            try
            {
                Configuration conf = new HdfsConfiguration();
                HATestUtil.SetFailoverConfigurations(cluster, conf);
                IList <ClientProtocol> namenodes = HAUtil.GetProxiesForAllNameNodesInNameservice(conf
                                                                                                 , HATestUtil.GetLogicalHostname(cluster));
                NUnit.Framework.Assert.AreEqual(2, namenodes.Count);
                NUnit.Framework.Assert.IsFalse(HAUtil.IsAtLeastOneActive(namenodes));
                cluster.TransitionToActive(0);
                NUnit.Framework.Assert.IsTrue(HAUtil.IsAtLeastOneActive(namenodes));
                cluster.TransitionToStandby(0);
                NUnit.Framework.Assert.IsFalse(HAUtil.IsAtLeastOneActive(namenodes));
                cluster.TransitionToActive(1);
                NUnit.Framework.Assert.IsTrue(HAUtil.IsAtLeastOneActive(namenodes));
                cluster.TransitionToStandby(1);
                NUnit.Framework.Assert.IsFalse(HAUtil.IsAtLeastOneActive(namenodes));
            }
            finally
            {
                if (cluster != null)
                {
                    cluster.Shutdown();
                }
            }
        }