Exemplo n.º 1
0
        public void TestModifyAcl()
        {
            SemModifyAcl.WaitOne();
            if (_modifyAclRun)
            {
                SemModifyAcl.Release();
                return;
            }
            List <AclEntry> aclEntries1 = GetAclEntryForModifyAndRemove();
            var             aclStats    = AclProcessor.RunAclProcessor(UnitTestPath + "/B0", _adlsClient, aclEntries1,
                                                                       RequestedAclType.ModifyAcl, 25);
            var aclVerifyStats =
                AclProcessor.RunAclVerifier(UnitTestPath + "/B0", _adlsClient, aclEntries1, RequestedAclType.ModifyAcl, 25);

            Assert.IsTrue(aclStats.FilesProcessed == aclVerifyStats.FilesProcessed);
            Assert.IsTrue(aclStats.DirectoryProcessed == aclVerifyStats.DirectoryProcessed);
            Assert.IsTrue(aclStats.FilesProcessed == aclVerifyStats.FilesCorrect);
            Assert.IsTrue(aclStats.DirectoryProcessed == aclVerifyStats.DirectoriesCorrect);
            _modifyAclRun = true;
            SemModifyAcl.Release();
        }
Exemplo n.º 2
0
        public void TestSetAclVerification()
        {
            string          path        = UnitTestPath + "/B2";
            List <AclEntry> aclEntries1 = GetAclEntryForModifyAndRemove();

            GetExpectedOutput(_oneLevelDirCount, _oneLevelFileCnt, _recurseLevel - 1, _oneFileSize, out var expectedFileCount, out var expectedDirCount, out var expectedFileSize);
            expectedDirCount += 1;
            var status = AclProcessor.RunAclVerifier(path, _adlsClient, aclEntries1, RequestedAclType.ModifyAcl, 25);

            Assert.IsTrue(status.FilesProcessed == expectedFileCount);
            Assert.IsTrue(status.DirectoryProcessed == expectedDirCount);
            Assert.IsTrue(status.IncorrectFileCount == expectedFileCount);
            Assert.IsTrue(status.IncorrectDirectoryCount == expectedDirCount);
            _adlsClient.ModifyAclEntries(path, aclEntries1);
            status = AclProcessor.RunAclVerifier(path, _adlsClient, aclEntries1, RequestedAclType.ModifyAcl, 25);
            Assert.IsTrue(status.FilesProcessed == expectedFileCount);
            Assert.IsTrue(status.DirectoryProcessed == expectedDirCount);
            Assert.IsTrue(status.IncorrectFileCount == expectedFileCount);
            Assert.IsTrue(status.IncorrectDirectoryCount == expectedDirCount - 1);

            var aclStats = AclProcessor.RunAclProcessor(UnitTestPath + "/B2/C0", _adlsClient, aclEntries1, RequestedAclType.ModifyAcl, 25);

            GetExpectedOutput(_oneLevelDirCount, _oneLevelFileCnt, _recurseLevel - 2, _oneFileSize, out var expectedFileCountSub, out var expectedDirCountSub, out var expectedFileSizeSub);
            expectedDirCountSub += 1;

            status = AclProcessor.RunAclVerifier(path, _adlsClient, aclEntries1, RequestedAclType.ModifyAcl, 25, LocalPath + @"\verificationfile");
            Assert.IsTrue(status.FilesProcessed == expectedFileCount);
            Assert.IsTrue(status.DirectoryProcessed == expectedDirCount);
            Assert.IsTrue(status.IncorrectFileCount == expectedFileCount - expectedFileCountSub);
            Assert.IsTrue(status.IncorrectDirectoryCount == expectedDirCount - 1 - expectedDirCountSub);

            AclProcessor.RunAclProcessor(UnitTestPath + "/B2/C1", _adlsClient, aclEntries1, RequestedAclType.ModifyAcl, 25);

            status = AclProcessor.RunAclVerifier(path, _adlsClient, aclEntries1, RequestedAclType.ModifyAcl, 25, LocalPath + @"\verificationfile1");
            Assert.IsTrue(status.FilesProcessed == expectedFileCount);
            Assert.IsTrue(status.DirectoryProcessed == expectedDirCount);
            Assert.IsTrue(status.IncorrectFileCount == expectedFileCount - 2 * expectedFileCountSub);
            Assert.IsTrue(status.IncorrectDirectoryCount == expectedDirCount - 1 - 2 * expectedDirCountSub);
        }