Ejemplo n.º 1
0
        /// <exception cref="System.Exception"/>
        public virtual void TestContentSummaryWithoutStoragePolicy()
        {
            Path foo          = new Path(dir, "foo");
            Path createdFile1 = new Path(foo, "created_file1.data");

            dfs.Mkdirs(foo);
            INode fnode = fsdir.GetINode4Write(foo.ToString());

            NUnit.Framework.Assert.IsTrue(fnode.IsDirectory());
            NUnit.Framework.Assert.IsTrue(!fnode.IsQuotaSet());
            // Create file of size 2 * BLOCKSIZE under directory "foo"
            long file1Len = Blocksize * 2;
            int  bufLen   = Blocksize / 16;

            DFSTestUtil.CreateFile(dfs, createdFile1, bufLen, file1Len, Blocksize, Replication
                                   , seed);
            // Verify getContentSummary without any quota set
            // Expect no type quota and usage information available
            ContentSummary cs = dfs.GetContentSummary(foo);

            NUnit.Framework.Assert.AreEqual(cs.GetSpaceConsumed(), file1Len * Replication);
            foreach (StorageType t in StorageType.Values())
            {
                NUnit.Framework.Assert.AreEqual(cs.GetTypeConsumed(t), 0);
                NUnit.Framework.Assert.AreEqual(cs.GetTypeQuota(t), -1);
            }
        }