Search in sources :

Example 1 with LoadMonitorState

use of com.linkedin.kafka.cruisecontrol.monitor.LoadMonitorState in project cruise-control by linkedin.

the class KafkaCruiseControlServletDataFromTest method getState.

/**
 * Generate the KCC state.
 */
private KafkaCruiseControlState getState(int numReadyGoals, int totalGoals, int numValidWindows) {
    ExecutorState executorState = ExecutorState.noTaskInProgress();
    LoadMonitorState loadMonitorState = LoadMonitorState.running(numValidWindows, new TreeMap<>(), 1, 10, Collections.emptyMap());
    Map<Goal, Boolean> goalReadiness = new HashMap<>();
    int i = 0;
    for (; i < numReadyGoals; i++) {
        goalReadiness.put(new MockGoal(i), true);
    }
    for (; i < totalGoals; i++) {
        goalReadiness.put(new MockGoal(i), false);
    }
    AnalyzerState analyzerState = new AnalyzerState(true, goalReadiness);
    return new KafkaCruiseControlState(executorState, loadMonitorState, analyzerState);
}
Also used : LoadMonitorState(com.linkedin.kafka.cruisecontrol.monitor.LoadMonitorState) AnalyzerState(com.linkedin.kafka.cruisecontrol.analyzer.AnalyzerState) Goal(com.linkedin.kafka.cruisecontrol.analyzer.goals.Goal) KafkaCruiseControlState(com.linkedin.kafka.cruisecontrol.KafkaCruiseControlState) ExecutorState(com.linkedin.kafka.cruisecontrol.executor.ExecutorState) HashMap(java.util.HashMap)

Aggregations

KafkaCruiseControlState (com.linkedin.kafka.cruisecontrol.KafkaCruiseControlState)1 AnalyzerState (com.linkedin.kafka.cruisecontrol.analyzer.AnalyzerState)1 Goal (com.linkedin.kafka.cruisecontrol.analyzer.goals.Goal)1 ExecutorState (com.linkedin.kafka.cruisecontrol.executor.ExecutorState)1 LoadMonitorState (com.linkedin.kafka.cruisecontrol.monitor.LoadMonitorState)1 HashMap (java.util.HashMap)1