@Test public void testInsideFilteredPeriod() { when(mockDetector.detect(METRIC_DATA_INSIDE_NINE_TO_FIVE)).thenReturn(mockDetectorResult); DetectorResponse detectorResponse = new DetectorResponse(); filterUnderTest.doFilter(new DetectorRequest(METRIC_DATA_INSIDE_NINE_TO_FIVE), detectorResponse, chain()); DetectorResult actualResult = detectorResponse.getDetectorResult(); assertSame(mockDetectorResult, actualResult); }
@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);  }