Esempio n. 1
0
        public virtual void TestKerberosRulesValid()
        {
            NUnit.Framework.Assert.IsTrue("!KerberosName.hasRulesBeenSet()", KerberosName.HasRulesBeenSet
                                              ());
            string rules = KerberosName.GetRules();

            NUnit.Framework.Assert.AreEqual(kerberosRule, rules);
            Log.Info(rules);
        }
Esempio n. 2
0
        /// <exception cref="System.IO.IOException"/>
        public virtual void TestEnsureInitWithRules()
        {
            string rules = "RULE:[1:RULE1]";

            // trigger implicit init, rules should init
            UserGroupInformation.Reset();
            NUnit.Framework.Assert.IsFalse(KerberosName.HasRulesBeenSet());
            UserGroupInformation.CreateUserForTesting("someone", new string[0]);
            Assert.True(KerberosName.HasRulesBeenSet());
            // set a rule, trigger implicit init, rule should not change
            UserGroupInformation.Reset();
            KerberosName.SetRules(rules);
            Assert.True(KerberosName.HasRulesBeenSet());
            Assert.Equal(rules, KerberosName.GetRules());
            UserGroupInformation.CreateUserForTesting("someone", new string[0]);
            Assert.Equal(rules, KerberosName.GetRules());
        }
Esempio n. 3
0
 public virtual void TestSetConfigWithRules()
 {
     string[] rules = new string[] { "RULE:[1:TEST1]", "RULE:[1:TEST2]", "RULE:[1:TEST3]" };
     // explicitly set a rule
     UserGroupInformation.Reset();
     NUnit.Framework.Assert.IsFalse(KerberosName.HasRulesBeenSet());
     KerberosName.SetRules(rules[0]);
     Assert.True(KerberosName.HasRulesBeenSet());
     Assert.Equal(rules[0], KerberosName.GetRules());
     // implicit init should honor rules already being set
     UserGroupInformation.CreateUserForTesting("someone", new string[0]);
     Assert.Equal(rules[0], KerberosName.GetRules());
     // set conf, should override
     conf.Set(CommonConfigurationKeysPublic.HadoopSecurityAuthToLocal, rules[1]);
     UserGroupInformation.SetConfiguration(conf);
     Assert.Equal(rules[1], KerberosName.GetRules());
     // set conf, should again override
     conf.Set(CommonConfigurationKeysPublic.HadoopSecurityAuthToLocal, rules[2]);
     UserGroupInformation.SetConfiguration(conf);
     Assert.Equal(rules[2], KerberosName.GetRules());
     // implicit init should honor rules already being set
     UserGroupInformation.CreateUserForTesting("someone", new string[0]);
     Assert.Equal(rules[2], KerberosName.GetRules());
 }