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

import com.blueland.bpm.engine.core.service.AutoRunOneProcess;
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.JsonUtil;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
@RunWith(SpringRunner.class)
public class AutoRunOneProcessTest extends BaseWfServiceTest {
	@Autowired
    AutoRunOneProcess autoRunOneProcess;
	@Autowired
	private ProcessExecuteService processExecuteService;
	// test_pt普通流程,test_expall 测试条件网关,testparentflow,测试父子流程,testParallelGateway:测试并行网关啊,test_neiqiansubflow内嵌子流程,testparentflow 测试父子流程 
	 String procDefKey = "testparentflow";

	@Test
	public void testOneProcess() {
		//autoRunOneProcess.autoRunOneProcess(procDefKey);
	}

	@Test
	public void testByJson(){
		ProcessInputModel processInputModel=(com.blueland.bpm.engine.core.model.ProcessInputModel) JsonUtil.convertToBean("{\"wf_appId\":\"STDD_SYS\",\"wf_procTitle\":\"测试父子流程d3\",\"wf_actionType\":\"execute_activity\",\"wf_procDefId\":\"testsubhree:1:b979b544-ff82-11e4-9da0-68f72803f161\",\"wf_procDefKey\":\"testsubhree\",\"wf_procDefName\":\"三级子流程\",\"wf_procInstId\":\"e6556b13-7cc4-11e5-8ffd-68f72803f161\",\"wf_parentProcInstId\":null,\"wf_curActDefId\":\"sid-C07158C8-60A0-4EDA-B5B8-026857274885\",\"wf_curActDefType\":null,\"wf_curActDefName\":\"3级普通环节2\",\"wf_curActInstId\":\"44e38179-7cc5-11e5-9e91-68f72803f161\",\"wf_curActInstName\":null,\"wf_nextActDefId\":\"\",\"wf_nextActDefName\":\"\",\"wf_nextActDefType\":\"\",\"wf_preActSender\":\"huangj0222\",\"wf_sendUserId\":\"yangzhm0819\",\"wf_sender\":null,\"wf_sendUserName\":null,\"wf_sendUserOrgId\":\"2043000101\",\"wf_sendUserOrgName\":null,\"wf_sendUserCompanyId\":null,\"wf_receivers\":null,\"wf_receiver\":null,\"wf_pageDealTime\":null,\"wf_fields\":\"<fields><bizData>测试父子流程d3</bizData><createUserId></createUserId><createUserName></createUserName><isAgreeVal></isAgreeVal><leaveDay>测试父子流程d3</leaveDay><leaveReason>测试父子流程d3</leaveReason><leaveType>0</leaveType><startDate>测试父子流程d3</startDate><throughbizData>测试父子流程d3</throughbizData></fields>\",\"wf_variables\":{},\"fields\":{\"bizData\":\"测试父子流程d3\",\"createUserId\":\"\",\"createUserName\":\"\",\"isAgreeVal\":\"\",\"leaveDay\":\"测试父子流程d3\",\"leaveReason\":\"测试父子流程d3\",\"leaveType\":\"0\",\"startDate\":\"测试父子流程d3\",\"throughbizData\":\"测试父子流程d3\"},\"wf_attachments\":\"\",\"wf_curComment\":\"\",\"wf_batchId\":null,\"wf_commentDisplayArea\":\"\",\"wf_businessKey\":\"ba700491-9304-49c3-9e19-58bed2939b12\",\"wf_businessDataObject\":{\"objectType\":null,\"bizData\":\"测试父子流程d3\"},\"wf_throughBizDataObject\":{\"objectType\":null,\"bizData\":\"测试父子流程d3\"},\"wf_uniteworkUrl\":null,\"wf_actLimitTime\":0}", ProcessInputModel.class);
		processExecuteService.nextExecute(processInputModel);
		
	}
}
