@VisibleForTesting
  public int getMaxLeavesToBeActivated(int numPendingApps) {
    float childQueueAbsoluteCapacity = leafQueueTemplateAbsoluteCapacity;
    if (childQueueAbsoluteCapacity > 0) {
      int numLeafQueuesNeeded = (int) Math.floor(availableCapacity / childQueueAbsoluteCapacity);
      return Math.min(numLeafQueuesNeeded, numPendingApps);
    }
    return 0;
  }
@Test
  public void testGetMaxLeavesToBeActivated() {
    DeactivatedLeafQueuesByLabel d1 = spy(DeactivatedLeafQueuesByLabel.class);
    d1.setAvailableCapacity(0.17f);
    d1.setLeafQueueTemplateAbsoluteCapacity(0.03f);
    assertEquals(1, d1.getMaxLeavesToBeActivated(1));

    DeactivatedLeafQueuesByLabel d2 = spy(DeactivatedLeafQueuesByLabel.class);
    d2.setAvailableCapacity(0.17f);
    d2.setLeafQueueTemplateAbsoluteCapacity(0.03f);
    assertEquals(5, d2.getMaxLeavesToBeActivated(7));

    DeactivatedLeafQueuesByLabel d3 = spy(DeactivatedLeafQueuesByLabel.class);
    d3.setAvailableCapacity(0f);
    d3.setLeafQueueTemplateAbsoluteCapacity(0.03f);
    assertEquals(0, d3.getMaxLeavesToBeActivated(10));
  }