params.put(new PropertySimple("param2", "blah"));
// let the trigger not fire until several seconds from now so we can query the schedule itself
Trigger trigger = new SimpleTrigger(PREFIX + "triggername", PREFIX + "triggergroup", new Date(
System.currentTimeMillis() + 3600000L));
GroupOperationSchedule schedule = operationManager.scheduleGroupOperation(overlord(), newGroup.getId(), null,
true, 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.getGroup().getId() == newGroup.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<GroupOperationSchedule> schedules;
schedules = operationManager.findScheduledGroupOperations(overlord(), newGroup.getId());
assert schedules != null;
assert schedules.size() == 1;
GroupOperationSchedule returnedSchedule = schedules.get(0);
assert returnedSchedule.getSubject().equals(overlord());
assert returnedSchedule.getGroup().getId() == newGroup.getId();
assert returnedSchedule.getParameters() != null;
assert returnedSchedule.getOperationName().equals(PREFIX + "testOp");
assert returnedSchedule.getDescription().equals(PREFIX + "desc");
PageList<GroupOperationScheduleComposite> list;
list = operationManager.findCurrentlyScheduledGroupOperations(overlord(), PageControl.getUnlimitedInstance());
assert list.size() == 1;
assert list.get(0).getGroupId() == newGroup.getId();
assert list.get(0).getGroupName().equals(newGroup.getName());
assert list.get(0).getOperationName().equals("Test Operation");
// let's immediately unschedule it before it triggers
operationManager.unscheduleGroupOperation(overlord(), returnedSchedule.getJobId().toString(), returnedSchedule
.getGroup().getId());
list = operationManager.findCurrentlyScheduledGroupOperations(overlord(), PageControl.getUnlimitedInstance());
assert list.size() == 0;