예제 #1
0
        public async Task TableStore()
        {
            var tableStore = new OdinTableStore("table1", "partition1");

            tableStore.CreateTable().Wait();
            await OdinTests.BasicOperations(tableStore);
        }
예제 #2
0
        public async Task TestLoadBalancer()
        {
            var store    = new OdinMemoryStore();
            var counter1 = new Counter(store);
            var counter2 = new Counter(store);

            var loadBalancer = new LoadBalancer(LoadBalancer.Strategy.RoundRobin, counter1, counter2);
            await OdinTests.BasicOperations(loadBalancer);

            Assert.AreNotSame(0, counter1.PutCount);
            Assert.AreNotSame(0, counter2.PutCount);
        }
예제 #3
0
        public async Task TestFanOut()
        {
            var store1 = new OdinMemoryStore();
            var store2 = new OdinMemoryStore();

            var fanOut = new FanOut(store1, store2);
            await OdinTests.BasicOperations(fanOut);

            await fanOut.Put("X", "X");

            Assert.AreEqual("X", await store1.Get("X"));
            Assert.AreEqual("X", await store2.Get("X"));
        }
예제 #4
0
        public async Task TestCounter()
        {
            var store   = new OdinMemoryStore();
            var counter = new Counter(store);

            Assert.AreEqual(0, counter.PutCount);
            await counter.Put("x", "y");

            Assert.AreEqual(1, counter.PutCount);

            Assert.AreEqual(0, counter.DeleteCount);
            await counter.Delete("x");

            Assert.AreEqual(1, counter.DeleteCount);

            await OdinTests.BasicOperations(counter);
        }
예제 #5
0
        // this looks broken
        //[TestMethod]
        public async Task TestRetry()
        {
            var counter = new Counter(null);
            var retry   = new Retry(counter);

            try
            {
                await retry.Put("foo", "bar");
            }
            catch { }
            Assert.AreEqual(5, counter.PutCount);

            var odin = new OdinMemoryStore();

            retry = new Retry(odin);
            await OdinTests.BasicOperations(retry);
        }
예제 #6
0
        public async Task TestSubSubLevel()
        {
            var odin     = new OdinMemoryStore();
            var fooLevel = new Partition(odin, "foo");

            await fooLevel.Put("x", "x");

            var barLevel = fooLevel.CreateSubPartition("bar");
            await OdinTests.BasicOperations(barLevel);

            await barLevel.Put("y", "y");

            Assert.IsNull(await barLevel.Get("x"));
            Assert.IsNull(await fooLevel.Get("y"));

            await barLevel.Delete("y");

            await fooLevel.Delete("x");
        }
예제 #7
0
        public async Task TestVersioner()
        {
            var odin      = new OdinMemoryStore();
            var versioner = new OdinVersioner(odin);

            await versioner.Put("foo", "bar");

            var versions = (await versioner.GetVersions("foo")).ToArray();

            Assert.AreEqual(1, versions.Length);
            Assert.AreEqual("bar", versions[0].Value);

            // allow a few ticks to pass
            Thread.Sleep(10);

            await versioner.Put("foo", "baz");

            versions = (await versioner.GetVersions("foo")).ToArray();
            Assert.AreEqual(2, versions.Length);
            Assert.AreEqual("baz", versions[1].Value);
            Assert.AreEqual("bar", versions[0].Value);

            await OdinTests.BasicOperations(versioner);
        }
예제 #8
0
 public async Task RedisStore()
 {
     var redisStore = new OdinRedisStore();
     await OdinTests.BasicOperations(redisStore);
 }
예제 #9
0
 public async Task FileStore()
 {
     var fileStore = new OdinFileStore(@"c:\test");
     await OdinTests.BasicOperations(fileStore);
 }
예제 #10
0
 public async Task MemoryStore()
 {
     var tableStore = new OdinMemoryStore();
     await OdinTests.BasicOperations(tableStore);
 }
예제 #11
0
 public async Task TestCache()
 {
     var odin  = new OdinMemoryStore();
     var cache = new OdinCache(odin, TimeSpan.FromMinutes(1));
     await OdinTests.BasicOperations(cache);
 }
예제 #12
0
 public async Task TestSubLevel()
 {
     var odin     = new OdinMemoryStore();
     var subLevel = new Partition(odin, "foo");
     await OdinTests.BasicOperations(subLevel);
 }
예제 #13
0
 public async Task TestTracer()
 {
     var odin   = new OdinMemoryStore();
     var tracer = new OdinTracer(odin);
     await OdinTests.BasicOperations(tracer);
 }