Where is SpringJunitJupiterTest.TestConfiguration.class from the docs?

In the documentation ch05-spring, the unit testing section has a code snippet referencing a TestConfiguration that I can’t find. Does anyone know where I can find SpringJunitJupiterTest.TestConfiguration.class?

Apologies in advance if this is a newbie FAQ. Google search can only get you so far…

Thanks,
Nick.

The TestConfiguration class is a static class in the file modules/flowable-spring/src/test/java/org/flowable/spring/test/jupiter/SpringJunitJupiterTest.java. It starts around line 104 in that file.

You’ll need to use your own configuration class instead of SpringJunitJupiterTest.TestConfiguration. That is only an example.

Thanks for the pointers, guys.
Maybe the documentation needs a paragraph to explain that, and have a snippet from the TestConfiguration class?

The reason why this is not mentioned and there is no snippet is because if you are using the Spring testing support we assume that you know about Spring and you know how to configure the Flowable Engine as a Spring Bean. Additionally, configuring the engine as a Spring Bean (if not using Spring Boot) is explained here.

Thanks for all the help @filiphr. I have checked out a fork of flowable-engine, so that I can follow your example better. I am trying to write junit5 tests, using spring (rather than the SpringBootTest annotation). I am trying to test a CMMN diagram that executes a ProcessTask to start a BPMN process, but I’m having no success getting the test to execute.
Can you point me to an example in the flowable-engine code base that might inform my Spring bean configuration?

Hi again, just wanted to post a solution and see if it makes sense.
I translated the ‘flowable.cfg.xml’ from the ‘flowable-cmmn-engine-configurator’ module, which gave me a Spring Bean configuration that could start my case:
@Bean
public SpringProcessEngineConfiguration processEngineConfiguration(DataSource dataSource, PlatformTransactionManager transactionManager, CmmnEngineConfiguration cmmnEngineConfiguration) {
SpringProcessEngineConfiguration configuration = new SpringProcessEngineConfiguration();
configuration.setDataSource(dataSource);
configuration.setTransactionManager(transactionManager);
configuration.setDatabaseSchemaUpdate(“true”);
// Include other engine configurators that might be needed in the unit tests
SpringCmmnEngineConfigurator cmmnEngineConfigurator = new SpringCmmnEngineConfigurator();
cmmnEngineConfigurator.setCmmnEngineConfiguration(cmmnEngineConfiguration);
configuration.addConfigurator(cmmnEngineConfigurator);
return configuration;
}

That looks ok. You also need other classes for the TestAppConfiguration, etc.

1 Like