diff --git a/bom/parent/pom.xml b/bom/parent/pom.xml index b0ec8042d..6bd490abb 100644 --- a/bom/parent/pom.xml +++ b/bom/parent/pom.xml @@ -22,13 +22,12 @@ 7.20.0-alpha4 4.8.2 - 4.8.0 2.0.0 4.2.0 5.0.0 - 1.2.5 + 1.3.0 1.2.5.0 **/*ITest.* @@ -565,7 +564,7 @@ org.jetbrains.dokka dokka-maven-plugin - 1.8.20 + 1.9.0 attach-javadocs diff --git a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionService.kt b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionService.kt index aa0c7c404..61846b701 100644 --- a/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionService.kt +++ b/integration/camunda-bpm/taskpool-collector/src/main/kotlin/io/holunda/polyflow/taskpool/collector/process/definition/ProcessDefinitionService.kt @@ -50,7 +50,15 @@ class ProcessDefinitionService( this.processDefinitions.clear() } this.processDefinitions.addAll(newDefinitions) - return newDefinitions.map { it.asCommand(applicationName = collectorProperties.applicationName, formKey = formService.getStartFormKey(it.id)) } + return newDefinitions.map { it.asCommand(applicationName = collectorProperties.applicationName, formKey = getStartFormKey(it, formService)) } + } + + private fun getStartFormKey(processDefinitionEntity: ProcessDefinitionEntity, formService: FormService): String? { + return if (processDefinitionEntity.hasStartFormKey) { + formService.getStartFormKey(processDefinitionEntity.id) + } else { + null + } } /** diff --git a/integration/camunda-bpm/taskpool-collector/src/test/kotlin/io/holunda/polyflow/taskpool/itest/tx/ProcessDefinitionServiceITest.kt b/integration/camunda-bpm/taskpool-collector/src/test/kotlin/io/holunda/polyflow/taskpool/itest/tx/ProcessDefinitionServiceITest.kt index 125771b68..f5914dfe8 100644 --- a/integration/camunda-bpm/taskpool-collector/src/test/kotlin/io/holunda/polyflow/taskpool/itest/tx/ProcessDefinitionServiceITest.kt +++ b/integration/camunda-bpm/taskpool-collector/src/test/kotlin/io/holunda/polyflow/taskpool/itest/tx/ProcessDefinitionServiceITest.kt @@ -86,6 +86,52 @@ class ProcessDefinitionServiceITest { assertThat(definitions[0].candidateStarterGroups).containsExactlyElementsOf(listOf("muppetshow")) } + @Test + fun `should not deliver process starter if no start form is available`() { + + val processId = "my-id" + val startEventId = "start" + val modelInstance = Bpmn + .createExecutableProcess(processId) + .startEvent(startEventId) + .endEvent("end") + .done().apply { + getModelElementById(processId).setAttributeValue("name", "My Process") + getModelElementById(processId).setAttributeValueNs(NS_CAMUNDA, "candidateStarterGroups", "muppetshow") + } + + repositoryService + .createDeployment() + .addModelInstance("process-without-start-form.bpmn", modelInstance) + .deploy() + + + val definitions = processDefinitionService.getProcessDefinitions(processEngine.processEngineConfiguration as ProcessEngineConfigurationImpl) + + assertThat(definitions).isNotEmpty + assertThat(definitions[0].processName).isEqualTo("My Process") + assertThat(definitions[0].processDefinitionKey).isEqualTo("my-id") + assertThat(definitions[0].processDefinitionVersion).isEqualTo(1) + assertThat(definitions[0].formKey).isNull() + assertThat(definitions[0].candidateStarterGroups).containsExactlyElementsOf(listOf("muppetshow")) + } + + @Test + fun `should not deliver process starter if only two message start events are available`() { + repositoryService + .createDeployment() + .addClasspathResource("itest/message_start_event.bpmn") + .deploy() + + val definitions = processDefinitionService.getProcessDefinitions(processEngine.processEngineConfiguration as ProcessEngineConfigurationImpl) + + assertThat(definitions).isNotEmpty + assertThat(definitions[0].processName).isEqualTo("My Process") + assertThat(definitions[0].processDefinitionKey).isEqualTo("my-id") + assertThat(definitions[0].processDefinitionVersion).isEqualTo(1) + assertThat(definitions[0].formKey).isNull() + } + /** * Internal test application. */ diff --git a/integration/camunda-bpm/taskpool-collector/src/test/resources/itest/message_start_event.bpmn b/integration/camunda-bpm/taskpool-collector/src/test/resources/itest/message_start_event.bpmn new file mode 100644 index 000000000..67f5ead53 --- /dev/null +++ b/integration/camunda-bpm/taskpool-collector/src/test/resources/itest/message_start_event.bpmn @@ -0,0 +1,44 @@ + + + + + Flow_0rqm55e + Flow_1k4xpiz + + + + + Flow_0rqm55e + + + + Flow_1k4xpiz + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 2f5fbbbd6..ff1733b77 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.4.0 + 3.4.1 enforce-maven