[jboss-user] [JBoss jBPM] - Re: WARN [ProxyWarnLog] Narrowing proxy to class org.jbpm.g
vnm
do-not-reply at jboss.com
Mon Jun 29 08:40:18 EDT 2009
Hi Ronald,
Sending you a single java file that contains all things used in my process..
package org.jbpm.job.executor;
|
| import java.util.ArrayList;
| import java.util.Collections;
| import java.util.HashSet;
| import java.util.List;
| import java.util.Set;
| import java.util.TreeSet;
|
| import org.jbpm.db.AbstractDbTestCase;
| import org.jbpm.graph.def.Action;
| import org.jbpm.graph.def.ActionHandler;
| import org.jbpm.graph.def.ProcessDefinition;
| import org.jbpm.graph.exe.ExecutionContext;
| import org.jbpm.graph.exe.ProcessInstance;
|
| public class JobExecutorDbTest extends AbstractDbTestCase {
|
| static final int nbrOfConcurrentProcessExecutions = 20;
| static final int timeout = 60000;
|
| static Set<String> collectedResults = Collections.synchronizedSet(new TreeSet<String>());
| static List<Long> allocatedProcessIds = Collections.synchronizedList(new ArrayList<Long>());
|
| @Override
| protected void setUp() throws Exception {
| super.setUp();
| getJbpmConfiguration().getJobExecutor().setNbrOfThreads(4);
| }
|
| @Override
| protected void tearDown() throws Exception {
| getJbpmConfiguration().getJobExecutor().setNbrOfThreads(1);
| super.tearDown();
| }
|
| public void testJobExecutor() {
| deployProcessDefinition();
| try {
| ServiceVO serviceVO = new ServiceVO();
| serviceVO.setProcessDefinitionName("SuperStateSample");
| initiateProcess(serviceVO);
| processJobs(timeout);
| // assertEquals(getExpectedResults(), collectedResults);
| }
| finally {
|
| }
| }
|
| void deployProcessDefinition() {
| ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("
| <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="SuperStateSample">
|
|
| <start-state name="start-state1">
| <transition to="node1"></transition>
| </start-state>
|
|
| <node name="node1">
| <event type="node-enter">
| <action name="action1" class="ActionHandler1.class.getName()"></action>
| </event>
| <transition to="super-state1"></transition>
| </node>
|
| <super-state name="super-state1">
| <node name="node3">
| <event type="node-enter">
| <action name="action3" class="ActionHandler1.class.getName()"></action>
| </event>
| <transition to="join1"></transition>
| </node>
| <node name="node4">
| <event type="node-enter">
| <action name="action4" class="ActionHandler1.class.getName()"></action>
| </event>
| <transition to="join1"></transition>
| </node>
| <decision name="decision1">
| <handler class="DecisionHandler1.class.getName()"></handler>
| <transition to="node3" name="node3"></transition>
| <transition to="join1" name="to join1"></transition>
| </decision>
| <decision name="decision2">
| <handler class="DecisionHandler2.class.getName()"></handler>
| <transition to="node4" name="node4"></transition>
| <transition to="join1" name="to join1"></transition>
| </decision>
| <join name="join1">
| <transition to="node5"></transition>
| </join>
| <fork name="fork1">
| <transition to="decision1"></transition>
| <transition to="decision2" name="to decision2"></transition>
| </fork>
| <node name="node5">
| <event type="node-enter">
| <action class="ActionHandler1.class.getName()"></action>
| </event>
| </node>
| <node name="node2">
| <event type="node-enter">
| <action name="action2" class="ActionHandler1.class.getName()"></action>
| </event>
| <transition to="fork1"></transition>
| </node>
| <transition to="end-state1"></transition>
| </super-state>
|
|
| <end-state name="end-state1"></end-state>
|
|
| </process-definition>");
| jbpmContext.deployProcessDefinition(processDefinition);
|
| }
|
| void initiateProcess(ServiceVO serviceVO) {
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| String processName = serviceVO.getProcessDefinitionName();
| logger.info("processName==="+processName);
| ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate(processName);
| logger.info("--------------after getting processInstance");
| long processInstanceId = processInstance.getId();
|
| Token token = processInstance.getRootToken();
| logger.info("--------------after getting token");
| ContextInstance contextInstance = processInstance.getContextInstance();
| logger.info("--------------after getting contextInstance");
| contextInstance.setVariable("serviceVO", serviceVO);
|
| /*if(processVariables!=null){
| Set keySet = processVariables.keySet();
| Iterator keyIterator = keySet.iterator();
| String key = null;
| Object obj = null;
| while(keyIterator.hasNext()){
|
| key = (String)keyIterator.next();
| obj = processVariables.get(key);
|
| contextInstance.setVariable(key,obj);
|
| }
| }*/
| processInstance.signal();
| logger.info("---------after processInstance singal");
| logger.info("--------------after signal");
|
| logger.info("--------------after saving token");
| jbpmContext.save(processInstance);
| logger.info("--------------after saving processInstance");
| logger.info("root token======="+token.getId());
|
|
|
| jbpmContext.close();
| }
| }
|
| //start
| class ServiceVO implements Serializable{
|
|
|
| private String processDefinitionName;
|
|
| public String getProcessDefinitionName() {
| return processDefinitionName;
| }
|
| public void setProcessDefinitionName(String processDefinitionName) {
| this.processDefinitionName = processDefinitionName;
| }
|
|
|
| }
| //end
|
|
| //start
| class ActionHandler1 implements ActionHandler{
|
| public void execute(ExecutionContext executionContext) throws Exception {
| System.out.println("===========>>>>in action handler 1 >>>>>>>>>");
|
| }
| //end
|
| //start
| class DecisionHandler1 implements DecisionHandler {
| public String decide(ExecutionContext arg0) throws Exception {
| // TODO Auto-generated method stub
| System.out.println("--in handler1-");
| return "node3";
| }
| //end
|
| //start
| class DecisionHandler2 implements DecisionHandler {
| public String decide(ExecutionContext arg0) throws Exception {
| // TODO Auto-generated method stub
| System.out.println("--in handler2-");
| return "node4";
| }
|
| }
| //end
Thanks
vnm
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4240732#4240732
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4240732
More information about the jboss-user
mailing list