public virtual void TestACLs()
        {
            DelegationTokenManager tm1;
            string        connectString = zkServer.GetConnectString();
            Configuration conf          = GetSecretConf(connectString);
            RetryPolicy   retryPolicy   = new ExponentialBackoffRetry(1000, 3);
            string        userPass      = "******";
            ACL           digestACL     = new ACL(ZooDefs.Perms.All, new ID("digest", DigestAuthenticationProvider
                                                                            .GenerateDigest(userPass)));
            ACLProvider      digestAclProvider = new _ACLProvider_319(digestACL);
            CuratorFramework curatorFramework  = CuratorFrameworkFactory.Builder().ConnectString
                                                     (connectString).RetryPolicy(retryPolicy).AclProvider(digestAclProvider).Authorization
                                                     ("digest", Runtime.GetBytesForString(userPass, "UTF-8")).Build();

            curatorFramework.Start();
            ZKDelegationTokenSecretManager.SetCurator(curatorFramework);
            tm1 = new DelegationTokenManager(conf, new Text("bla"));
            tm1.Init();
            // check ACL
            string workingPath = conf.Get(ZKDelegationTokenSecretManager.ZkDtsmZnodeWorkingPath
                                          );

            VerifyACL(curatorFramework, "/" + workingPath, digestACL);
            tm1.Destroy();
            ZKDelegationTokenSecretManager.SetCurator(null);
            curatorFramework.Close();
        }
        public virtual void TestStopThreads()
        {
            DelegationTokenManager tm1 = null;
            string connectString       = zkServer.GetConnectString();
            // let's make the update interval short and the shutdown interval
            // comparatively longer, so if the update thread runs after shutdown,
            // it will cause an error.
            long          updateIntervalSeconds = 1;
            long          shutdownTimeoutMillis = updateIntervalSeconds * 1000 * 5;
            Configuration conf = GetSecretConf(connectString);

            conf.SetLong(DelegationTokenManager.UpdateInterval, updateIntervalSeconds);
            conf.SetLong(DelegationTokenManager.RemovalScanInterval, updateIntervalSeconds);
            conf.SetLong(DelegationTokenManager.RenewInterval, updateIntervalSeconds);
            conf.SetLong(ZKDelegationTokenSecretManager.ZkDtsmZkShutdownTimeout, shutdownTimeoutMillis
                         );
            tm1 = new DelegationTokenManager(conf, new Text("foo"));
            tm1.Init();
            Org.Apache.Hadoop.Security.Token.Token <DelegationTokenIdentifier> token = (Org.Apache.Hadoop.Security.Token.Token
                                                                                        <DelegationTokenIdentifier>)tm1.CreateToken(UserGroupInformation.GetCurrentUser(
                                                                                                                                        ), "foo");
            NUnit.Framework.Assert.IsNotNull(token);
            AbstractDelegationTokenSecretManager sm   = tm1.GetDelegationTokenSecretManager();
            ZKDelegationTokenSecretManager       zksm = (ZKDelegationTokenSecretManager)sm;
            ExecutorService es = zksm.GetListenerThreadPool();

            es.Submit(new _Callable_300(shutdownTimeoutMillis));
            // force this to be shutdownNow
            tm1.Destroy();
        }
        /// <exception cref="System.Exception"/>
        protected internal virtual void VerifyDestroy(DelegationTokenManager tm, Configuration
                                                      conf)
        {
            AbstractDelegationTokenSecretManager sm   = tm.GetDelegationTokenSecretManager();
            ZKDelegationTokenSecretManager       zksm = (ZKDelegationTokenSecretManager)sm;
            ExecutorService es = zksm.GetListenerThreadPool();

            tm.Destroy();
            Assert.True(es.IsShutdown());
            // wait for the pool to terminate
            long timeout = conf.GetLong(ZKDelegationTokenSecretManager.ZkDtsmZkShutdownTimeout
                                        , ZKDelegationTokenSecretManager.ZkDtsmZkShutdownTimeoutDefault);

            Thread.Sleep(timeout * 3);
            Assert.True(es.IsTerminated());
        }
 public _PathChildrenCacheListener_368(ZKDelegationTokenSecretManager <TokenIdent>
                                       _enclosing)
 {
     this._enclosing = _enclosing;
 }