@Test(expected = DetectorException.class) public void testFindDetectorMappingByUuid_cantPost() { clientUnderTest.findDetectorMappingByUuid(DETECTOR_UUID_CANT_POST); }
public DetectorMapping findDetectorMappingByUuid(UUID uuid) { Content content; List<DetectorMapping> result; val uri = String.format(baseUri + FIND_MAPPINGS_BY_UUID_PATH); val bodyMap = Collections.singletonMap("detectorUuid", uuid); try { val body = objectMapper.writeValueAsString(bodyMap); content = httpClient.post(uri, body); } catch (IOException e) { val message = "IOException while getting detectors mappings for" + ": uuid=" + uuid + ", httpMethod=POST" + ", uri=" + uri; throw new DetectorException(message, e); } val typeRef = new TypeReference<List<DetectorMapping>>() { }; try { result = objectMapper.readValue(content.asBytes(), typeRef); } catch (IOException e) { val message = "IOException while reading detectors mappings for" + ": uuid=" + uuid; throw new DetectorException(message, e); } if (result == null || result.isEmpty()) { throw new DetectorException("No detector mappings for" + ": uuid=" + uuid); } return result.get(0); }
DetectorClient { public DetectorMapping findDetectorMappingByUuid(UUID uuid) { Content content; List<DetectorMapping> result; val uri = String.format(baseUri + FIND_MAPPINGS_BY_UUID_PATH); val bodyMap = Collections.singletonMap("detectorUuid", uuid); try { val body = objectMapper.writeValueAsString(bodyMap); content = httpClient.post(uri, body); } catch (IOException e) { val message = "IOException while getting detectors mappings for" + ": uuid=" + uuid + ", httpMethod=POST" + ", uri=" + uri; throw new DetectorException(message, e); } val typeRef = new TypeReference<List<DetectorMapping>>() { }; try { result = objectMapper.readValue(content.asBytes(), typeRef); } catch (IOException e) { val message = "IOException while reading detectors mappings for" + ": uuid=" + uuid; throw new DetectorException(message, e); } if (result == null || result.isEmpty()) { throw new DetectorException("No detector mappings for" + ": uuid=" + uuid); } return result.get(0); } }
DetectorClient { public DetectorMapping findDetectorMappingByUuid(UUID uuid) { Content content; List<DetectorMapping> result; val uri = String.format(baseUri + FIND_MAPPINGS_BY_UUID_PATH); val bodyMap = Collections.singletonMap("detectorUuid", uuid); try { val body = objectMapper.writeValueAsString(bodyMap); content = httpClient.post(uri, body); } catch (IOException e) { val message = "IOException while getting detectors mappings for" + ": uuid=" + uuid + ", httpMethod=POST" + ", uri=" + uri; throw new DetectorException(message, e); } val typeRef = new TypeReference<List<DetectorMapping>>() { }; try { result = objectMapper.readValue(content.asBytes(), typeRef); } catch (IOException e) { val message = "IOException while reading detectors mappings for" + ": uuid=" + uuid; throw new DetectorException(message, e); } if (result == null || result.isEmpty()) { throw new DetectorException("No detector mappings for" + ": uuid=" + uuid); } return result.get(0); }  }
DetectorClient { public DetectorMapping findDetectorMappingByUuid(UUID uuid) { Content content; List<DetectorMapping> result; val uri = String.format(baseUri + FIND_MAPPINGS_BY_UUID_PATH); val bodyMap = Collections.singletonMap("detectorUuid", uuid); try { val body = objectMapper.writeValueAsString(bodyMap); content = httpClient.post(uri, body); } catch (IOException e) { val message = "IOException while getting detectors mappings for" + ": uuid=" + uuid + ", httpMethod=POST" + ", uri=" + uri; throw new DetectorException(message, e); } val typeRef = new TypeReference<List<DetectorMapping>>() { }; try { result = objectMapper.readValue(content.asBytes(), typeRef); } catch (IOException e) { val message = "IOException while reading detectors mappings for" + ": uuid=" + uuid; throw new DetectorException(message, e); } if (result == null || result.isEmpty()) { throw new DetectorException("No detector mappings for" + ": uuid=" + uuid); } return result.get(0); }  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 DetectorMapping findDetectorMappingByUuid(UUID uuid) { Content content; List<DetectorMapping> result; val uri = String.format(baseUri + FIND_MAPPINGS_BY_UUID_PATH); val bodyMap = Collections.singletonMap("detectorUuid", uuid); try { val body = objectMapper.writeValueAsString(bodyMap); content = httpClient.post(uri, body); } catch (IOException e) { val message = "IOException while getting detectors mappings for" + ": uuid=" + uuid + ", httpMethod=POST" + ", uri=" + uri; throw new DetectorException(message, e); } val typeRef = new TypeReference<List<DetectorMapping>>() { }; try { result = objectMapper.readValue(content.asBytes(), typeRef); } catch (IOException e) { val message = "IOException while reading detectors mappings for" + ": uuid=" + uuid; throw new DetectorException(message, e); } if (result == null || result.isEmpty()) { throw new DetectorException("No detector mappings for" + ": uuid=" + uuid); } return result.get(0); }  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);  }