You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Roy Teeuwen (JIRA)" <ji...@apache.org> on 2015/05/19 08:40:04 UTC

[jira] [Updated] (SLING-4724) Mock OSGI service does not work without bind and unbind methods.

     [ https://issues.apache.org/jira/browse/SLING-4724?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roy Teeuwen updated SLING-4724:
-------------------------------
    Description: 
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?

  was:
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?


> 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
>
> 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
(v6.3.4#6332)