}
Set<ResourceMeasurementScheduleRequest> resScheds = measurementScheduleManager
.findSchedulesForResourceAndItsDescendants(new int[] { resource1.getId() }, false);
Assert.assertEquals(1, resScheds.size());
ResourceMeasurementScheduleRequest rmsr = resScheds.iterator().next();
Set<MeasurementScheduleRequest> scheds = rmsr.getMeasurementSchedules();
Assert.assertEquals(1, scheds.size());
MeasurementScheduleRequest msr = scheds.iterator().next();
Assert.assertEquals(updatedInterval, msr.getInterval());
Assert.assertEquals(true, msr.isEnabled());
// Test disable of metrics at the template level, this should have no effect on the interval in the client
// or in the db
testCommService.init();
testCommService.setExpectedInterval(updatedInterval);
testCommService.setExpectedIsEnabled(false);
measurementScheduleManager.disableSchedulesForResourceType(overlord, new int[] { definitionCt1.getId() },
true);
Assert.assertTrue(testCommService.isTested());
resScheds = measurementScheduleManager.findSchedulesForResourceAndItsDescendants(
new int[] { resource1.getId() }, false);
Assert.assertEquals(1, resScheds.size());
rmsr = resScheds.iterator().next();
scheds = rmsr.getMeasurementSchedules();
Assert.assertEquals(1, scheds.size());
msr = scheds.iterator().next();
Assert.assertEquals(updatedInterval, msr.getInterval());
Assert.assertEquals(false, msr.isEnabled());
// Test enable of metrics at the template level, this should have no effect on the interval in the client
// or in the db
testCommService.init();
testCommService.setExpectedInterval(updatedInterval);
testCommService.setExpectedIsEnabled(false);
measurementScheduleManager.enableSchedulesForResourceType(overlord, new int[] { definitionCt1.getId() },
true);
Assert.assertTrue(testCommService.isTested());
resScheds = measurementScheduleManager.findSchedulesForResourceAndItsDescendants(
new int[] { resource1.getId() }, false);
Assert.assertEquals(1, resScheds.size());
rmsr = resScheds.iterator().next();
scheds = rmsr.getMeasurementSchedules();
Assert.assertEquals(1, scheds.size());
msr = scheds.iterator().next();
Assert.assertEquals(updatedInterval, msr.getInterval());
Assert.assertEquals(true, msr.isEnabled());