package com.myrequest;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.node.*;
import java.io.FileInputStream;
import java.util.*;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.taskmgmt.*;
import org.jbpm.identity.*;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.db.GraphSession;
import org.jbpm.taskmgmt.exe.*;
import junit.framework.TestCase;
import com.myrequest.*;
public class ApproveActionHandler_db extends TestCase
{
static JbpmConfiguration jbpmConfiguration = null;
static {
// An example configuration file such as this can be found in
// 'src/config.files'. Typically the configuration information is in the
// resource file 'jbpm.cfg.xml', but here we pass in the configuration
// information as an XML string.
// First we create a JbpmConfiguration statically. One JbpmConfiguration
// can be used for all threads in the system, that is why we can safely
// make it static.
jbpmConfiguration = JbpmConfiguration.parseXmlString(
"<jbpm-configuration>" +
// A jbpm-context mechanism separates the jbpm core
// engine from the services that jbpm uses from
// the environment.
" <jbpm-context>" +
" <service name='persistence' " +
" factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
" </jbpm-context>" +
// Also all the resource files that are used by jbpm are
// referenced from the jbpm.cfg.xml
" <string name='resource.hibernate.cfg.xml' " +
" value='hibernate.cfg.xml' />" +
" <string name='resource.business.calendar' " +
" value='org/jbpm/calendar/jbpm.business.calendar.properties' />" +
" <string name='resource.default.modules' " +
" value='org/jbpm/graph/def/jbpm.default.modules.properties' />" +
" <string name='resource.converter' " +
" value='org/jbpm/db/hibernate/jbpm.converter.properties' />" +
" <string name='resource.action.types' " +
" value='org/jbpm/graph/action/action.types.xml' />" +
" <string name='resource.node.types' " +
" value='org/jbpm/graph/node/node.types.xml' />" +
" <string name='resource.varmapping' " +
" value='org/jbpm/context/exe/jbpm.varmapping.xml' />" +
"</jbpm-configuration>"
);
}
boolean isChiefHere;
String userId = "";
long processInstant_id;
public void setUp() {
userId = "dust";
isChiefHere = true;
}
public void test14DayAndBossNotApprove() throws Exception {
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
//this.deployProcessDefinition();
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
this.createProcessInstance();
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("----------------------------------------------------------------");
this.userWriteRequest(14);
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
this.chiefDecide(true);
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
this.bossDecide(false);
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
this.checkTasks();
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
/*
*/
}
/*
public void test4DayAndChiefApprove() throws Exception {
this.deployProcessDefinition();
this.createProcessInstance();
this.userWriteRequest(4);
this.chiefDecide(true);
this.checkTasks();
}
public void test14DayAndChiefApproveAndUserCancel() throws Exception {
this.deployProcessDefinition();
this.createProcessInstance();
this.userWriteRequest(14);
this.chiefDecide(true);
this.userCancel();
this.checkTasks();
}
*/
protected void deployProcessDefinition() throws Exception {
System.out.println("==MyRequestProcessTest.deployProcessDefinition()==");
ProcessDefinition processDefinition = null;
FileInputStream fis = new FileInputStream(
"E://JAVA_PROJECT//workspace//jbpm.3//src//java.jbpm//com//myrequest//processdefinition.xml");
processDefinition = ProcessDefinition.parseXmlInputStr
评论1
最新资源