Class SolrCloudTestCase

    • Constructor Detail

      • SolrCloudTestCase

        public SolrCloudTestCase()
    • Method Detail

      • zkClient

        protected static zkClient()
      • shutdownCluster

        public static void shutdownCluster()
                                    throws Exception
      • checkClusterConfiguration

        public void checkClusterConfiguration()
      • getCollectionState

        protected static getCollectionState​(String collectionName)
        Get the collection state for a particular collection
      • waitForState

        protected static void waitForState​(String message,
                                           String collection,
      • waitForState

        protected static void waitForState​(String message,
                                           String collection,
                                           int timeout,
                                           TimeUnit timeUnit)
        Wait for a particular collection state to appear in the cluster client's state reader

        This is a convenience method using the DEFAULT_TIMEOUT

        message - a message to report on failure
        collection - the collection to watch
        predicate - a predicate to match against the collection state
      • clusterShape

        public static clusterShape​(int expectedShards,
                                                                                         int expectedReplicas)
        Return a CollectionStatePredicate that returns true if a collection has the expected number of shards and active replicas
      • activeClusterShape

        public static activeClusterShape​(int expectedShards,
                                                                                               int expectedReplicas)
        Return a CollectionStatePredicate that returns true if a collection has the expected number of active shards and active replicas
      • containsLiveNode

        public static containsLiveNode​(String node)
      • missingLiveNode

        public static missingLiveNode​(String node)
      • missingLiveNodes

        public static missingLiveNodes​(List<String> nodes)
      • getRandomShard

        protected static getRandomShard​( collection)
        Get a (reproducibly) random shard from a DocCollection
      • getRandomReplica

        protected static getRandomReplica​( slice)
        Get a (reproducibly) random replica from a Slice
      • getRandomReplica

        protected static getRandomReplica​( slice,
                                                                               Predicate<> matchPredicate)
        Get a (reproducibly) random replica from a Slice matching a predicate
      • getCoreStatus

        protected static org.apache.solr.client.solrj.request.CoreStatus getCoreStatus​( replica)
                                                                                throws IOException,
        Get the CoreStatus data for a Replica

        This assumes that the replica is hosted on a live node.

      • waitForResponse

        protected org.apache.solr.common.util.NamedList waitForResponse​(Predicate<org.apache.solr.common.util.NamedList> predicate,
                                                                        org.apache.solr.client.solrj.SolrRequest request,
                                                                        int intervalInMillis,
                                                                        int numRetries,
                                                                        String messageOnFail)
      • ensureRunningJettys

        public static void ensureRunningJettys​(int nodeCount,
                                               int timeoutSeconds)
                                        throws Exception
        Ensure that the given number of solr instances are running. If less instances are found then new instances are started. If extra instances are found then they are stopped.
        nodeCount - the number of Solr instances that should be running at the end of this method
        Exception - on error
      • mapReplicasToReplicaType

        public static Map<String,​String> mapReplicasToReplicaType​( collection)