Example #1
0
        /// <exception cref="System.Exception"/>
        public virtual void TestEquals()
        {
            UserGroupInformation uugi = UserGroupInformation.CreateUserForTesting(UserName, GroupNames
                                                                                  );

            Assert.Equal(uugi, uugi);
            // The subjects should be different, so this should fail
            UserGroupInformation ugi2 = UserGroupInformation.CreateUserForTesting(UserName, GroupNames
                                                                                  );

            NUnit.Framework.Assert.IsFalse(uugi.Equals(ugi2));
            NUnit.Framework.Assert.IsFalse(uugi.GetHashCode() == ugi2.GetHashCode());
            // two ugi that have the same subject need to be equal
            UserGroupInformation ugi3 = new UserGroupInformation(uugi.GetSubject());

            Assert.Equal(uugi, ugi3);
            Assert.Equal(uugi.GetHashCode(), ugi3.GetHashCode());
        }
Example #2
0
 public override int GetHashCode()
 {
     return(authority.GetHashCode() ^ ugi.GetHashCode());
 }