Skip to content

Commit

Permalink
Add comments and one more subset test case
Browse files Browse the repository at this point in the history
  • Loading branch information
filiphr committed Jan 23, 2024
1 parent 8e8b571 commit 773a3b8
Showing 1 changed file with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ public void testBoundaryEventListenerWithPayload() {
@Test
@Deployment
public void testBoundaryEventWith3CorrelationsAllCombinations() {
// The BPMN has boundary events for each combination, the correlation matches a new task will be created
getEventRepositoryService().createEventModelBuilder()
.key("customer")
.resourceName("customer.event")
Expand Down Expand Up @@ -182,6 +183,7 @@ public void testBoundaryEventWith3CorrelationsAllCombinations() {
@Test
@Deployment
public void testBoundaryEventWith4CorrelationsAllCombinations() {
// The BPMN has boundary events for each combination, the correlation matches a new task will be created
getEventRepositoryService().createEventModelBuilder()
.key("testEvent")
.resourceName("test.event")
Expand Down Expand Up @@ -245,6 +247,69 @@ public void testBoundaryEventWith4CorrelationsAllCombinations() {
);
}

@Test
@Deployment(resources = "org/flowable/engine/test/eventregistry/BpmnEventRegistryConsumerTest.testBoundaryEventWith4CorrelationsAllCombinations.bpmn20.xml")
public void testBoundaryEventWith4CorrelationsSubsetOfCombinations() {
// The BPMN has boundary events for each combination, the correlation matches a new task will be created
// In this test we are going to match a subset of the tasks
getEventRepositoryService().createEventModelBuilder()
.key("testEvent")
.resourceName("test.event")
.correlationParameter("id", EventPayloadTypes.STRING)
.correlationParameter("orderId", EventPayloadTypes.STRING)
.correlationParameter("firstName", EventPayloadTypes.STRING)
.correlationParameter("lastName", EventPayloadTypes.STRING)
.deploy();

ProcessInstance processInstance = runtimeService.createProcessInstanceBuilder()
.processDefinitionKey("multiCorrelationProcess")
.variable("customerId", "customer-1")
.variable("orderId", "order-1")
.variable("firstName", "John")
.variable("lastName", "Doe")
.start();

assertThat(taskService.createTaskQuery().processInstanceId(processInstance.getId()).list())
.extracting(Task::getName)
.containsExactlyInAnyOrder("User task");

ObjectNode event = processEngineConfiguration.getObjectMapper().createObjectNode()
.put("type", "testEvent")
.put("id", "customer-2")
.put("orderId", "order-1")
.put("firstName", "Jane")
.put("lastName", "Doe");
inboundEventChannelAdapter.triggerTestEvent(event);

assertThat(taskService.createTaskQuery().processInstanceId(processInstance.getId()).list())
.extracting(Task::getName)
.containsExactlyInAnyOrder(
"User task",
"Order ID",
"Last Name",
"Order ID and Last Name"
);

event = processEngineConfiguration.getObjectMapper().createObjectNode()
.put("type", "testEvent")
.put("id", "customer-2")
.put("orderId", "order-2")
.put("firstName", "John")
.put("lastName", "Smith");
inboundEventChannelAdapter.triggerTestEvent(event);

assertThat(taskService.createTaskQuery().processInstanceId(processInstance.getId()).list())
.extracting(Task::getName)
.containsExactlyInAnyOrder(
"User task",
"Order ID",
"Last Name",
"Order ID and Last Name",
// The following are from the last trigger
"First Name"
);
}

@Test
@Deployment
public void testReceiveEventTaskNoCorrelation() {
Expand Down

0 comments on commit 773a3b8

Please sign in to comment.