@Test
public void testUpdateActiveRatio() throws Exception {

  ExecutorService service = Executors.newFixedThreadPool(storageGroups.length);
  CountDownLatch finished = new CountDownLatch(storageGroups.length);
  for (int i = 0; i < storageGroups.length; i++) {
    service.submit(new OfferThreads(storageGroups[i], measurementNum[i], finished));
  }
  finished.await();
  for (String storageGroup : storageGroups) {
    ActiveTimeSeriesCounter.getInstance().updateActiveRatio(storageGroup);
    double sum = 0;
    for (String s : storageGroups) {
      sum += ActiveTimeSeriesCounter.getInstance().getActiveRatio(s);
    }
    assertEquals(1.0, sum, 0.001);
  }
  for (int i = 0; i < storageGroups.length; i++) {
    double r = ActiveTimeSeriesCounter.getInstance().getActiveRatio(storageGroups[i]);
    assertEquals(measurementNum[i] / totalSeriesNum, r, 0.001);
  }
}