Unit test is failing with the below exception at the end .
java.lang.ClassCastException: org.camunda.bpm.engine.impl.history.handler.DbHistoryEventHandler cannot be cast to org.camunda.bpm.extension.process_test_coverage.listeners.FlowNodeHistoryEventHandler
I am using
<camunda.version>7.11.0</camunda.version>
<camundaSpringBoot.version>3.3.1</camundaSpringBoot.version>
<springBoot.version>2.1.5.RELEASE</springBoot.version>
But if I moved to below version, it is working fine
<camunda.version>7.10.0</camunda.version>–>
<springBoot.version>2.1.1.RELEASE</springBoot.version>
<camundaSpringBoot.version>3.2.0</camundaSpringBoot.version>
no . I am not overriding default configuration my test class is like as below .
Usecase : The camunda process is getting triggered by a listener which is listening kafka topic for an event . Once the process kick start it will process all lined up the service task till it reached Receive message task waiting a message.
your problem is caused by a change in the spring boot starter for Camunda 7.11. which introduced integration with Spring eventing. This is done with a custom history event handler which seems to break the current implementation of the test coverage.
One workaround could be to add the plugin to the configuration postDeploy and override the composite history handler. This would result in removing the Spring eventing integration again, though.
Hi @benhoffmann - is there any example of this -to add the plugin to the configuration postDeploy and override the composite history handler? I need 7.11 but this process coverage stopping me to use the version .
The implementation of a Process Engine Plugin in Spring Boot could look like this.
@Component
public class ProcessTestCoverageProcessEnginePlugin extends AbstractProcessEnginePlugin implements ProcessEnginePlugin {
@Override
public void postInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
ProcessCoverageConfigurator.initializeProcessCoverageExtensions(processEngineConfiguration);
}
}
Calling ProcessCoverageConfigurator.initializeProcessCoverageExtensions() on postInit() overrides the CompositeEventHandler, finally. This will then, as a consequence, make ProcessTestCoverage run but breaks the functionality of every other History Event Handler that might have been registered in the Composite. As of now, only Spring Eventing Integration is affected.
The ticket @benhoffmann referred to is connected to a feature request that passed its evaluation and will bring a proper History Event Handler interface that will enable us to fix ProcessTestCoverage later on.