definition.setEnabled(true);
definition.setDriftHandlingMode(normal);
definition.setInterval(2400L);
definition.setBasedir(new DriftDefinition.BaseDirectory(fileSystem, "/foo/bar/test"));
DriftDefinitionTemplate template = templateMgr.createTemplate(getOverlord(), resourceType.getId(), true,
definition);
// next create some definitions from the template
final DriftDefinition attachedDef1 = createDefinition(template, NAME_PREFIX + "attachedDef1", true);
final DriftDefinition attachedDef2 = createDefinition(template, NAME_PREFIX + "attachedDef2", true);
final DriftDefinition detachedDef1 = createDefinition(template, NAME_PREFIX + "detachedDef1", false);
final DriftDefinition detachedDef2 = createDefinition(template, NAME_PREFIX + "detachedDef2", false);
driftMgr.updateDriftDefinition(getOverlord(), forResource(resource.getId()), attachedDef1);
driftMgr.updateDriftDefinition(getOverlord(), forResource(resource.getId()), attachedDef2);
driftMgr.updateDriftDefinition(getOverlord(), forResource(resource.getId()), detachedDef1);
driftMgr.updateDriftDefinition(getOverlord(), forResource(resource.getId()), detachedDef2);
// update the template
final DriftDefinition newTemplateDef = template.getTemplateDefinition();
newTemplateDef.setInterval(4800L);
newTemplateDef.setDriftHandlingMode(plannedChanges);
newTemplateDef.setEnabled(false);
templateMgr.updateTemplate(getOverlord(), template);
// verify that the template has been updated
final DriftDefinitionTemplate updatedTemplate = loadTemplate(template.getName());
AssertUtils.assertPropertiesMatch("Failed to update template", template, updatedTemplate, "resourceType",
"driftDefinitions", "templateDefinition");
// verify that attached definitions are updated.
for (DriftDefinition def : asList(attachedDef1, attachedDef2)) {
DriftDefinition updatedDef = loadDefinition(def.getId());
String msg = "Failed to propagate update to attached definition " + toString(updatedDef) + " - ";
DriftDefinition updatedTemplateDef = updatedTemplate.getTemplateDefinition();
assertEquals(msg + "enabled property not updated", updatedTemplateDef.isEnabled(), updatedDef.isEnabled());
assertEquals(msg + "driftHandlingMode property not updated", updatedTemplateDef.getDriftHandlingMode(),
updatedDef.getDriftHandlingMode());
assertEquals(msg + "interval property not updated", updatedTemplateDef.getInterval(),