@Test
public void testMinutely()
throws UnitOfWorkCompletionException
{
Usecase usecase = UsecaseBuilder.newUsecase( "TestMinutely" );
DateTime start = new DateTime();
String taskIdentity;
long sleepMillis;
try( UnitOfWork uow = module.newUnitOfWork( usecase ) )
{
Scheduler scheduler = module.findService( Scheduler.class ).get();
FooTask task = createFooTask( uow, usecase.name(), BAZAR );
taskIdentity = task.identity().get();
DateTime expectedRun = start.withMillisOfSecond( 0 ).withSecondOfMinute( 0 ).plusMinutes( 1 );
scheduler.scheduleCron( task, "@minutely", true );
uow.complete();
sleepMillis = new Interval( start, expectedRun ).toDurationMillis();
LOGGER.info( "Task scheduled on {} to be run at {}", start.getMillis(), expectedRun.getMillis() );
}
await( usecase.name() ).
atMost( sleepMillis + 5000, MILLISECONDS ).
until( taskOutput( taskIdentity ), equalTo( BAR ) );
try( UnitOfWork uow = module.newUnitOfWork( usecase ) )
{