Task #444
openActiviti test configuration outside core module
0%
Description
Workflow tests do not run outside the core-impl module. Spring throws exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: public org.activiti.engine.test.ActivitiRule eu.bcvsolutions.idm.test.api.AbstractWorkflowIntegrationTest.activitiRule; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.activiti.engine.test.ActivitiRule] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.junit.Rule()} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ... 37 common frames omitted Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.activiti.engine.test.ActivitiRule] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.junit.Rule()} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1380) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1126) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1021) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
I've already encountered this strange behavior during #353, which we solved by including functionality into the core, which is impossible in project specific modules (what I'm solving right now).
The goal of this ticket is to enable workflow tests in other modules than core.
Related issues
Updated by Jan Helbich over 7 years ago
I've added a @Configuration bean into the module, which seems to have solved the issue.
@Configuration public class TestConfiguration { @Bean public ActivitiRule activitiRule(ProcessEngine processEngine) { return new ActivitiRule(processEngine); } }
Currently the test does not really have any functionality, but Spring and application context loads without further errors.
I'll continue with the tests and provide more info.
Updated by Jan Helbich over 7 years ago
Configuration in note 1 must be either part of test packages, or JUnit must be included as runtime dependency.
ActivitiRule depends on JUnit and if the configuration is in normal JAR, tomcat won't start, of course.
Also using @ActiveProfile("test") seems like a good idea.
Updated by Vít Švanda about 7 years ago
- Target version deleted (
Diamond (7.4.0))
Updated by Radek Tomiška about 7 years ago
- Is duplicate of Task #682: Refactor CustomActivityBehaviorFactory out of core-impl added