Source:
<code>public void testThrottleOnlyClusterLevelAnyType() { for (int i = 0; i < NODE_NR - 3; i++) { _participants[i].syncStart(); } _gSetupTool .addResourceToCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "_OnlyANY", 20, STATE_MODEL, RebalanceMode.FULL_AUTO.name(), CrushEdRebalanceStrategy.class.getName()); _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "_OnlyANY", _replica); Assert.assertTrue(_clusterVerifier.verifyByPolling()); ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME); StateTransitionThrottleConfig anyTypeClusterThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.ANY, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 1); clusterConfig.setStateTransitionThrottleConfigs(ImmutableList.of(anyTypeClusterThrottle)); _configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig); DelayedTransition.setDelay(20); DelayedTransition.enableThrottleRecord(); List<MockParticipantManager> newNodes = Arrays.asList(_participants).subList(NODE_NR - 3, NODE_NR); newNodes.forEach(MockParticipantManager::syncStart); newNodes.forEach(node -> { try { Assert.assertTrue(TestHelper.verify(() -> getMaxParallelTransitionCount( DelayedTransition.getInstancePatitionTransitionTimes(), node.getInstanceName()) <= 1, 1000 * 2)); } catch (Exception e) { e.printStackTrace(); assert false; } }); ClusterLiveNodesVerifier liveNodesVerifier = new ClusterLiveNodesVerifier(_gZkClient, CLUSTER_NAME, Lists.transform(Arrays.asList(_participants), MockParticipantManager::getInstanceName)); <START> Assert.assertTrue(liveNodesVerifier.verifyByZkCallback(5000)); <END> for (int i = 0; i < NODE_NR; i++) { _participants[i].syncStop(); } }</code><technical_language>Again, removing test logic</technical_language>

Target:
public void testThrottleOnlyClusterLevelAnyType() { for (int i = 0; i < NODE_NR - 3; i++) { _participants[i].syncStart(); } _gSetupTool .addResourceToCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "_OnlyANY", 20, STATE_MODEL, RebalanceMode.FULL_AUTO.name(), CrushEdRebalanceStrategy.class.getName()); _gSetupTool.rebalanceStorageCluster(CLUSTER_NAME, WorkflowGenerator.DEFAULT_TGT_DB + "_OnlyANY", _replica); Assert.assertTrue(_clusterVerifier.verifyByPolling()); ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME); StateTransitionThrottleConfig anyTypeClusterThrottle = new StateTransitionThrottleConfig(StateTransitionThrottleConfig.RebalanceType.ANY, StateTransitionThrottleConfig.ThrottleScope.CLUSTER, 1); clusterConfig.setStateTransitionThrottleConfigs(ImmutableList.of(anyTypeClusterThrottle)); _configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig); DelayedTransition.setDelay(20); DelayedTransition.enableThrottleRecord(); List<MockParticipantManager> newNodes = Arrays.asList(_participants).subList(NODE_NR - 3, NODE_NR); newNodes.forEach(MockParticipantManager::syncStart); newNodes.forEach(node -> { try { Assert.assertTrue(TestHelper.verify(() -> getMaxParallelTransitionCount( DelayedTransition.getInstancePatitionTransitionTimes(), node.getInstanceName()) <= 1, 1000 * 2)); } catch (Exception e) { e.printStackTrace(); assert false; } }); ClusterLiveNodesVerifier liveNodesVerifier = new ClusterLiveNodesVerifier(_gZkClient, CLUSTER_NAME, Lists.transform(Arrays.asList(_participants), MockParticipantManager::getInstanceName)); Assert.assertTrue(liveNodesVerifier.verifyByZkCallback(5000)); Assert.assertTrue(_clusterVerifier.verifyByPolling()); for (int i = 0; i < NODE_NR; i++) { _participants[i].syncStop(); } }