Resource resource = newResource1;
Subject overlord = LookupUtil.getSubjectManager().getOverlord();
// create a couple update/requests in history - one request will fail, so only a single config in history will be there
Configuration configuration1 = new Configuration();
configuration1.put(new PropertySimple("myboolean", "invalid-boolean"));
Configuration configuration2 = new Configuration();
configuration2.put(new PropertySimple("myboolean", "true"));
Configuration activeConfigurationBefore = configurationManager.getResourceConfiguration(resource.getId());
configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration1);
Thread.sleep(2000); // wait for the test agent to complete the request
Configuration activeConfigurationAfter = configurationManager.getResourceConfiguration(resource.getId());
assert activeConfigurationBefore.equals(activeConfigurationAfter) : "ActiveResourceConfiguration was not supposed to change for a failed update -- old was: "
+ activeConfigurationBefore + ", new was: " + activeConfigurationAfter;
configurationManager.updateResourceConfiguration(overlord, resource.getId(), configuration2);
Thread.sleep(2000); // wait for the test agent to complete the request
Configuration activeConfiguration = configurationManager.getResourceConfiguration(resource.getId());
assert activeConfiguration != null : "ActiveResourceConfiguration was not updated with configuration2";
Map<String, PropertySimple> activeProperties = activeConfiguration.getSimpleProperties();
assert activeProperties.size() == 1;
assert activeProperties.containsKey("myboolean");
PropertySimple activeProperty = activeProperties.get("myboolean");
assert activeProperty.getName().equals("myboolean");
assert "true".equals(activeProperty.getStringValue());