How to create unique process engine name for spring boot integration test

I want to create process engine in spring boot integration test with unique process engine name every time a process engine is loaded.

Tried following post but this does not create process instance as per deployment descriptor in src/test/resources/META-INF/processes.xml but rather points to src/main/resources/META-INF/processes.xml when I am not providing process-engine tag in deployment descriptor of src/test/resources. I am refreshing test context by using @DirtiesContext annotation for each integration test.

This is sample process deployment descriptor i am using.

<process-application
        xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
>
    <process-archive name="Test" tenantId="xxxx.xx">
        <process-engine>??</process-engine>
        <properties>
            <property name="isDeployChangedOnly">true</property>
            <property name="isScanForProcessDefinitions">true</property>
            <property name="resourceRootPath">classpath:path-to-resource</property>
        </properties>
    </process-archive>
</process-application>

What shall I replace ?? with in my descriptor.
Setup:

  1. Spring boot 3.x
  2. Junit 5
  3. Camunda 7.20

Hello @Jason7,

Please have a look at the Developing and testing Spring Boot applications documentation:

I hope it helps.

Best,
Yana

Hey @Yana,

As mentioned in the question I have already tried the above post, but it does not detail about deploying process using user configured processes.xml when auto deployment of camunda files in spring boot is disabled using @EnableProcessApplication.

Please find the sample file :

In my case I am using a processes.xml file in src/main/resources/META-INF folder of my spring boot application to deploy process definitions using default engine.

When integration tests are running, it is still referring to the file in src/main/resources/META-INF. But I would rather want it to refer the processes.xml file from src/test/resources/META-INF folder.

I want unique process engine being created for every integration test. For that I have added the following properties in application-test.yml with appropriate Active profile for all tests.

camunda:
  bpm:
     generate-unique-process-engine-name: true
     generate-unique-process-application-name: true
spring:
   datasource:
      generate-unique-name: true

Still I get the following error : the process archive 'DummyName' cannot be deployed to default processEngine processEngine is null.

Hi @Jason7,

I am sorry, I overlooked the mentioned post.

We have a test suite that test the described behaviour (I hope that I understood correctly).

Could you please check below, maybe you can be inspired for your scenario:

Hey @Yana ,

Thanks for the link. Just wanted to know what should be processes.xml configuration for process engine when we want uniquie name for process engines for each integration test.

Hi,

Here is the processes.xml file used in the test:

Here is an example of a test with unique name that is defined as process application with reference to the above processes.xml:

So you just need to make sure the properties for uniqueness are set in the tests. Or the tests are using the correct profile (application.properties file) where they are defined. (How to achieve the latter, you can check the Spring boot user guide.)

Best,
Yana