Project

General

Profile

Actions

Task #444

open

Activiti test configuration outside core module

Added by Jan Helbich almost 7 years ago. Updated over 6 years ago.

Status:
New
Priority:
Normal
Assignee:
Radek Tomiška
Category:
Workflow
Target version:
-
Start date:
05/24/2017
Due date:
% Done:

0%

Estimated time:
Owner:

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

Is duplicate of IdStory Identity Manager - Task #682: Refactor CustomActivityBehaviorFactory out of core-implNewVít Švanda08/31/2017

Actions
Actions #1

Updated by Jan Helbich almost 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.

Actions #2

Updated by Jan Helbich almost 7 years ago

  • Assignee deleted (Vít Švanda)
Actions #3

Updated by Jan Helbich almost 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.

Actions #4

Updated by Vít Švanda over 6 years ago

  • Target version deleted (Diamond (7.4.0))
Actions #5

Updated by Radek Tomiška over 6 years ago

  • Assignee set to Radek Tomiška
Actions #6

Updated by Radek Tomiška over 6 years ago

  • Is duplicate of Task #682: Refactor CustomActivityBehaviorFactory out of core-impl added
Actions

Also available in: Atom PDF