public void ShouldRedirectToProvidedOperations()
 {
     var provider = new FakeProvider();
     var operations = new SolrCloudOperations<FakeEntity>(provider, provider);
     operations.Commit();
     Debug.Assert(provider.LastOperation == "Commit", "Should call the provided Commit method");
 }
예제 #2
0
        public void ShouldRedirectToProvidedOperations()
        {
            var provider   = new FakeProvider();
            var operations = new SolrCloudOperations <FakeEntity>(provider, provider);

            operations.Commit();
            Assert.Equal(provider.LastOperation, "Commit");
        }
예제 #3
0
        public void ShouldRedirectToProvidedOperations()
        {
            var provider   = new FakeProvider();
            var operations = new SolrCloudOperations <FakeEntity>(provider, provider);

            operations.Commit();
            Debug.Assert(provider.LastOperation == "Commit", "Should call the provided Commit method");
        }
 public void ShouldEventuallyUseAllActiveLeadersForWrite()
 {
     var provider = new FakeProvider();
     var state = provider.GetCloudState();
     var count = state.Collections.Values
         .SelectMany(collection => collection.Shards.Values)
         .SelectMany(shard => shard.Replicas.Values)
         .Where(replica => replica.IsActive && replica.IsLeader)
         .Select(replica => replica.Url)
         .Distinct()
         .Count();
     var urls = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
     foreach (var collection in state.Collections.Values)
     {
         var operations = new SolrCloudOperations<FakeEntity>(provider, provider, collection.Name);
         for (var i = 0; i < 10 * count; i++)
         {
             operations.Commit();
             urls.Add(provider.LastUrl);
         }
     }
     Debug.Assert(urls.Count == count, "Should eventually use all active leaders for write");
 }
예제 #5
0
        public void ShouldEventuallyUseAllActiveLeadersForWrite()
        {
            var provider = new FakeProvider();
            var state    = provider.GetCloudState();
            var count    = state.Collections.Values
                           .SelectMany(collection => collection.Shards.Values)
                           .SelectMany(shard => shard.Replicas.Values)
                           .Where(replica => replica.IsActive && replica.IsLeader)
                           .Select(replica => replica.Url)
                           .Distinct()
                           .Count();
            var urls = new HashSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (var collection in state.Collections.Values)
            {
                var operations = new SolrCloudOperations <FakeEntity>(provider, provider, collection.Name);
                for (var i = 0; i < 10 * count; i++)
                {
                    operations.Commit();
                    urls.Add(provider.LastUrl);
                }
            }
            Assert.True(urls.Count == count, "Should eventually use all active leaders for write");
        }