Skip to content

Commit

Permalink
Merge pull request #250 from camunda-community-hub/bugfix/#249_proces…
Browse files Browse the repository at this point in the history
…sinstancequery_single_process_id_not_working

fix: #249 correctly evaluate single process id passed to query
  • Loading branch information
rohwerj authored Aug 19, 2022
2 parents 9a4d9a2 + c3c5529 commit fc554a3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,34 @@ class RuntimeServiceProcessInstanceQueryITest :
}


@Test
fun `find process by single process instance id`() {
val processDefinitionKey = "processDefinitionKey"
val key1 = "businessKey1"
val key2 = "businessKey2"
val key3 = "businessKey3"

GIVEN.no_deployment_exists()

GIVEN
.process_with_user_task_is_deployed(processDefinitionKey)

WHEN
.apply {
localService.startProcessInstanceByKey(processDefinitionKey, key1)
localService.startProcessInstanceByKey(processDefinitionKey, key2)
processInstance = localService.startProcessInstanceByKey(processDefinitionKey, key3)
}

THEN
.process_instance_query_succeeds { query, _ ->
val result = query
.processInstanceId(GIVEN.processInstance.id)
.count()
assertThat(
result
).isEqualTo(1)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ class DelegatingProcessInstanceQuery(private val processInstanceApiClient: Proce
"processInstanceIds" -> {
val ids = this@DelegatingProcessInstanceQuery.processInstanceIds?.toMutableSet() ?: mutableSetOf()
if (this@DelegatingProcessInstanceQuery.processInstanceId != null) {
ids.plus(this@DelegatingProcessInstanceQuery.processInstanceId)
ids.plus(this@DelegatingProcessInstanceQuery.processInstanceId).toList()
} else {
if (ids.isEmpty()) null else ids.toList()
}
if (ids.isEmpty()) null else ids.toList()
}
"tenantIdIn" -> this@DelegatingProcessInstanceQuery.tenantIds?.toList()
"withoutTenantId" -> this@DelegatingProcessInstanceQuery.isTenantIdSet && (this@DelegatingProcessInstanceQuery.tenantIds == null)
Expand Down

0 comments on commit fc554a3

Please sign in to comment.