Created
November 5, 2013 16:32
-
-
Save NiasSt90/7321773 to your computer and use it in GitHub Desktop.
Testcase for Start with CorrelateMessage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.sis.leo.camunda; | |
import org.camunda.bpm.engine.*; | |
import org.camunda.bpm.engine.task.Task; | |
import org.jboss.arquillian.container.test.api.Deployment; | |
import org.jboss.arquillian.junit.Arquillian; | |
import org.jboss.shrinkwrap.api.ShrinkWrap; | |
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | |
import org.jboss.shrinkwrap.api.spec.WebArchive; | |
import org.jboss.shrinkwrap.resolver.api.maven.*; | |
import org.junit.*; | |
import org.junit.runner.RunWith; | |
import javax.inject.Inject; | |
/** | |
* User: Markus Schulz <[email protected]> | |
* Date: 05.11.13 | |
* Time: 16:16 | |
*/ | |
@RunWith(Arquillian.class) | |
public class CamundaTest { | |
@Inject | |
private RuntimeService runtimeService; | |
@Inject | |
private TaskService taskService; | |
@Deployment | |
public static WebArchive createDeployment() { | |
PomEquippedResolveStage resolver = Maven.resolver().offline().loadPomFromFile("pom.xml"); | |
WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "CamundaTest.war") | |
// prepare as process application archive for camunda BPM Platform | |
.addAsLibraries(resolver.resolve("org.camunda.bpm.javaee:camunda-ejb-client").withoutTransitivity().asFile()) | |
.addAsLibraries(resolver.resolve("org.camunda.bpm:camunda-engine-cdi").withoutTransitivity().asFile()) | |
.addAsWebInfResource("jboss-deployment-structure.xml") | |
.addAsWebResource("processes.xml", "WEB-INF/classes/META-INF/processes.xml") | |
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addClass(CamundaTest.class) | |
// add process definition | |
.addAsResource("events2.bpmn"); | |
System.out.println(webArchive.toString(true)); | |
return webArchive; | |
} | |
@Test | |
public void testMultipleMessageStartEventCorrelation() { | |
runtimeService.correlateMessage("START"); | |
runtimeService.correlateMessage("START2"); | |
Task task1 = taskService.createTaskQuery().taskName("TASK1").singleResult(); | |
Assert.assertNotNull(task1); | |
Task task0 = taskService.createTaskQuery().taskName("TASK0").singleResult(); | |
Assert.assertNotNull(task0); | |
Task task2 = taskService.createTaskQuery().taskName("TASK2").singleResult(); | |
Assert.assertNull(task2); | |
long instances = runtimeService.createProcessInstanceQuery().processDefinitionKey("EventTestID").count(); | |
Assert.assertEquals(2, instances); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment