Author: tom.baeyens(a)jboss.com
Date: 2009-05-27 10:04:11 -0400 (Wed, 27 May 2009)
New Revision: 4916
Modified:
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java
jbpm4/branches/tbaeyens/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionEventsTest.java
Log:
execution refactoring
Modified:
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
---
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-05-27
14:03:06 UTC (rev 4915)
+++
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-05-27
14:04:11 UTC (rev 4916)
@@ -559,9 +559,9 @@
}
EventImpl event = observableElement.getEvent(eventName);
- if ( (event==null)
- || (event.getListenerReferences()==null)
- || (event.getListenerReferences().isEmpty())
+ if ( (event!=null)
+ && (event.getListenerReferences()!=null)
+ && (!event.getListenerReferences().isEmpty())
) {
return event;
}
Modified:
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java
===================================================================
---
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java 2009-05-27
14:03:06 UTC (rev 4915)
+++
jbpm4/branches/tbaeyens/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java 2009-05-27
14:04:11 UTC (rev 4916)
@@ -22,6 +22,7 @@
package org.jbpm.pvm.internal.model.op;
import org.jbpm.api.JbpmException;
+import org.jbpm.api.model.Event;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -79,7 +80,7 @@
propagatingExecution = execution.createScope(activity);
}
-
propagatingExecution.performAtomicOperation(ExecutionImpl.TRANSITION_START_ACTIVITY);
+ propagatingExecution.fire(Event.START, activity,
ExecutionImpl.TRANSITION_START_ACTIVITY);
}
}
Modified:
jbpm4/branches/tbaeyens/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionEventsTest.java
===================================================================
---
jbpm4/branches/tbaeyens/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionEventsTest.java 2009-05-27
14:03:06 UTC (rev 4915)
+++
jbpm4/branches/tbaeyens/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionEventsTest.java 2009-05-27
14:04:11 UTC (rev 4916)
@@ -45,7 +45,48 @@
}
}
+ public void testBasicEvents(){
+ Recorder fromListener = new Recorder();
+ Recorder toListener = new Recorder();
+ Recorder transitionListener = new Recorder();
+ /*
+ +------+ +----+
+ | from |------->| to |
+ +------+ +----+
+ */
+
+ ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
+ .startProcess("p")
+ .startActivity("from", new WaitState())
+ .initial()
+ .startEvent(Event.END)
+ .listener(fromListener)
+ .endEvent()
+ .startFlow("to")
+ .listener(transitionListener)
+ .endFlow()
+ .endActivity()
+ .startActivity("to", new WaitState())
+ .startEvent(Event.START)
+ .listener(toListener)
+ .endEvent()
+ .endActivity()
+ .endProcess();
+
+ ClientExecution execution = processDefinition.startProcessInstance();
+ execution.signal();
+
+ assertEquals("[event(end) on activity(from)]",
+ fromListener.events.toString());
+
+ assertEquals("[event(take) on (from)-->(to)]",
+ transitionListener.events.toString());
+
+ assertEquals("[event(start) on activity(to)]",
+ toListener.events.toString());
+ }
+
public void testCompositeLeave(){
Recorder processListener = new Recorder();
Recorder outsideListener = new Recorder();
Show replies by date