NaiveShortfallEvaluator extends BaseShortfallEvaluator { @Override public Map<String, Integer> getShortfall(Set<String> vmGroupNames, Set<TaskRequest> failures, AutoScaleRules autoScaleRules) { if (vmGroupNames != null && failures != null && !failures.isEmpty()) { reset(); return adjustAgentScaleUp(fillShortfallMap(vmGroupNames, filterFailedTasks(failures)), autoScaleRules); } else return Collections.emptyMap(); }  @Override Map<String, Integer> getShortfall(Set<String> vmGroupNames, Set<TaskRequest> failures, AutoScaleRules autoScaleRules);  }
@Test public void testShortfallAdjusting() throws Exception { Set<TaskRequest> failedTasks = new HashSet<>(asList( createFailedTask("std#1"), createFailedTask("std#2"), createFailedTask("adjusted#1"), createFailedTask("adjusted#2") )); Map<String, Integer> shortfall = shortfallEvaluator.getShortfall(ATTR_KEYS, failedTasks, autoScaleRules); Assert.assertThat(shortfall.get(HOST_ATTR_VAL), is(equalTo(2))); Assert.assertThat(shortfall.get(ADJUSTED_HOST_ATTR_VAL), is(equalTo(1))); }