コード例 #1
0
        public void ShouldRedirectToProvidedOperations()
        {
            var provider   = new FakeProvider();
            var operations = new SolrCloudOperations <FakeEntity>(provider, provider);

            operations.Commit();
            Assert.Equal(provider.LastOperation, "Commit");
        }
コード例 #2
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");
        }
コード例 #3
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");
        }
コード例 #4
0
 public FakeOperations(FakeProvider provider)
 {
     this.provider = provider;
 }