private void testHappyCaseMultiFetchHTTPRequest() throws Exception { HttpPost post = new HttpPost(getBatchMetricsQueryURI()); JSONArray metricsToGet = new JSONArray(); for (Locator locator : locators) { metricsToGet.add(locator.toString()); } HttpEntity entity = new StringEntity(metricsToGet.toString(), ContentType.APPLICATION_JSON); post.setEntity(entity); HttpResponse response = client.execute(post); Assert.assertEquals(200, response.getStatusLine().getStatusCode()); }
/** * For a given list of locators, figure the shard they belong to and for all those shards get all * the locators in metric_locator column family * * @param ingestedLocators * @return * @throws IOException */ protected Set<Locator> retrieveLocators(Set<Locator> ingestedLocators) throws IOException { Set<Long> shards = new HashSet<Long>(); for (Locator locator : ingestedLocators) { long shard = (long) Util.getShard(locator.toString()); shards.add(shard); } Set<Locator> locatorsFromDB = new HashSet<Locator>(); for (Long shard : shards) { locatorsFromDB.addAll(locatorIO.getLocators(shard)); } return locatorsFromDB; }