/**
* Create a new process and then remove its process definition.
*/
public void createProcess1AndRemoveProcessDef() throws Exception {
ProcessDefinitionDirectory pdd = null;
try {
WfRequester cont = new DefaultRequester(workflowService());
Process process = (Process)createProcess("ut-process", "jut1", cont);
assertTrue(process.state().startsWith("open.not_running.not_started"));
process.start();
assertTrue(process.state().startsWith("open.running"));
// remove its process definition
pdd = workflowService().processDefinitionDirectory ();
ProcessDefinition pd
= pdd.lookupProcessDefinition("ut-process", "jut1");
assertTrue(pd!=null);
pdd.removeProcessDefinition("ut-process", "jut1");
boolean gotEx = false;
try {
pd = pdd.lookupProcessDefinition("ut-process", "jut1");
} catch (Exception ex) {
gotEx = true;
}
assertTrue(gotEx);
// check the process definition of the process
ProcessDefinition procDef = process.processDefinition();
assertTrue(procDef.packageId().equals("ut-process"));
assertTrue(procDef.processId().equals("jut1"));
// import the process definition again.
importProcessDefinitions();
pd = pdd.lookupProcessDefinition("ut-process", "jut1");
assertTrue(pd!=null);
} finally {
workflowService().release (pdd);
}
}