예제 #1
0
        /// <summary>
        /// Returns parsed internal collections cloud state
        /// </summary>
        private async Task <SolrCloudState> GetInternalCollectionsStateAsync()
        {
            DataResult data;

            try
            {
                data = await zooKeeper.getDataAsync(ClusterState, true).ConfigureAwait(false);
            }
            catch (KeeperException ex)
            {
                return(new SolrCloudState(new Dictionary <string, SolrCloudCollection>()));
            }

            var collectionsState =
                data != null
                ? SolrCloudStateParser.Parse(Encoding.Default.GetString(data.Data), liveNodes)
                : new SolrCloudState(new Dictionary <string, SolrCloudCollection>());

            return(collectionsState);
        }
예제 #2
0
        public void ShouldProduceEmptyStateFromEmptyJson()
        {
            var state = SolrCloudStateParser.Parse(EmptyJson);

            Assert.False(state.Collections.Any());
        }