Пример #1
0
        public virtual void TestAclEntryProto()
        {
            // All fields populated.
            AclEntry e1 = new AclEntry.Builder().SetName("test").SetPermission(FsAction.ReadExecute
                                                                               ).SetScope(AclEntryScope.Default).SetType(AclEntryType.Other).Build();
            // No name.
            AclEntry e2 = new AclEntry.Builder().SetScope(AclEntryScope.Access).SetType(AclEntryType
                                                                                        .User).SetPermission(FsAction.All).Build();
            // No permission, which will default to the 0'th enum element.
            AclEntry e3 = new AclEntry.Builder().SetScope(AclEntryScope.Access).SetType(AclEntryType
                                                                                        .User).SetName("test").Build();

            AclEntry[] expected = new AclEntry[] { e1, e2, new AclEntry.Builder().SetScope(e3
                                                                                           .GetScope()).SetType(e3.GetType()).SetName(e3.GetName()).SetPermission(FsAction.
                                                                                                                                                                  None).Build() };
            AclEntry[] actual = Sharpen.Collections.ToArray(Lists.NewArrayList(PBHelper.ConvertAclEntry
                                                                                   (PBHelper.ConvertAclEntryProto(Lists.NewArrayList(e1, e2, e3)))), new AclEntry[0
                                                            ]);
            Assert.AssertArrayEquals(expected, actual);
        }