private void testHTTPHandlersGetByResolution(
     Locator locator, Resolution resolution, long from, long to, int expectedPoints)
     throws Exception {
   Assert.assertEquals(
       expectedPoints,
       getNumberOfPointsViaHTTPHandler(httpHandler, locator, from, to, resolution));
 }
 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());
 }
 private void testHTTPRollupHandlerGetByPoints(
     Map<Locator, Map<Granularity, Integer>> answers,
     Map<Granularity, Integer> points,
     long from,
     long to)
     throws Exception {
   for (Locator locator : locators) {
     for (Granularity g2 : Granularity.granularities()) {
       MetricData data =
           httpHandler.GetDataByPoints(
               locator.getTenantId(),
               locator.getMetricName(),
               baseMillis,
               baseMillis + 86400000,
               points.get(g2));
       Assert.assertEquals((int) answers.get(locator).get(g2), data.getData().getPoints().size());
       Assert.assertEquals(locatorToUnitMap.get(locator), data.getUnit());
     }
   }
 }
 private void testBadMethod() throws Exception {
   HttpPost post = new HttpPost(getMetricsQueryURI());
   HttpResponse response = client.execute(post);
   Assert.assertEquals(405, response.getStatusLine().getStatusCode());
 }
 private void testBadRequest() throws Exception {
   HttpGet get = new HttpGet(getInvalidMetricsQueryURI());
   HttpResponse response = client.execute(get);
   Assert.assertEquals(400, response.getStatusLine().getStatusCode());
 }
 private void testHttpRequestForHistograms() throws Exception {
   HttpGet get = new HttpGet(getHistQueryURI());
   HttpResponse response = client.execute(get);
   Assert.assertEquals(200, response.getStatusLine().getStatusCode());
 }
 private void testHappyCaseHTTPRequest() throws Exception {
   HttpGet get = new HttpGet(getMetricsQueryURI());
   HttpResponse response = client.execute(get);
   Assert.assertEquals(200, response.getStatusLine().getStatusCode());
 }