예제 #1
0
        public virtual void TestSecureHAToken()
        {
            Configuration conf = DFSTestUtil.NewHAConfiguration(LogicalName);

            conf.SetBoolean(DFSConfigKeys.DfsNamenodeDelegationTokenAlwaysUseKey, true);
            MiniDFSCluster    cluster = null;
            WebHdfsFileSystem fs      = null;

            try
            {
                cluster = new MiniDFSCluster.Builder(conf).NnTopology(topo).NumDataNodes(0).Build
                              ();
                HATestUtil.SetFailoverConfigurations(cluster, conf, LogicalName);
                cluster.WaitActive();
                fs = Org.Mockito.Mockito.Spy((WebHdfsFileSystem)FileSystem.Get(WebhdfsUri, conf));
                FileSystemTestHelper.AddFileSystemForTesting(WebhdfsUri, conf, fs);
                cluster.TransitionToActive(0);
                Org.Apache.Hadoop.Security.Token.Token <object> token = ((Org.Apache.Hadoop.Security.Token.Token
                                                                          <DelegationTokenIdentifier>)fs.GetDelegationToken(null));
                cluster.ShutdownNameNode(0);
                cluster.TransitionToActive(1);
                token.Renew(conf);
                token.Cancel(conf);
                Org.Mockito.Mockito.Verify(fs).RenewDelegationToken(token);
                Org.Mockito.Mockito.Verify(fs).CancelDelegationToken(token);
            }
            finally
            {
                IOUtils.Cleanup(null, fs);
                if (cluster != null)
                {
                    cluster.Shutdown();
                }
            }
        }
예제 #2
0
 public virtual void CancelDelegationToken(Org.Apache.Hadoop.Security.Token.Token <
                                               DelegationTokenIdentifier> token)
 {
     token.Cancel(GetConf());
 }