Activiti学习资料,业务对象和流程关联测试
java代码如下:
/**
* 请假流程测试
*
* @author HenryYan
*
*/
public class LeaveWorkflowTestUT extends BaseWorkflowTest {
@Autowired
LeaveWorkflowService workflowService;
@Before
public void setUp() throws Exception {
PropertyFileUtil.init();
String filePath = getProcessDefinitionXmlDir() + "oa/leave/leave.bpmn20.xml";
deployprocessDefinition(filePath);
deleteFromTables("OA_LEAVE");
}
@Test
public void verifyProcess() {
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").list();
Assert.assertEquals(1, list.size());
}
/**
* 通过审核流程|正常流程
* @throws Exception
*/
@Test
public void pass() throws Exception {
Leave entity = new Leave();
setLeaveData(entity);
User user = UserUtil.getUserFromMemoryCache(4l, true);
Map<String, Object> startWorkflow = workflowService.startWorkflow(entity, user);
assertNotNull(startWorkflow);
workflowService.getEntityManager().flush();
Assert.assertEquals(1,