Exemple #1
0
        public override void TearDown()
        {
            base.TearDown();
            WindowCacheConfig windowCacheConfig = new WindowCacheConfig();

            WindowCache.Reconfigure(windowCacheConfig);
        }
Exemple #2
0
        private static void WhackCache()
        {
            WindowCacheConfig config = new WindowCacheConfig();

            config.SetPackedGitOpenFiles(1);
            WindowCache.Reconfigure(config);
        }
Exemple #3
0
        public override void SetUp()
        {
            WindowCacheConfig windowCacheConfig = new WindowCacheConfig();

            windowCacheConfig.SetPackedGitOpenFiles(1);
            WindowCache.Reconfigure(windowCacheConfig);
            base.SetUp();
        }
Exemple #4
0
 public override void TearDown()
 {
     if (wc != null)
     {
         wc.Release();
     }
     WindowCache.Reconfigure(new WindowCacheConfig());
     base.TearDown();
 }
        public virtual void TestCache_TooFewFiles()
        {
            WindowCacheConfig cfg = new WindowCacheConfig();

            cfg.SetPackedGitOpenFiles(2);
            WindowCache.Reconfigure(cfg);
            DoCacheTests();
            CheckLimits(cfg);
        }
Exemple #6
0
        public override void SetUp()
        {
            base.SetUp();
            WindowCacheConfig cfg = new WindowCacheConfig();

            cfg.SetStreamFileThreshold(streamThreshold);
            WindowCache.Reconfigure(cfg);
            repo = CreateBareRepository();
            wc   = (WindowCursor)repo.NewObjectReader();
        }
        public virtual void TestCache_TooSmallLimit()
        {
            WindowCacheConfig cfg = new WindowCacheConfig();

            cfg.SetPackedGitWindowSize(4096);
            cfg.SetPackedGitLimit(4096);
            WindowCache.Reconfigure(cfg);
            DoCacheTests();
            CheckLimits(cfg);
        }
        public virtual void TestCache_Defaults()
        {
            WindowCacheConfig cfg = new WindowCacheConfig();

            WindowCache.Reconfigure(cfg);
            DoCacheTests();
            CheckLimits(cfg);
            WindowCache cache = WindowCache.GetInstance();

            NUnit.Framework.Assert.AreEqual(6, cache.GetOpenFiles());
            NUnit.Framework.Assert.AreEqual(17346, cache.GetOpenBytes());
        }
Exemple #9
0
 public virtual void TestConfigureCache_PackedGitLimit_0()
 {
     try
     {
         WindowCacheConfig cfg = new WindowCacheConfig();
         cfg.SetPackedGitLimit(0);
         WindowCache.Reconfigure(cfg);
         NUnit.Framework.Assert.Fail("incorrectly permitted PackedGitLimit = 0");
     }
     catch (ArgumentException)
     {
     }
 }
Exemple #10
0
        public virtual void TestConfigureCache_Limits1()
        {
            // This test is just to force coverage over some lower bounds for
            // the table. We don't want the table to wind up with too small
            // of a size. This is highly dependent upon the table allocation
            // algorithm actually implemented in WindowCache.
            //
            WindowCacheConfig cfg = new WindowCacheConfig();

            cfg.SetPackedGitLimit(6 * 4096 / 5);
            cfg.SetPackedGitWindowSize(4096);
            WindowCache.Reconfigure(cfg);
        }
Exemple #11
0
 public virtual void TestConfigureCache_PackedGitWindowSize_512()
 {
     try
     {
         WindowCacheConfig cfg = new WindowCacheConfig();
         cfg.SetPackedGitWindowSize(512);
         WindowCache.Reconfigure(cfg);
         NUnit.Framework.Assert.Fail("incorrectly permitted PackedGitWindowSize = 512");
     }
     catch (ArgumentException e)
     {
         NUnit.Framework.Assert.AreEqual("Invalid window size", e.Message);
     }
 }
Exemple #12
0
 public virtual void TestConfigureCache_PackedGitOpenFiles_0()
 {
     try
     {
         WindowCacheConfig cfg = new WindowCacheConfig();
         cfg.SetPackedGitOpenFiles(0);
         WindowCache.Reconfigure(cfg);
         NUnit.Framework.Assert.Fail("incorrectly permitted PackedGitOpenFiles = 0");
     }
     catch (ArgumentException e)
     {
         NUnit.Framework.Assert.AreEqual("Open files must be >= 1", e.Message);
     }
 }
Exemple #13
0
 public virtual void TestConfigureCache_PackedGitWindowSize_4097()
 {
     try
     {
         WindowCacheConfig cfg = new WindowCacheConfig();
         cfg.SetPackedGitWindowSize(4097);
         WindowCache.Reconfigure(cfg);
         NUnit.Framework.Assert.Fail("incorrectly permitted PackedGitWindowSize = 4097");
     }
     catch (ArgumentException e)
     {
         NUnit.Framework.Assert.AreEqual("Window size must be power of 2", e.Message);
     }
 }
Exemple #14
0
 public virtual void TestConfigureCache_PackedGitWindowSizeAbovePackedGitLimit()
 {
     try
     {
         WindowCacheConfig cfg = new WindowCacheConfig();
         cfg.SetPackedGitLimit(1024);
         cfg.SetPackedGitWindowSize(8192);
         WindowCache.Reconfigure(cfg);
         NUnit.Framework.Assert.Fail("incorrectly permitted PackedGitWindowSize > PackedGitLimit"
                                     );
     }
     catch (ArgumentException e)
     {
         NUnit.Framework.Assert.AreEqual("Window size must be < limit", e.Message);
     }
 }