Package org.elasticsearch.test
Class ClusterServiceUtils
java.lang.Object
org.elasticsearch.test.ClusterServiceUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SubscribableListener<Void> addMasterTemporaryStateListener(Predicate<ClusterState> predicate) Creates aClusterStateListenerwhich subscribes to theClusterServiceof the current elected master node in theESIntegTestCase.internalCluster().static SubscribableListener<Void> addTemporaryStateListener(Predicate<ClusterState> predicate) Creates aClusterStateListenerwhich subscribes to theClusterServiceof one of the nodes in theESIntegTestCase.internalCluster().static SubscribableListener<Void> addTemporaryStateListener(ClusterService clusterService, Predicate<ClusterState> predicate) Creates aClusterStateListenerwhich subscribes to the givenClusterServiceand waits for it to apply a cluster state that satisfiespredicate, at which point it unsubscribes itself.static SubscribableListener<Void> addTemporaryStateListener(ClusterService clusterService, Predicate<ClusterState> predicate, org.elasticsearch.core.TimeValue timeout) Creates aClusterStateListenerwhich subscribes to the givenClusterServiceand waits for it to apply a cluster state that satisfiespredicate, at which point it unsubscribes itself.static voidawaitClusterState(Predicate<ClusterState> statePredicate, ClusterService clusterService) static voidawaitNoPendingTasks(ClusterService clusterService) static ClusterServicecreateClusterService(ClusterState initialState, ThreadPool threadPool) static ClusterServicecreateClusterService(ClusterState initialState, ThreadPool threadPool, ClusterSettings clusterSettings) static ClusterServicecreateClusterService(ThreadPool threadPool) static ClusterServicecreateClusterService(ThreadPool threadPool, DiscoveryNode localNode) static ClusterServicecreateClusterService(ThreadPool threadPool, DiscoveryNode localNode, ClusterSettings clusterSettings) static ClusterServicecreateClusterService(ThreadPool threadPool, DiscoveryNode localNode, Settings providedSettings, ClusterSettings clusterSettings) static ClusterServicecreateClusterService(ThreadPool threadPool, ClusterSettings clusterSettings) static ClusterServicecreateClusterService(ThreadPool threadPool, Settings providedSettings) static ClusterStatePublishercreateClusterStatePublisher(ClusterApplier clusterApplier) static NodeConnectionsServicestatic voidsetAllElapsedMillis(ClusterStatePublicationEvent clusterStatePublicationEvent) static voidsetState(ClusterApplierService executor, ClusterState clusterState) static voidsetState(ClusterService clusterService, ClusterState clusterState) Sets the state on the cluster applier servicestatic voidsetState(ClusterService clusterService, ClusterState.Builder clusterStateBuilder) static voidsetState(MasterService executor, ClusterState clusterState)
-
Constructor Details
-
ClusterServiceUtils
public ClusterServiceUtils()
-
-
Method Details
-
setState
-
setState
-
createClusterService
-
createClusterService
-
createClusterService
public static ClusterService createClusterService(ThreadPool threadPool, ClusterSettings clusterSettings) -
createClusterService
public static ClusterService createClusterService(ThreadPool threadPool, DiscoveryNode localNode, ClusterSettings clusterSettings) -
createClusterService
-
createClusterService
public static ClusterService createClusterService(ThreadPool threadPool, DiscoveryNode localNode, Settings providedSettings, ClusterSettings clusterSettings) -
createNoOpNodeConnectionsService
-
createClusterStatePublisher
-
createClusterService
-
createClusterService
public static ClusterService createClusterService(ClusterState initialState, ThreadPool threadPool, ClusterSettings clusterSettings) -
setState
public static void setState(ClusterService clusterService, ClusterState.Builder clusterStateBuilder) -
setState
Sets the state on the cluster applier service -
setAllElapsedMillis
-
awaitClusterState
public static void awaitClusterState(Predicate<ClusterState> statePredicate, ClusterService clusterService) -
awaitNoPendingTasks
-
addTemporaryStateListener
public static SubscribableListener<Void> addTemporaryStateListener(ClusterService clusterService, Predicate<ClusterState> predicate) Creates aClusterStateListenerwhich subscribes to the givenClusterServiceand waits for it to apply a cluster state that satisfiespredicate, at which point it unsubscribes itself.- Returns:
- A
SubscribableListenerwhich is completed when the first cluster state matchingpredicateis applied by the givenclusterService. If the current cluster state already matchespredicatethen the returned listener is already complete. If no matching cluster state is seen withinESTestCase.SAFE_AWAIT_TIMEOUTthen the listener is completed exceptionally on the scheduler thread that belongs toclusterService.
-
addTemporaryStateListener
public static SubscribableListener<Void> addTemporaryStateListener(ClusterService clusterService, Predicate<ClusterState> predicate, org.elasticsearch.core.TimeValue timeout) Creates aClusterStateListenerwhich subscribes to the givenClusterServiceand waits for it to apply a cluster state that satisfiespredicate, at which point it unsubscribes itself.- Returns:
- A
SubscribableListenerwhich is completed when the first cluster state matchingpredicateis applied by the givenclusterService. If the current cluster state already matchespredicatethen the returned listener is already complete. If no matching cluster state is seen within the providedtimeoutthen the listener is completed exceptionally on the scheduler thread that belongs toclusterService.
-
addTemporaryStateListener
public static SubscribableListener<Void> addTemporaryStateListener(Predicate<ClusterState> predicate) Creates aClusterStateListenerwhich subscribes to theClusterServiceof one of the nodes in theESIntegTestCase.internalCluster(). When the chosenClusterServiceapplies a state that satisfiespredicatethe listener unsubscribes itself.- Returns:
- A
SubscribableListenerwhich is completed when the first cluster state matchingpredicateis applied by theClusterServicebelonging to one of the nodes in theESIntegTestCase.internalCluster(). If the current cluster state already matchespredicatethen the returned listener is already complete. If no matching cluster state is seen withinESTestCase.SAFE_AWAIT_TIMEOUTthen the listener is completed exceptionally on the scheduler thread that belongs to the chosen node'sClusterService.
-
addMasterTemporaryStateListener
public static SubscribableListener<Void> addMasterTemporaryStateListener(Predicate<ClusterState> predicate) Creates aClusterStateListenerwhich subscribes to theClusterServiceof the current elected master node in theESIntegTestCase.internalCluster(). When this node'sClusterServiceapplies a state that satisfiespredicatethe listener unsubscribes itself.- Returns:
- A
SubscribableListenerwhich is completed when the first cluster state matchingpredicateis applied by theClusterServicebelonging to the node that was the elected master node in theESIntegTestCase.internalCluster()when this method was first called. If the current cluster state already matchespredicatethen the returned listener is already complete. If no matching cluster state is seen withinESTestCase.SAFE_AWAIT_TIMEOUTthen the listener is completed exceptionally on the scheduler thread that belongs to the elected master node'sClusterService.
-