LogManager.getLogManager().getLogger("").setLevel(Level.SEVERE);
}
public void testCurrentTaskWallClockTime() {
// at first, there is no start date time
WorkflowInstance inst = new WorkflowInstance();
WorkflowTask task = new WorkflowTask();
task.setTaskId("urn:oodt:testTask");
ParentChildWorkflow workflow = new ParentChildWorkflow(new Graph());
workflow.getTasks().add(task);
inst.setParentChildWorkflow(workflow);
inst.setCurrentTaskId("urn:oodt:testTask");
assertEquals(Double.valueOf(0.0), Double
.valueOf(ThreadPoolWorkflowEngine
.getCurrentTaskWallClockMinutes(inst)));
// now set start date time, and assert that wall clock minutes > 0
inst.setCurrentTaskStartDateTimeIsoStr(DateConvert
.isoFormat(new Date()));
System.out.println(ThreadPoolWorkflowEngine.getCurrentTaskWallClockMinutes(inst));
assertTrue(ThreadPoolWorkflowEngine
.getCurrentTaskWallClockMinutes(inst) > 0.0);
// set end date time to "" and make sure wall clock mins still greater
// than 0
inst.setCurrentTaskEndDateTimeIsoStr("");
assertTrue(ThreadPoolWorkflowEngine
.getCurrentTaskWallClockMinutes(inst) > 0.0);
// set the end date time, compute it, and make sure it stays the same
String endDateTimeIsoStr = DateConvert.isoFormat(new Date());
inst.setCurrentTaskEndDateTimeIsoStr(endDateTimeIsoStr);
double wallClockMins = ThreadPoolWorkflowEngine
.getCurrentTaskWallClockMinutes(inst);
assertEquals(Double.valueOf(wallClockMins), Double
.valueOf(ThreadPoolWorkflowEngine
.getCurrentTaskWallClockMinutes(inst)));
assertEquals(Double.valueOf(wallClockMins), Double
.valueOf(ThreadPoolWorkflowEngine
.getCurrentTaskWallClockMinutes(inst)));
// set the start date time after the end date time
// make sure that the wall cock time is 0.0
inst.setCurrentTaskStartDateTimeIsoStr(DateConvert
.isoFormat(new Date()));
assertEquals(Double.valueOf(0.0), Double
.valueOf(ThreadPoolWorkflowEngine
.getCurrentTaskWallClockMinutes(inst)));