Example #1
0
        public void TestCreateWithSameNameAfterDestroyClearsOldData(
            [Values(CacheTestMode.ServerLocal, CacheTestMode.ServerRemote, CacheTestMode.Client)] CacheTestMode mode)
        {
            var cfg = new CacheConfiguration
            {
                Name = TestUtils.TestName + mode,
                NearConfiguration          = new NearCacheConfiguration(),
                PlatformCacheConfiguration = new PlatformCacheConfiguration()
            };

            var ignite = GetIgnite(mode);

            var cache = ignite.CreateCache <int, int>(cfg, new NearCacheConfiguration());

            cache[1] = 1;
            ignite.DestroyCache(cache.Name);

            cache = ignite.CreateCache <int, int>(cfg, new NearCacheConfiguration());
            Assert.AreEqual(0, cache.GetLocalSize(CachePeekMode.Platform));
        }
Example #2
0
        public void TestDestroyCacheClearsPlatformCacheData(
            [Values(CacheTestMode.ServerLocal, CacheTestMode.ServerRemote, CacheTestMode.Client)] CacheTestMode mode)
        {
            var cfg = new CacheConfiguration
            {
                Name = TestUtils.TestName + mode,
                NearConfiguration          = new NearCacheConfiguration(),
                PlatformCacheConfiguration = new PlatformCacheConfiguration()
            };

            var ignite = GetIgnite(mode);

            var cache = ignite.CreateCache <int, int>(cfg, new NearCacheConfiguration());

            cache[1] = 1;
            ignite.DestroyCache(cache.Name);

            var ex = Assert.Throws <InvalidOperationException>(() => cache.Get(1));

            StringAssert.EndsWith(
                "Failed to perform cache operation (cache is stopped): " + cache.Name,
                ex.Message);
        }
Example #3
0
 /// <summary>
 /// Gets Ignite instance for mode.
 /// </summary>
 private IIgnite GetIgnite(CacheTestMode mode)
 {
     return(new[] { _grid, _grid2, _client }[(int)mode]);
 }