[
https://issues.apache.org/jira/browse/SLING-4724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16792632#comment-16792632
]
Daniel commented on SLING-4724:
-------------------------------
There is a solution for running tests from IntelliJ (works only from maven
3.3.1):
* In jUnit "Edit configurations..." in IntelliJ:
* Before launch: Build, MavenGoal Activate tool window
* Click "+"
* Chose "Run Maven Goal"
* And in command line type "scr:scr" ("scr" is plugin name and "scr" is goal
name)
Works for me :)
> Mock OSGI service does not work without bind and unbind methods.
> ----------------------------------------------------------------
>
> Key: SLING-4724
> URL: https://issues.apache.org/jira/browse/SLING-4724
> Project: Sling
> Issue Type: Bug
> Components: Testing
> Reporter: Roy Teeuwen
> Priority: Minor
> Labels: mocks
>
> When making a junit test using the org.apache.sling.testing.osgi-mock
> library, the osgi context will not start up (MockOsgi.injectServices(service,
> bundleContext) when a service which is @Reference'ed does not have a bind and
> unbind method. The following error is thrown:
> java.lang.RuntimeException: Bind method with name bindSecondService not found
> for reference 'secondService' for class {}some.packagename.FirstService
> at
> org.apache.sling.testing.mock.osgi.ReflectionServiceUtil.injectServiceReference(ReflectionServiceUtil.java:351)
> at
> org.apache.sling.testing.mock.osgi.ReflectionServiceUtil.injectServices(ReflectionServiceUtil.java:278)
> at
> org.apache.sling.testing.mock.osgi.MockOsgi.injectServices(MockOsgi.java:114)
> at some.packagename.FirstServiceTest.before(FirstServiceTest.java:42)
> Seeing as sling works without the bind methods, this looks to me like an
> error which should not happen and a default bind method should be used?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)