try {
PropertySimple mysleep = request.getConfiguration().getSimple("mysleep");
PropertySimple mybool = request.getConfiguration().getSimple("myboolean");
assert mybool != null;
ConfigurationUpdateResponse response;
if (mybool.getStringValue().equalsIgnoreCase("true")) {
savedConfiguration = request.getConfiguration();
// tests need us to sleep AFTER we save the config
if (mysleep != null) {
Thread.sleep(mysleep.getLongValue());
}
response = new ConfigurationUpdateResponse(request.getConfigurationUpdateId(), null,
ConfigurationUpdateStatus.SUCCESS, null);
} else if (mybool.getStringValue().equalsIgnoreCase("false")) {
savedConfiguration = request.getConfiguration();
// tests need us to sleep AFTER we save the config
if (mysleep != null) {
Thread.sleep(mysleep.getLongValue());
}
response = new ConfigurationUpdateResponse(request.getConfigurationUpdateId(), null,
ConfigurationUpdateStatus.SUCCESS, null);
} else {
mybool.setErrorMessage(ThrowableUtil.getStackAsString(new IllegalArgumentException(
"Not a valid boolean")));
response = new ConfigurationUpdateResponse(request.getConfigurationUpdateId(),
request.getConfiguration(), new NullPointerException("This simulates a failed update"));
}
LookupUtil.getConfigurationManager().completeResourceConfigurationUpdate(response);
} catch (Throwable t) {