@Override public void delayActivity(long time) { calls.add("delayActivity"); ActivityExecutionContextProvider provider = new ActivityExecutionContextProviderImpl(); ActivityExecutionContext context = provider.getActivityExecutionContext(); try { while (true) { Thread.sleep(time * 1000); context.recordActivityHeartbeat(null); } } catch (InterruptedException e) { } }
/** * Useful for unit testing activities. */ public CronExampleActivitiesImpl(ActivityExecutionContextProvider contextProvider) { this.contextProvider = contextProvider; }
/** * For unit testing or IoC */ public PeriodicWorkflowActivitiesImpl(ActivityExecutionContextProvider contextProvider) { this.contextProvider = contextProvider; }
/** * For unit testing or IoC */ public ErrorReportingActivitiesImpl(ActivityExecutionContextProvider contextProvider) { this.contextProvider = contextProvider; }