[JBoss JIRA] Created: (JBPM-1338) Execution Context Variables
by Thomas Diesler (JIRA)
Execution Context Variables
----------------------------
Key: JBPM-1338
URL: http://jira.jboss.com/jira/browse/JBPM-1338
Project: JBoss jBPM
Issue Type: Task
Security Level: Public (Everyone can see)
Components: API
Reporter: Thomas Diesler
Assigned To: Thomas Diesler
Fix For: API 1.0.0.Alpha
Support execution context variables like this
public class ContextActivity implements Activity
{
public void execute(Node node, Context ctx)
{
String name = node.getName();
ctx.addAttachment(String.class, "ActivityMessage", "Activity on '" + name + "' has: " + ctx.getAttachments());
ctx.addAttachment(ContextValue.class, "ActivityAttachment", new ContextValue("bar"));
}
}
public void testTransientValues() throws Exception
{
// Create an Execution through the ProcessDefinition
ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
Execution ex = pd.createExecution();
// Set a context variable
ex.getContext().addAttachment(ContextValue.class, new ContextValue("foo"));
// Signal the execution
ex.signal();
// Verify context variables
String msg = ex.getContext().getAttachment(String.class, "ActivityMessage");
assertEquals("Activity on 'stateA' has: [[org.jboss.bpm.samples.context.ContextValue,null]]", msg);
// Validate original attachement
ContextValue att1 = ex.getContext().getAttachment(ContextValue.class);
assertEquals("foo", att1.getMsg());
// Validate activity attachement
ContextValue att2 = ex.getContext().getAttachment(ContextValue.class, "ActivityAttachment");
assertEquals("bar", att2.getMsg());
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 5 months
[JBoss JIRA] Created: (JBPM-1339) Engine Shutdown
by Thomas Diesler (JIRA)
Engine Shutdown
---------------
Key: JBPM-1339
URL: http://jira.jboss.com/jira/browse/JBPM-1339
Project: JBoss jBPM
Issue Type: Task
Security Level: Public (Everyone can see)
Components: API
Reporter: Thomas Diesler
Assigned To: Thomas Diesler
Fix For: API 1.0.0.Alpha
Support prepareForShutdown and cancelShutdown on the ProcessEngine.
/**
* Try to create a Execution during shutdown
*/
public void testCreateExecution() throws Exception
{
// Create a ProcessDefinition through the ProcessDefinitionManager
ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
assertNotNull("Execution expected", pd.createExecution());
// Try to create a Execution during shutdown
try
{
ProcessInstance pinst = pd.createProcessInstance();
engine.prepareForShutdown();
pinst.createExecution();
}
catch (EngineShutdownException ex)
{
assertEquals("Cannot create new Execution while engine is shutting down", ex.getMessage());
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 5 months
[JBoss JIRA] Created: (JBPM-1340) Basic Node Sequence
by Thomas Diesler (JIRA)
Basic Node Sequence
-------------------
Key: JBPM-1340
URL: http://jira.jboss.com/jira/browse/JBPM-1340
Project: JBoss jBPM
Issue Type: Task
Security Level: Public (Everyone can see)
Components: API
Reporter: Thomas Diesler
Assigned To: Thomas Diesler
Fix For: API 1.0.0.Alpha
Support a basic sequence like this
<process-definition>
<start-state>
<transition to='stateA' />
</start-state>
<state name='stateA'>
<transition to='end' />
</state>
<end-state name='end' />
</process-definition>
public void testBasicSequence() throws Exception {
// Create a ProcessDefinition through the ProcessDefinitionManager
ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
// Create an Execution through the ProcessDefinition
Execution ex = pd.createExecution();
assertEquals(pd.getStartNode(), ex.getNode());
// Signal the execution
ex.signal();
assertEquals(pd.findNode("stateA"), ex.getNode());
// Signal the execution
ex.signal();
assertEquals(pd.findNode("end"), ex.getNode());
assertEquals(pd.getEndNodes().iterator().next(), ex.getNode());
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 5 months