public virtual void TestDelegationTokenWebHdfsApi() { ((Log4JLogger)NamenodeWebHdfsMethods.Log).GetLogger().SetLevel(Level.All); string uri = WebHdfsFileSystem.Scheme + "://" + config.Get(DFSConfigKeys.DfsNamenodeHttpAddressKey ); //get file system as JobTracker UserGroupInformation ugi = UserGroupInformation.CreateUserForTesting("JobTracker" , new string[] { "user" }); WebHdfsFileSystem webhdfs = ugi.DoAs(new _PrivilegedExceptionAction_180(this, uri )); { //test addDelegationTokens(..) Credentials creds = new Credentials(); Org.Apache.Hadoop.Security.Token.Token <object>[] tokens = webhdfs.AddDelegationTokens ("JobTracker", creds); NUnit.Framework.Assert.AreEqual(1, tokens.Length); NUnit.Framework.Assert.AreEqual(1, creds.NumberOfTokens()); NUnit.Framework.Assert.AreSame(tokens[0], creds.GetAllTokens().GetEnumerator().Next ()); CheckTokenIdentifier(ugi, tokens[0]); Org.Apache.Hadoop.Security.Token.Token <object>[] tokens2 = webhdfs.AddDelegationTokens ("JobTracker", creds); NUnit.Framework.Assert.AreEqual(0, tokens2.Length); } }