use of com.linkedin.cruisecontrol.detector.metricanomaly.MetricAnomalyFinder in project cruise-control by linkedin.
the class AnomalyDetectorTestUtils method createMetricAnomalyFinder.
/**
* Create metric anomaly finder based on config.
* @param props Cruise Control config.
* @return The created anomaly finder.
*/
@SuppressWarnings("unchecked")
public static MetricAnomalyFinder<BrokerEntity> createMetricAnomalyFinder(Properties props) {
KafkaCruiseControlConfig config = new KafkaCruiseControlConfig(props);
KafkaCruiseControl mockKafkaCruiseControl = EasyMock.mock(KafkaCruiseControl.class);
EasyMock.expect(mockKafkaCruiseControl.config()).andReturn(config).anyTimes();
EasyMock.expect(mockKafkaCruiseControl.timeMs()).andReturn(ANOMALY_DETECTION_TIME_MS).anyTimes();
EasyMock.replay(mockKafkaCruiseControl);
Map<String, Object> originalConfigs = new HashMap<>(config.originals());
originalConfigs.put(KAFKA_CRUISE_CONTROL_OBJECT_CONFIG, mockKafkaCruiseControl);
List<MetricAnomalyFinder> kafkaMetricAnomalyFinders = config.getConfiguredInstances(AnomalyDetectorConfig.METRIC_ANOMALY_FINDER_CLASSES_CONFIG, MetricAnomalyFinder.class, originalConfigs);
return kafkaMetricAnomalyFinders.get(0);
}
Aggregations