@Test(expected = DetectorException.class) public void testFindDetectorDocument_cantRead() { clientUnderTest.findDetectorDocument(DETECTOR_UUID_CANT_READ); }
public DetectorDocument findDetectorDocument(UUID uuid) { notNull(uuid, "uuid can't be null"); val uri = String.format(baseUri + FIND_DOCUMENT_PATH, uuid); Content content; try { content = httpClient.get(uri); } catch (IOException e) { val message = "IOException while getting detector document " + uuid + ": httpMethod=GET" + ", uri=" + uri + ", message=" + e.getMessage(); throw new DetectorException(message, e); } DetectorDocument document; try { document = objectMapper.readValue(content.asBytes(), DetectorDocument.class); } catch (IOException e) { val message = "IOException while reading detector document " + uuid; throw new DetectorException(message, e); } if (document == null) { throw new DetectorException("No detector document for uuid=" + uuid); } return document; }
DetectorClient { public DetectorDocument findDetectorDocument(UUID uuid) { notNull(uuid, "uuid can't be null"); val uri = String.format(baseUri + FIND_DOCUMENT_PATH, uuid); Content content; try { content = httpClient.get(uri); } catch (IOException e) { val message = "IOException while getting detector document " + uuid + ": httpMethod=GET" + ", uri=" + uri + ", message=" + e.getMessage(); throw new DetectorException(message, e); } DetectorDocument document; try { document = objectMapper.readValue(content.asBytes(), DetectorDocument.class); } catch (IOException e) { val message = "IOException while reading detector document " + uuid; throw new DetectorException(message, e); } if (document == null) { throw new DetectorException("No detector document for uuid=" + uuid); } return document; } }
DetectorClient { public DetectorDocument findDetectorDocument(UUID uuid) { notNull(uuid, "uuid can't be null"); val uri = String.format(baseUri + FIND_DOCUMENT_PATH, uuid); Content content; try { content = httpClient.get(uri); } catch (IOException e) { val message = "IOException while getting detector document " + uuid + ": httpMethod=GET" + ", uri=" + uri + ", message=" + e.getMessage(); throw new DetectorException(message, e); } DetectorDocument document; try { document = objectMapper.readValue(content.asBytes(), DetectorDocument.class); } catch (IOException e) { val message = "IOException while reading detector document " + uuid; throw new DetectorException(message, e); } if (document == null) { throw new DetectorException("No detector document for uuid=" + uuid); } return document; }  }
DetectorClient { public DetectorDocument findDetectorDocument(UUID uuid) { notNull(uuid, "uuid can't be null"); val uri = String.format(baseUri + FIND_DOCUMENT_PATH, uuid); Content content; try { content = httpClient.get(uri); } catch (IOException e) { val message = "IOException while getting detector document " + uuid + ": httpMethod=GET" + ", uri=" + uri + ", message=" + e.getMessage(); throw new DetectorException(message, e); } DetectorDocument document; try { document = objectMapper.readValue(content.asBytes(), DetectorDocument.class); } catch (IOException e) { val message = "IOException while reading detector document " + uuid; throw new DetectorException(message, e); } if (document == null) { throw new DetectorException("No detector document for uuid=" + uuid); } return document; }  DetectorDocument findDetectorDocument(UUID uuid); List<DetectorDocument> findUpdatedDetectorDocuments(long timeInSecs); void updatedDetectorLastUsed(UUID uuid); DetectorMatchResponse findMatchingDetectorMappings(List<Map<String, String>> tagsList); List<DetectorMapping> findUpdatedDetectorMappings(long timeInSecs); DetectorMapping findDetectorMappingByUuid(UUID uuid); }
DetectorClient { public DetectorDocument findDetectorDocument(UUID uuid) { notNull(uuid, "uuid can't be null"); val uri = String.format(baseUri + FIND_DOCUMENT_PATH, uuid); Content content; try { content = httpClient.get(uri); } catch (IOException e) { val message = "IOException while getting detector document " + uuid + ": httpMethod=GET" + ", uri=" + uri + ", message=" + e.getMessage(); throw new DetectorException(message, e); } DetectorDocument document; try { document = objectMapper.readValue(content.asBytes(), DetectorDocument.class); } catch (IOException e) { val message = "IOException while reading detector document " + uuid; throw new DetectorException(message, e); } if (document == null) { throw new DetectorException("No detector document for uuid=" + uuid); } return document; }  DetectorDocument findDetectorDocument(UUID uuid); List<DetectorDocument> findUpdatedDetectorDocuments(long timeInSecs); void updatedDetectorLastUsed(UUID uuid); DetectorMatchResponse findMatchingDetectorMappings(List<Map<String, String>> tagsList); List<DetectorMapping> findUpdatedDetectorMappings(long timeInSecs); DetectorMapping findDetectorMappingByUuid(UUID uuid);  }