Beispiel #1
0
        public virtual void SetupCluster()
        {
            // must configure prior to instantiating the namesystem because it
            // will reconfigure the logger if async is enabled
            ConfigureAuditLogs();
            conf = new HdfsConfiguration();
            long precision = 1L;

            conf.SetLong(DFSConfigKeys.DfsNamenodeAccesstimePrecisionKey, precision);
            conf.SetLong(DFSConfigKeys.DfsBlockreportIntervalMsecKey, 10000L);
            conf.SetBoolean(DFSConfigKeys.DfsWebhdfsEnabledKey, true);
            conf.SetBoolean(DFSConfigKeys.DfsNamenodeAuditLogAsyncKey, useAsyncLog);
            util = new DFSTestUtil.Builder().SetName("TestAuditAllowed").SetNumFiles(20).Build
                       ();
            cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(4).Build();
            fs      = cluster.GetFileSystem();
            util.CreateFiles(fs, fileName);
            // make sure the appender is what it's supposed to be
            Logger           logger    = ((Log4JLogger)FSNamesystem.auditLog).GetLogger();
            IList <Appender> appenders = Sharpen.Collections.List(logger.GetAllAppenders());

            NUnit.Framework.Assert.AreEqual(1, appenders.Count);
            NUnit.Framework.Assert.AreEqual(useAsyncLog, appenders[0] is AsyncAppender);
            fnames = util.GetFileNames(fileName);
            util.WaitReplication(fs, fileName, (short)3);
            userGroupInfo = UserGroupInformation.CreateUserForTesting(username, groups);
        }