i'm evaluating Camunda engine at the moment, and have got the following issue using it:
Given:
Vanilla Wildfly 8.0.0
Camunda as compiled dependency in a Maven-Project
Camunda is configered in the processes.xml as follows:
<process-engine name="spo-process-engine">
<configuration>org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration</configuration>
<datasource>java:jboss/datasources/ProcessEngine</datasource>
<properties>
<property name="databaseSchemaUpdate">true</property>
<property name="jobExecutorActivate">true</property>
</properties>
</process-engine>
<process-archive name="spo-basic-process">
<process-engine>spo-process-engine</process-engine>
<properties>
<property name="isDeleteUponUndeploy">true</property>
<property name="isScanForProcessDefinitions">true</property>
</properties>
</process-archive>
</process-application>
In my sourcecode I use it as follows:
@Stateless
@Named
public class WorkflowService {
private static final String USER_ID_VARIABLE = "userId";
private static final String PROCESS_DEFINITION_KEY = "spo-basic-process";
@Inject
@ProcessEngineName(value = "spo-process-engine")
private RuntimeService runtimeService;
public ProcessInstance startWorkflowInstance(Long userId) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put(USER_ID_VARIABLE, userId);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY, variables);
return processInstance;
}
}
I wrote the following Arquillian test for it:
@RunWith(Arquillian.class)
public class WorkflowServiceTest {
@Deployment
public static WebArchive createDeployment() {
File[] resolvedFiles = Maven.resolver().loadPomFromFile("pom.xml").importCompileAndRuntimeDependencies()
.resolve().withTransitivity().asFile();
WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "spo-process.war").addClass(WorkflowService.class)
.addAsLibraries(resolvedFiles)
.addAsWebResource("META-INF/processes.xml", "WEB-INF/classes/META-INF/processes.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")
.addPackage(WorkflowService.class.getPackage()).addPackage(SPO.class.getPackage())
.addAsResource("SPOBasicProcess.bpmn").addAsResource("SPOBasicProcess.png");
return webArchive;
}
@Inject
private WorkflowService workflowService;
@Test
@InSequence(1)
public void startWorkflowInstanceTest() {
ProcessInstance processInstance = workflowService.startWorkflowInstance(new Long(7000L));
Assert.assertNotNull(processInstance);
}
}
The test fails with the following error message:
org.camunda.bpm.engine.ProcessEngineException: no processes deployed with key 'spo-basic-process'
The test works just fine, when I just set a couple of breakpoints and try to debug the code. I assume, that during a normal test run, the PorcessDefinition has not been deployed yet (because the engine runs in it's own thread), at the moment as I try to load it again in the test method. During debugging though, the engine thread has enough time to deploy the process definition.
How can this problem be solved? Can I somehow tell the RuntimeService to wait untill the ProcessDefinition I'm looking for has been deployed and start a process inctanse afterwards? Or have I forgotten something by the configuration of the engine?
Thank you in advance for your help!
Regards,
Iryna.
File[] resolvedFiles = Maven.resolver().loadPomFromFile("pom.xml").importCompileAndRuntimeDependencies()
.resolve().withTransitivity().asFile();--
You received this message because you are subscribed to a topic in the Google Groups "camunda BPM users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/camunda-bpm-users/z8hrkSEWC18/unsubscribe.
To unsubscribe from this group and all its topics, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/df0899cd-529f-443e-97b2-36294fbef428%40googlegroups.com.
@Inject
private ProcessApplicationInterface processApplication;--
You received this message because you are subscribed to a topic in the Google Groups "camunda BPM users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/camunda-bpm-users/z8hrkSEWC18/unsubscribe.
To unsubscribe from this group and all its topics, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/662a642f-d982-4b56-a169-721160c637b3%40googlegroups.com.
<process-engine name="spo-process-engine">
<configuration>org.camunda.bpm.engine.impl.cfg.JtaProcessEngineConfiguration</configuration> <datasource>java:jboss/datasources/ProcessEngine</datasource> <properties> <property name="databaseSchemaUpdate">create-drop</property> <property name="jobExecutorActivate">true</property> <property name="transactionManagerJndiName">java:jboss/TransactionManager</property> </properties></process-engine>ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY, variables);Task task = taskService.createTaskQuery().executionId(processInstance.getId()).singleResult();<process-archive name="spo-basic-process"> <process-engine>spo-process-engine</process-engine> <properties> <property name="isDeleteUponUndeploy">true</property> <property name="isScanForProcessDefinitions">true</property> </properties> </process-archive>@Injectprivate ProcessApplicationInterface processApplication; <process-archive name="spo-basic-process"> <process-engine>spo-process-engine</process-engine> <properties> <property name="isDeleteUponUndeploy">true</property> <property name="isScanForProcessDefinitions">true</property> </properties> </process-archive>