@Test public void testDeleteDetector() { val detectorRepository = mock(LegacyDetectorRepository.class); doNothing().when(detectorRepository).deleteDetector(anyString()); detectorRepository.deleteDetector("aeb4d849-847a-45c0-8312-dc0fcf22b639"); verify(detectorRepository, times(1)).deleteDetector("aeb4d849-847a-45c0-8312-dc0fcf22b639"); }
@Override public void deleteDetector(String uuid) { MDC.put("DetectorUuid", uuid); val deleteRequest = new DeleteRequest(DETECTOR_INDEX, DETECTOR_DOC_TYPE, uuid); try { val deleteResponse = legacyElasticSearchClient.delete(deleteRequest, RequestOptions.DEFAULT); if (elasticsearchUtil.checkNullResponse(deleteResponse.getResult())) { throw new RecordNotFoundException("Invalid request: " + uuid); } } catch (IOException e) { log.error("Deleting detector failed", e); throw new RuntimeException(e); } finally { MDC.remove("DetectorUuid"); } }
LegacyDetectorRepositoryImpl implements LegacyDetectorRepository { @Override public void deleteDetector(String uuid) { MDC.put("DetectorUuid", uuid); val deleteRequest = new DeleteRequest(DETECTOR_INDEX, DETECTOR_DOC_TYPE, uuid); try { val deleteResponse = legacyElasticSearchClient.delete(deleteRequest, RequestOptions.DEFAULT); if (elasticsearchUtil.checkNullResponse(deleteResponse.getResult())) { throw new RecordNotFoundException("Invalid request: " + uuid); } } catch (IOException e) { log.error("Deleting detector failed", e); throw new RuntimeException(e); } finally { MDC.remove("DetectorUuid"); } } }
LegacyDetectorRepositoryImpl implements LegacyDetectorRepository { @Override public void deleteDetector(String uuid) { MDC.put("DetectorUuid", uuid); val deleteRequest = new DeleteRequest(DETECTOR_INDEX, DETECTOR_DOC_TYPE, uuid); try { val deleteResponse = legacyElasticSearchClient.delete(deleteRequest, RequestOptions.DEFAULT); if (elasticsearchUtil.checkNullResponse(deleteResponse.getResult())) { throw new RecordNotFoundException("Invalid request: " + uuid); } } catch (IOException e) { log.error("Deleting detector failed", e); throw new RuntimeException(e); } finally { MDC.remove("DetectorUuid"); } }  }
LegacyDetectorRepositoryImpl implements LegacyDetectorRepository { @Override public void deleteDetector(String uuid) { MDC.put("DetectorUuid", uuid); val deleteRequest = new DeleteRequest(DETECTOR_INDEX, DETECTOR_DOC_TYPE, uuid); try { val deleteResponse = legacyElasticSearchClient.delete(deleteRequest, RequestOptions.DEFAULT); if (elasticsearchUtil.checkNullResponse(deleteResponse.getResult())) { throw new RecordNotFoundException("Invalid request: " + uuid); } } catch (IOException e) { log.error("Deleting detector failed", e); throw new RuntimeException(e); } finally { MDC.remove("DetectorUuid"); } }  @Override UUID createDetector(DetectorDocument document); @Override void deleteDetector(String uuid); @Override void updateDetector(String uuid, DetectorDocument document); @Override DetectorDocument findByUuid(String uuid); @Override List<DetectorDocument> findByCreatedBy(String user); @Override void toggleDetector(String uuid, Boolean enabled); @Override void trustDetector(String uuid, Boolean trusted); @Override List<DetectorDocument> getLastUpdatedDetectors(long interval); @Override List<DetectorDocument> getLastUpdatedDetectors(String fromDate, String toDate); }
LegacyDetectorRepositoryImpl implements LegacyDetectorRepository { @Override public void deleteDetector(String uuid) { MDC.put("DetectorUuid", uuid); val deleteRequest = new DeleteRequest(DETECTOR_INDEX, DETECTOR_DOC_TYPE, uuid); try { val deleteResponse = legacyElasticSearchClient.delete(deleteRequest, RequestOptions.DEFAULT); if (elasticsearchUtil.checkNullResponse(deleteResponse.getResult())) { throw new RecordNotFoundException("Invalid request: " + uuid); } } catch (IOException e) { log.error("Deleting detector failed", e); throw new RuntimeException(e); } finally { MDC.remove("DetectorUuid"); } }  @Override UUID createDetector(DetectorDocument document); @Override void deleteDetector(String uuid); @Override void updateDetector(String uuid, DetectorDocument document); @Override DetectorDocument findByUuid(String uuid); @Override List<DetectorDocument> findByCreatedBy(String user); @Override void toggleDetector(String uuid, Boolean enabled); @Override void trustDetector(String uuid, Boolean trusted); @Override List<DetectorDocument> getLastUpdatedDetectors(long interval); @Override List<DetectorDocument> getLastUpdatedDetectors(String fromDate, String toDate);  }