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 given() { //given _cache = new PartitionStateCache(CheckpointTag.FromPosition(0, -1)); _cachedAtCheckpointTag = CheckpointTag.FromPosition(1000, 900); _cache.CacheAndLockPartitionState("partition", new PartitionState("data", null, _cachedAtCheckpointTag), _cachedAtCheckpointTag); }
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 no_other_partition_states_can_be_locked_before_the_unlock_position() { Assert.Throws <InvalidOperationException>(() => { CheckpointTag at = CheckpointTag.FromPosition(0, 1040, 1030); _cache.CacheAndLockPartitionState("partition4", new PartitionState("data4", null, at), at); }); }
public void when() { _cache = new PartitionStateCache(); _cachedAtCheckpointTag = CheckpointTag.FromPosition(0, 1000, 900); _cache.CacheAndLockPartitionState("partition", new PartitionState("data", null, _cachedAtCheckpointTag), _cachedAtCheckpointTag); }
public void given() { //given _cache = new PartitionStateCache(); _cachedAtCheckpointTag = CheckpointTag.FromPosition(1000, 900); _cache.CacheAndLockPartitionState("partition", new PartitionStateCache.State("data", _cachedAtCheckpointTag), _cachedAtCheckpointTag); _relockedData = _cache.TryGetAndLockPartitionState("partition", CheckpointTag.FromPosition(2000, 1900)); }
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(); }
public void state_can_be_cached() { CheckpointTag at = CheckpointTag.FromPosition(0, 100, 90); _cache.CacheAndLockPartitionState("partition", new PartitionState("data", null, at), at); }
public void no_other_partition_states_can_be_locked_before_the_unlock_position() { _cache.CacheAndLockPartitionState("partition4", "data4", CheckpointTag.FromPosition(1040, 1030)); }
public void no_other_partition_states_can_be_locked_before_the_unlock_position() { CheckpointTag at = CheckpointTag.FromPosition(0, 1040, 1030); _cache.CacheAndLockPartitionState("partition4", new PartitionState("data4", null, at), at); }
public void state_can_be_cached() { _cache.CacheAndLockPartitionState("partition", "data", CheckpointTag.FromPosition(100, 90)); }