private static void testExecutionDependencies() throws Exception { long failed, pending; boolean bad; int flowId = persistenceTest.createFlow(persistenceTest.prepareUnits()); execution.runFlow(flowId); // kicks start queue into action // at this point tasks with serial number 0 should be 'Failed' and serial number 1 should be // 'Pending' List<Task> tasks; int iterations = 0; do { Thread.sleep((++iterations) * 200); tasks = persistenceTest.persistence.getTasks(flowId); failed = getTaskCount(tasks, 0, TaskStatus.FAILED); pending = getTaskCount(tasks, 1, TaskStatus.PENDING); } while ((bad = (failed != 2 || pending != 4)) && iterations < 5); assert !bad; }
private static void close() throws PersistenceException { execution.stop(); persistenceTest.close(); }
private static void init() { execution = new ExecutionImpl(persistenceTest.persistence, persistenceTest.configuration.getMachines()); execution.start(); }