Hi!
I'm trying to develop a JIRA plugin and having a hard time with the Spring-Scanner. I've managed to export the component I need now, I guess. It's showing up as an exported service in the OSGI console.
However, I wrote a integration test using this component, but it seems, that the test-plugin isn't using the spring scanner at all. There's no META-INF/plugin-components directory in its jar, for instance.
Isn't this supported? Am I on the wrong track here? Has anybody wrote an integration test using autowiring in the spring scanner?
Thanks.
Kind regards
Dennis
Community moderators have prevented the ability to post new answers.
Yes, it seems, that the spring scanner currently isn't supported for integration tests. I've used the old "component-import" plugin module as a fallback. That works. The setup is like this:
<atlassian-plugin key="${project.groupId}.${project.artifactId}-tests" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}" /> </plugin-info> <component-import key="myComponent" interface="com.example.MyComponentInterface"/> </atlassian-plugin>
(...) @Scanned @RunWith(AtlassianPluginsTestRunner.class) public class MyIntegrationTest { private final MyComponentInterface myComponent; public MyIntegrationTest(final MyComponentInterface myComponent) { this.myComponent = myComponent; } (...) }
I'm having similar issues. I've used `@InjectMocks` from Mockito to mock out dependencies, but I'm having trouble injecting the real component.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.