System.out.println("Contains : " + inst.getName());
}
System.out.println();
Assert.assertNotNull("DayState is not found in the composite", dayinst);
ToolManager manager = (ToolManager) managerinst.getServiceObject();
DayState state = (DayState) dayinst.getServiceObject();
ThreadWrapper_grant thread = new ThreadWrapper_grant(worker1);
System.out.println(">19h : afternoon !");
state.setHour(19);
thread = new ThreadWrapper_grant(worker1);
thread.setDaemon(true);
thread.start();
apam.waitForIt(1000);
Assert.assertFalse(
"As the JackHammer is granted (afternoon), the worker resolution should be ok -> thread should be ended",
thread.isAlive());
System.out.println(">23h : night !");
state.setHour(23);
thread = new ThreadWrapper_grant(worker1);
thread.setDaemon(true);
thread.start();
apam.waitForIt(1000);
;
manager.printTools();
Assert.assertTrue(
"As the JackHammer is not granted (night again), the worker resolution should fail -> thread should be waiting",
thread.isAlive());
}