package com.blueland.ebpm.engine.core.service;

import java.util.HashMap;
import java.util.Map;

import com.blueland.bpm.engine.core.service.ProcessExecuteService;
import com.blueland.ebpm.engine.BaseWfServiceTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;

import com.blueland.bpm.engine.core.model.ProcessInputModel;
import com.blueland.bpm.engine.util.WorkFlowContants;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
@RunWith(SpringRunner.class)
public class LeaveTest extends BaseWfServiceTest {
	@Autowired
	private ProcessExecuteService processExecuteService;
	
	@Test
	public void testLeve(){
		ProcessInputModel wfCommunicate1=getStrartMap();
		processExecuteService.nextExecute(wfCommunicate1);
		
		/*ProcessInputModel wfCommunicate2=getDeptLeaderSpMap();
		wfCommunicate2.setWf_procInstId("21301");
		wfCommunicate2.setWf_curActInstId("21310");
		processExecuteService.nextExecute(wfCommunicate2);*/
		
		
	}
	private ProcessInputModel getStrartMap(){
		Map fieldsMap=new HashMap();
		fieldsMap.put("userId", "1w");
		fieldsMap.put("userName", "龙文");
		ProcessInputModel communicate=new ProcessInputModel();
		communicate.setWf_procTitle("测试请假流程1");
		communicate.setWf_procDefId("my-leave-manual:3:21104");
		communicate.setWf_procDefKey("my-leave");
		communicate.setWf_actionType(WorkFlowContants.ACTION_TYPE_LAUCH_PROCESS);
		communicate.setWf_nextActDefId("zgLeader_sp");
		communicate.setWf_sender("longwen");
		communicate.setWf_receiver("zhuguanlingdao");
		communicate.setFields(fieldsMap);
		return communicate;
	}
	
	private ProcessInputModel getDeptLeaderSpMap(){
		ProcessInputModel communicate=new ProcessInputModel();
		communicate.setWf_procTitle("测试请假流程1");
		communicate.setWf_procDefId("my-leave-manual:3:21104");
		communicate.setWf_procDefKey("my-leave");
		communicate.setWf_actionType(WorkFlowContants.ACTION_TYPE_EXECUTE_ACTIVITY);
		communicate.setWf_curActDefId("zgLeader_sp");
		communicate.setWf_nextActDefId("sg_dept_nb_sp");
		communicate.setWf_sender("zhuguanlingdao");
		communicate.setWf_receiver("longwen");
		return communicate;
	}
	
}
