package com.huike.hidp.system.workflow.service.impl;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import org.jbpm.api.Execution;
import org.jbpm.api.task.Task;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.huike.hidp.system.workflow.service.WorkFlowService;
import com.huike.hidp.system.workflow.service.util.JbpmTemplate;
public class WorkFlowServiceImplTest {
private static File zipFile = new File("WebRoot/jbpm/MyLeave.zip");
private static WorkFlowService workFlowService = null;
private static JbpmTemplate t = null;
private File file = null;
@BeforeClass
public static void setUp() throws Exception {
// new WorkFlowServiceImplTest().getWorkFlowServicesImpl();
String classPath = ClassLoader.getSystemResource("").toString();
int leg = classPath.substring(0, classPath.length() - 1).lastIndexOf(
"/");
classPath = classPath.substring(0, leg);
ApplicationContext ctx = new ClassPathXmlApplicationContext(
new String[] {
classPath + "/xml/hidp/applicationContext-service.xml",
classPath + "/xml/hidp/applicationContext-dao.xml",
classPath + "/xml/hidp/applicationContext.xml" });
workFlowService = (WorkFlowService) ctx
.getBean("workFlowService");
}
public static void p(Object o) {
System.out.println(o);
}
//
// @Test
// public void getWorkFlowServiceImpl() throws IOException {
// workFlowService = WorkFlowServiceImpl.getWorkFlowServiceImpl(zipFile);
// p(workFlowService);
// workFlowService = WorkFlowServiceImpl.getWorkFlowServiceImpl(zipFile);
// p(workFlowService);
// assertTrue(WorkFlowServiceImpl.getWorkFlowServiceImpl(zipFile) == WorkFlowServiceImpl
// .getWorkFlowServiceImpl(zipFile));
// }
@Test
public void testDeploy() throws Exception {
workFlowService.deployProcess(zipFile);
}
public void assignTask(String taskId, String userId) throws Exception {
// TODO Auto-generated method stub
}
public void completeTask(String taskId) throws Exception {
// TODO Auto-generated method stub
}
public boolean deleteProcess() throws Exception {
List plist = workFlowService.getProcessList();
String[] pId = new String[plist.size()] ;
plist.get(0);
return workFlowService.deleteProcess(pId);
}
public boolean deployProcess(File file) throws Exception {
return t.deploy(file);
}
public Execution findExecutionById(String executionId) throws Exception {
// TODO Auto-generated method stub
return null;
}
public Map<String, Object> getExecutionServiceVariables(String executionId)
throws Exception {
// TODO Auto-generated method stub
return null;
}
public Object getProcessDefinition(String[] pId) throws Exception {
// TODO Auto-generated method stub
return null;
}
public List getProcessList() throws Exception {
return null;
}
public List<Task> getUnassigned() throws Exception {
// TODO Auto-generated method stub
return null;
}
public InputStream imageStrean(String piId) throws Exception {
// TODO Auto-generated method stub
return null;
}
public boolean isActive(String activeName, String executionId)
throws Exception {
// TODO Auto-generated method stub
return false;
}
public boolean saveOrUpdateProcessState(String pid) {
// TODO Auto-generated method stub
return false;
}
public boolean serverDeployProcess(String path) throws Exception {
// TODO Auto-generated method stub
return false;
}
public void setExecutionServiceVariables(String executionId,
Map<String, Object> variables) throws Exception {
// TODO Auto-generated method stub
}
public void startProcessInstanceByKey(String key) throws Exception {
// TODO Auto-generated method stub
}
}
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import org.jbpm.api.Execution;
import org.jbpm.api.task.Task;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.huike.hidp.system.workflow.service.WorkFlowService;
import com.huike.hidp.system.workflow.service.util.JbpmTemplate;
public class WorkFlowServiceImplTest {
private static File zipFile = new File("WebRoot/jbpm/MyLeave.zip");
private static WorkFlowService workFlowService = null;
private static JbpmTemplate t = null;
private File file = null;
@BeforeClass
public static void setUp() throws Exception {
// new WorkFlowServiceImplTest().getWorkFlowServicesImpl();
String classPath = ClassLoader.getSystemResource("").toString();
int leg = classPath.substring(0, classPath.length() - 1).lastIndexOf(
"/");
classPath = classPath.substring(0, leg);
ApplicationContext ctx = new ClassPathXmlApplicationContext(
new String[] {
classPath + "/xml/hidp/applicationContext-service.xml",
classPath + "/xml/hidp/applicationContext-dao.xml",
classPath + "/xml/hidp/applicationContext.xml" });
workFlowService = (WorkFlowService) ctx
.getBean("workFlowService");
}
public static void p(Object o) {
System.out.println(o);
}
//
// @Test
// public void getWorkFlowServiceImpl() throws IOException {
// workFlowService = WorkFlowServiceImpl.getWorkFlowServiceImpl(zipFile);
// p(workFlowService);
// workFlowService = WorkFlowServiceImpl.getWorkFlowServiceImpl(zipFile);
// p(workFlowService);
// assertTrue(WorkFlowServiceImpl.getWorkFlowServiceImpl(zipFile) == WorkFlowServiceImpl
// .getWorkFlowServiceImpl(zipFile));
// }
@Test
public void testDeploy() throws Exception {
workFlowService.deployProcess(zipFile);
}
public void assignTask(String taskId, String userId) throws Exception {
// TODO Auto-generated method stub
}
public void completeTask(String taskId) throws Exception {
// TODO Auto-generated method stub
}
public boolean deleteProcess() throws Exception {
List plist = workFlowService.getProcessList();
String[] pId = new String[plist.size()] ;
plist.get(0);
return workFlowService.deleteProcess(pId);
}
public boolean deployProcess(File file) throws Exception {
return t.deploy(file);
}
public Execution findExecutionById(String executionId) throws Exception {
// TODO Auto-generated method stub
return null;
}
public Map<String, Object> getExecutionServiceVariables(String executionId)
throws Exception {
// TODO Auto-generated method stub
return null;
}
public Object getProcessDefinition(String[] pId) throws Exception {
// TODO Auto-generated method stub
return null;
}
public List getProcessList() throws Exception {
return null;
}
public List<Task> getUnassigned() throws Exception {
// TODO Auto-generated method stub
return null;
}
public InputStream imageStrean(String piId) throws Exception {
// TODO Auto-generated method stub
return null;
}
public boolean isActive(String activeName, String executionId)
throws Exception {
// TODO Auto-generated method stub
return false;
}
public boolean saveOrUpdateProcessState(String pid) {
// TODO Auto-generated method stub
return false;
}
public boolean serverDeployProcess(String path) throws Exception {
// TODO Auto-generated method stub
return false;
}
public void setExecutionServiceVariables(String executionId,
Map<String, Object> variables) throws Exception {
// TODO Auto-generated method stub
}
public void startProcessInstanceByKey(String key) throws Exception {
// TODO Auto-generated method stub
}
}