Пример #1
0
        public virtual void TestGetInvalidateBlocks()
        {
            int MaxBlocks                = 10;
            int RemainingBlocks          = 2;
            int MaxLimit                 = MaxBlocks - RemainingBlocks;
            DatanodeDescriptor dd        = DFSTestUtil.GetLocalDatanodeDescriptor();
            AList <Block>      blockList = new AList <Block>(MaxBlocks);

            for (int i = 0; i < MaxBlocks; i++)
            {
                blockList.AddItem(new Block(i, 0, GenerationStamp.LastReservedStamp));
            }
            dd.AddBlocksToBeInvalidated(blockList);
            Block[] bc = dd.GetInvalidateBlocks(MaxLimit);
            NUnit.Framework.Assert.AreEqual(bc.Length, MaxLimit);
            bc = dd.GetInvalidateBlocks(MaxLimit);
            NUnit.Framework.Assert.AreEqual(bc.Length, RemainingBlocks);
        }