public void setup()
 {
     //given
     _cache = new PartitionStateCache();
     _cachedAtCheckpointTag1 = CheckpointTag.FromPosition(1000, 900);
     _cachedAtCheckpointTag2 = CheckpointTag.FromPosition(1200, 1100);
     _cachedAtCheckpointTag3 = CheckpointTag.FromPosition(1400, 1300);
     _cache.CacheAndLockPartitionState("partition1", "data1", _cachedAtCheckpointTag1);
     _cache.CacheAndLockPartitionState("partition2", "data2", _cachedAtCheckpointTag2);
     _cache.CacheAndLockPartitionState("partition3", "data3", _cachedAtCheckpointTag3);
     // when
     _cache.Unlock(_cachedAtCheckpointTag2);
 }
 public void setup()
 {
     //given
     _cache = new PartitionStateCache();
     _cachedAtCheckpointTag1 = CheckpointTag.FromPosition(0, 1000, 900);
     _cachedAtCheckpointTag2 = CheckpointTag.FromPosition(0, 1200, 1100);
     _cachedAtCheckpointTag3 = CheckpointTag.FromPosition(0, 1400, 1300);
     _cache.CacheAndLockPartitionState(
         "partition1", new PartitionState("data1", null, _cachedAtCheckpointTag1), _cachedAtCheckpointTag1);
     _cache.CacheAndLockPartitionState(
         "partition2", new PartitionState("data2", null, _cachedAtCheckpointTag2), _cachedAtCheckpointTag2);
     _cache.CacheAndLockPartitionState(
         "partition3", new PartitionState("data3", null, _cachedAtCheckpointTag3), _cachedAtCheckpointTag3);
     // when
     _cache.Unlock(_cachedAtCheckpointTag2, forgetUnlocked: true);
 }
        public void setup()
        {
            //given
            _cache = new PartitionStateCache(10);
            _cachedAtCheckpointTag1 = CheckpointTag.FromPosition(1000, 900);
            for (var i = 0; i < 15; i++)
            {
                _cache.CacheAndLockPartitionState(
                    "partition1", "data1", CheckpointTag.FromPosition(1000 + (i * 100), 1000 + (i * 100) - 50));
            }

            _cachedAtCheckpointTag2 = CheckpointTag.FromPosition(20100, 20050);
            _cachedAtCheckpointTag3 = CheckpointTag.FromPosition(20200, 20150);
            _cache.CacheAndLockPartitionState("partition1", "data1", _cachedAtCheckpointTag1);
            _cache.CacheAndLockPartitionState("partition2", "data2", _cachedAtCheckpointTag2);
            _cache.CacheAndLockPartitionState("partition3", "data3", _cachedAtCheckpointTag3);
            // when
            _cache.Unlock(_cachedAtCheckpointTag2);
        }
        public void setup()
        {
            //given
            _cache = new PartitionStateCache(CheckpointTag.FromPosition(0, -1), 10);
            _cachedAtCheckpointTag1 = CheckpointTag.FromPosition(1000, 900);
            for (var i = 0; i < 15; i++)
            {
                CheckpointTag at = CheckpointTag.FromPosition(1000 + (i * 100), 1000 + (i * 100) - 50);
                _cache.CacheAndLockPartitionState("partition1", new PartitionState("data1", null, at), at);
            }

            _cachedAtCheckpointTag2 = CheckpointTag.FromPosition(20100, 20050);
            _cachedAtCheckpointTag3 = CheckpointTag.FromPosition(20200, 20150);
            _cache.CacheAndLockPartitionState(
                "partition1", new PartitionState("data1", null, _cachedAtCheckpointTag1), _cachedAtCheckpointTag1);
            _cache.CacheAndLockPartitionState(
                "partition2", new PartitionState("data2", null, _cachedAtCheckpointTag2), _cachedAtCheckpointTag2);
            _cache.CacheAndLockPartitionState(
                "partition3", new PartitionState("data3", null, _cachedAtCheckpointTag3), _cachedAtCheckpointTag3);
            _cache.Unlock(_cachedAtCheckpointTag2);
            // when
            _cache.Initialize();
        }
Beispiel #5
0
 public void unlock_succeeds()
 {
     _cache.Unlock(CheckpointTag.FromPosition(0, 300, 290));
 }