コード例 #1
0
 private void testHTTPHandlersGetByResolution(
     Locator locator, Resolution resolution, long from, long to, int expectedPoints)
     throws Exception {
   Assert.assertEquals(
       expectedPoints,
       getNumberOfPointsViaHTTPHandler(httpHandler, locator, from, to, resolution));
 }
コード例 #2
0
 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());
 }
コード例 #3
0
 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());
     }
   }
 }
コード例 #4
0
 private void testBadMethod() throws Exception {
   HttpPost post = new HttpPost(getMetricsQueryURI());
   HttpResponse response = client.execute(post);
   Assert.assertEquals(405, response.getStatusLine().getStatusCode());
 }
コード例 #5
0
 private void testBadRequest() throws Exception {
   HttpGet get = new HttpGet(getInvalidMetricsQueryURI());
   HttpResponse response = client.execute(get);
   Assert.assertEquals(400, response.getStatusLine().getStatusCode());
 }
コード例 #6
0
 private void testHttpRequestForHistograms() throws Exception {
   HttpGet get = new HttpGet(getHistQueryURI());
   HttpResponse response = client.execute(get);
   Assert.assertEquals(200, response.getStatusLine().getStatusCode());
 }
コード例 #7
0
 private void testHappyCaseHTTPRequest() throws Exception {
   HttpGet get = new HttpGet(getMetricsQueryURI());
   HttpResponse response = client.execute(get);
   Assert.assertEquals(200, response.getStatusLine().getStatusCode());
 }