public void testCronResourceScheduling() throws Exception {
Resource resource = newResource;
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.SECOND, 2);
Subject overlord = overlord();
ResourceOperationSchedule schedule = operationManager.scheduleResourceOperationUsingCron(overlord,
resource.getId(), PREFIX + "testOp", calendar.get(Calendar.SECOND) + " " + calendar.get(Calendar.MINUTE)
+ " * * * ?", 20, null, 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() == resource.getId();
List<ResourceOperationSchedule> results;
results = operationManager.findScheduledResourceOperations(overlord, resource.getId());
assert results != null;
assert results.size() == 1;
ResourceOperationSchedule returnedSchedule = results.get(0);
assert returnedSchedule.getId() > 0 : returnedSchedule;
assert returnedSchedule.getJobId() != null : returnedSchedule;
assert returnedSchedule.getJobName() != null : returnedSchedule;
assert returnedSchedule.getJobGroup() != null : returnedSchedule;
assert returnedSchedule.getDescription().equals(PREFIX + "desc");
assert returnedSchedule.getOperationName().equals(PREFIX + "testOp");
assert returnedSchedule.getParameters() != null;
assert returnedSchedule.getResource().getId() == resource.getId();
System.out.println("WAITING FOR 4.5s FOR THE SCHEDULED OPERATION TO FINISH");
Thread.sleep(4500L);
PageList<ResourceOperationHistory> resultsHist;