@Test public void testOutsideFilteredPeriod() { DetectorResponse detectorResponse = new DetectorResponse(); filterUnderTest.doFilter(new DetectorRequest(METRIC_DATA_OUTSIDE_NINE_TO_FIVE), detectorResponse, chain()); OutlierDetectorResult emptyResult = new OutlierDetectorResult(); assertEquals(emptyResult, detectorResponse.getDetectorResult()); verify(mockDetector, never()).detect(any(MetricData.class)); }
@Override public void doFilter(DetectorRequest detectorRequest, DetectorResponse detectorResponse, DetectionFilterChain chain) { notNull(detectorRequest, "metricData can't be null"); if (metricTimeFallsWithinFilter(detectorRequest.getMetricData())) { chain.doFilter(detectorRequest, detectorResponse); } else { OutlierDetectorResult emptyResult = new OutlierDetectorResult(); detectorResponse.setDetectorResult(emptyResult); } }
HourOfDayDetectionFilter implements DetectionFilter { @Override public void doFilter(DetectorRequest detectorRequest, DetectorResponse detectorResponse, DetectionFilterChain chain) { notNull(detectorRequest, "metricData can't be null"); if (metricTimeFallsWithinFilter(detectorRequest.getMetricData())) { chain.doFilter(detectorRequest, detectorResponse); } else { OutlierDetectorResult emptyResult = new OutlierDetectorResult(); detectorResponse.setDetectorResult(emptyResult); } } }
HourOfDayDetectionFilter implements DetectionFilter { @Override public void doFilter(DetectorRequest detectorRequest, DetectorResponse detectorResponse, DetectionFilterChain chain) { notNull(detectorRequest, "metricData can't be null"); if (metricTimeFallsWithinFilter(detectorRequest.getMetricData())) { chain.doFilter(detectorRequest, detectorResponse); } else { OutlierDetectorResult emptyResult = new OutlierDetectorResult(); detectorResponse.setDetectorResult(emptyResult); } } HourOfDayDetectionFilter(@JsonProperty("utcStartHour") int utcStartHour,
                                    @JsonProperty("utcEndHour") int utcEndHour); }
HourOfDayDetectionFilter implements DetectionFilter { @Override public void doFilter(DetectorRequest detectorRequest, DetectorResponse detectorResponse, DetectionFilterChain chain) { notNull(detectorRequest, "metricData can't be null"); if (metricTimeFallsWithinFilter(detectorRequest.getMetricData())) { chain.doFilter(detectorRequest, detectorResponse); } else { OutlierDetectorResult emptyResult = new OutlierDetectorResult(); detectorResponse.setDetectorResult(emptyResult); } } HourOfDayDetectionFilter(@JsonProperty("utcStartHour") int utcStartHour,
                                    @JsonProperty("utcEndHour") int utcEndHour); @Override void doFilter(DetectorRequest detectorRequest, DetectorResponse detectorResponse, DetectionFilterChain chain); }
HourOfDayDetectionFilter implements DetectionFilter { @Override public void doFilter(DetectorRequest detectorRequest, DetectorResponse detectorResponse, DetectionFilterChain chain) { notNull(detectorRequest, "metricData can't be null"); if (metricTimeFallsWithinFilter(detectorRequest.getMetricData())) { chain.doFilter(detectorRequest, detectorResponse); } else { OutlierDetectorResult emptyResult = new OutlierDetectorResult(); detectorResponse.setDetectorResult(emptyResult); } } HourOfDayDetectionFilter(@JsonProperty("utcStartHour") int utcStartHour,
                                    @JsonProperty("utcEndHour") int utcEndHour); @Override void doFilter(DetectorRequest detectorRequest, DetectorResponse detectorResponse, DetectionFilterChain chain);  }