SnakerEngineFacets { public Order startAndExecute(String name, Integer version, String operator, Map<String, Object> args) { Order order = engine.startInstanceByName(name, version, operator, args); List<Task> tasks = engine.query().getActiveTasks(new QueryFilter().setOrderId(order.getId())); List<Task> newTasks = new ArrayList<Task>(); if (tasks != null && tasks.size() > 0) { Task task = tasks.get(0); newTasks.addAll(engine.executeTask(task.getId(), operator, args)); } return order; }  String initFlows(); List<Process> getAllProcess(); List<Process> getProcessByOrderId(String orderId); SnakerEngine getEngine(); List<String> getAllProcessNames(); Order startInstanceById(String processId, String operator, Map<String, Object> args); Order startInstanceByName(String name, Integer version, String operator, Map<String, Object> args); Order startAndExecute(String name, Integer version, String operator, Map<String, Object> args); Order startAndExecute(String processId, String operator, Map<String, Object> args); List<Task> execute(String taskId, String operator, Map<String, Object> args); List<Task> executeAndJump(String taskId, String operator, Map<String, Object> args, String nodeName); List<Task> getTasks(String orderId);  }
@Test public void testStartAndExecute() { snakerEngineFacets.initFlows(); List<Process> allProcess = snakerEngineFacets.getAllProcess(); if (!CollectionUtils.isEmpty(allProcess)) { Process process = allProcess.get(0); Order dm = snakerEngineFacets.startAndExecute(process.getId(), "apply.operator", null); Assert.assertNotNull(dm); } }
@Test public void startAndExecute() { snakerEngineFacets.initFlows(); List<Process> allProcess = snakerEngineFacets.getAllProcess(); if (!CollectionUtils.isEmpty(allProcess)) { Process process = allProcess.get(0); Order dm = snakerEngineFacets.startAndExecute(process.getName(), 0, "apply.operator", null); Assert.assertNotNull(dm); } }