params.put(new PropertySimple("param1", "group-test"));
params.put(new PropertySimple("param2", "blah"));
Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date(
System.currentTimeMillis() + 10000L));
ResourceOperationSchedule schedule = operationManager.scheduleResourceOperation(overlord(), resource.getId(),
PREFIX + "testOp", params, trigger, PREFIX + "desc");
assert schedule != null;
assert schedule.getDescription().equals(PREFIX + "desc");
assert schedule.getOperationName().equals(PREFIX + "testOp");
assert schedule.getParameters() != null;
assert schedule.getResource().getId() == newResource.getId();
int configId = params.getId();
Configuration returnedConfiguration = configurationManager.getConfigurationById(configId);
assert returnedConfiguration.getProperties().size() == 2;
assert returnedConfiguration.getSimple("param1").getStringValue().equals("group-test");
assert returnedConfiguration.getSimple("param2").getStringValue().equals("blah");
List<ResourceOperationSchedule> schedules;
schedules = operationManager.findScheduledResourceOperations(overlord(), resource.getId());
assert schedules != null;
assert schedules.size() == 1;
ResourceOperationSchedule returnedSchedule = schedules.get(0);
assert returnedSchedule.getSubject().equals(overlord());
assert returnedSchedule.getResource().getId() == resource.getId();
assert returnedSchedule.getParameters() != null;
assert returnedSchedule.getOperationName().equals(PREFIX + "testOp");
assert returnedSchedule.getDescription().equals(PREFIX + "desc");
// let's immediately unschedule it before it triggers
operationManager.unscheduleResourceOperation(overlord(), returnedSchedule.getJobId().toString(),
returnedSchedule.getResource().getId());
// history should never have existed - we unscheduled faster than its trigger
PageList<ResourceOperationHistory> results;
results = operationManager.findCompletedResourceOperationHistories(overlord(), resource.getId(), null, null,
PageControl.getUnlimitedInstance());