コード例 #1
0
 public virtual void TestMultiNodeOperations()
 {
     for (int i = 0; i < TestRetries; i++)
     {
         DelegationTokenManager tm1;
         DelegationTokenManager tm2  = null;
         string        connectString = zkServer.GetConnectString();
         Configuration conf          = GetSecretConf(connectString);
         tm1 = new DelegationTokenManager(conf, new Text("bla"));
         tm1.Init();
         tm2 = new DelegationTokenManager(conf, new Text("bla"));
         tm2.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);
         tm2.VerifyToken(token);
         tm2.RenewToken(token, "foo");
         tm1.VerifyToken(token);
         tm1.CancelToken(token, "foo");
         try
         {
             VerifyTokenFail(tm2, token);
             NUnit.Framework.Assert.Fail("Expected InvalidToken");
         }
         catch (SecretManager.InvalidToken)
         {
         }
         // Ignore
         token = (Org.Apache.Hadoop.Security.Token.Token <DelegationTokenIdentifier>)tm2.CreateToken
                     (UserGroupInformation.GetCurrentUser(), "bar");
         NUnit.Framework.Assert.IsNotNull(token);
         tm1.VerifyToken(token);
         tm1.RenewToken(token, "bar");
         tm2.VerifyToken(token);
         tm2.CancelToken(token, "bar");
         try
         {
             VerifyTokenFail(tm1, token);
             NUnit.Framework.Assert.Fail("Expected InvalidToken");
         }
         catch (SecretManager.InvalidToken)
         {
         }
         // Ignore
         VerifyDestroy(tm1, conf);
         VerifyDestroy(tm2, conf);
     }
 }
コード例 #2
0
 public virtual void TestRenewTokenSingleManager()
 {
     for (int i = 0; i < TestRetries; i++)
     {
         DelegationTokenManager tm1  = null;
         string        connectString = zkServer.GetConnectString();
         Configuration conf          = GetSecretConf(connectString);
         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);
         tm1.RenewToken(token, "foo");
         tm1.VerifyToken(token);
         VerifyDestroy(tm1, conf);
     }
 }