You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (Jira)" <ji...@apache.org> on 2021/03/08 20:41:00 UTC

[jira] [Resolved] (SLING-9708) Osgi Mocks cannot support map-only activate signature

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

Stefan Seifert resolved SLING-9708.
-----------------------------------
    Resolution: Duplicate

> Osgi Mocks cannot support map-only activate signature
> -----------------------------------------------------
>
>                 Key: SLING-9708
>                 URL: https://issues.apache.org/jira/browse/SLING-9708
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>    Affects Versions: Testing OSGi Mock 2.4.16
>            Reporter: Ian Reasor
>            Priority: Major
>
> Calling OsgiContext.registerInjectActivateService(T service,
>  java.util.Map<String, Object> properties) on a service with an activate method that has a signature in the style of:
> {code:java}
> protected void activate(Map<String, Object> props){code}
> results in a RuntimeException:
> {quote}java.lang.RuntimeException: Bind method with name bindAuthorizationService not found for reference 'authorizationService' for class <SERVICE_UNDER_TEST>
> {quote}
> It seems that the framework expects a BundleContext to be present in the activate method's signature.  I was able to work around this issue by updating the method signature to:
> {code:java}
> protected void activate(BundleContext bundleContext, Map<String, Object> props){code}
> but ideally, we would be able to use either signature. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)