Exemple #1
0
        public void Sharding_Always_ShouldReadAllData()
        {
            var client = new SimpleStorageClient(endpoint1);
            var items  = new List <KeyValuePair <string, Value> >();

            for (var i = 0; i < 100; i++)
            {
                var id    = Guid.NewGuid().ToString();
                var value = new Value {
                    Content = "content"
                };
                items.Add(new KeyValuePair <string, Value>(id, value));
                client.Put(id, value);
            }

            foreach (var item in items)
            {
                foreach (var endpoint in new[] { endpoint1, endpoint2, endpoint3 })
                {
                    var actual = new SimpleStorageClient(endpoint).Get(item.Key);
                    Assert.That(actual.Content, Is.EqualTo(item.Value.Content));
                    Assert.That(actual.IsDeleted, Is.EqualTo(item.Value.IsDeleted));
                    Assert.That(actual.Revision, Is.EqualTo(item.Value.Revision));
                }
            }
        }
Exemple #2
0
 public override void SetUp()
 {
     base.SetUp();
     fullTopologyClient = new SimpleStorageClient(replica1Endpoint, replica2Endpoint, replica3Endpoint);
     using (var httpClient = new HttpClient())
     {
         ActionOnReplica(replica1Endpoint, httpClient, "start");
         ActionOnReplica(replica2Endpoint, httpClient, "start");
         ActionOnReplica(replica3Endpoint, httpClient, "start");
     }
 }
        public override void SetUp()
        {
            base.SetUp();
            client = new SimpleStorageClient(endpoint);

            var topology      = new Topology(new int[0]);
            var configuration = new Configuration(topology)
            {
                CurrentNodePort = port, OtherShardsPorts = new int[0]
            };

            container.Configure(c => c.For <IConfiguration>().Use(configuration));
        }
Exemple #4
0
        public void SetUp()
        {
            client = new SimpleStorageClient(endpoints);

            using (var httpClient = new HttpClient())
                foreach (var endpoint in endpoints)
                {
                    using (var response =
                               httpClient.PostAsync(endpoint + "api/admin/removeAllData", new ByteArrayContent(new byte[0]))
                               .Result)
                        Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.NoContent));
                }
        }
Exemple #5
0
 public override void SetUp()
 {
     base.SetUp();
     masterClient       = new SimpleStorageClient(masterEndpoint);
     slave1Client       = new SimpleStorageClient(slave1Endpoint);
     slave2Client       = new SimpleStorageClient(slave2Endpoint);
     fullTopologyClient = new SimpleStorageClient(masterEndpoint, slave1Endpoint, slave2Endpoint);
     using (var httpClient = new HttpClient())
     {
         ActionOnReplica(slave1Endpoint, httpClient, "start");
         ActionOnReplica(slave2Endpoint, httpClient, "start");
         ActionOnReplica(masterEndpoint, httpClient, "start");
     }
 }
Exemple #6
0
        public void Sharding_AllShards_ShouldContainSomeData()
        {
            var client = new SimpleStorageClient(endpoint1);

            for (var i = 0; i < 100; i++)
            {
                client.Put(Guid.NewGuid().ToString(), new Value {
                    Content = "content"
                });
            }

            Assert.That(GetAll(endpoint1).ToArray(), Has.Length.GreaterThan(0));
            Assert.That(GetAll(endpoint2).ToArray(), Has.Length.GreaterThan(0));
            Assert.That(GetAll(endpoint3).ToArray(), Has.Length.GreaterThan(0));
        }
Exemple #7
0
 public void SetUp()
 {
     storageClient      = new SimpleStorageClient(endpoint);
     operationLogClient = new OperationLogClient(endpoint);
 }
Exemple #8
0
 public void SetUp()
 {
     simpleStorageClient = new SimpleStorageClient(endpoints);
 }