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

Stefan Seifert reassigned SLING-13097:
--------------------------------------

    Fix Version/s: Testing OSGi Mock 3.5.6
         Assignee: Stefan Seifert

thanks for reporting - i see the point.

indeed, osgi-mock currently does not care about actual field 
objects/collections if there is a bind (or unbind) method defined. but that's 
wrong and need to be fixed.

all three options are possible:
 * have a field member with a @Reference annotation and no bind/unbind method 
-> modify the field member directly
 * have a @Reference annotation on class level not related to a field member -> 
only call the bind/unbind methods
 * have field member with @Reference annotation and additional bind and/or 
unbind methods -> modify the filed member *and* call the bind/unbind methods

the last case is missing currently (and also not covered by unit tests).

> Mock OSGi does inject reference when bind methods are present
> -------------------------------------------------------------
>
>                 Key: SLING-13097
>                 URL: https://issues.apache.org/jira/browse/SLING-13097
>             Project: Sling
>          Issue Type: Bug
>          Components: Testing
>    Affects Versions: Testing OSGi Mock 3.5.2
>            Reporter: Bart Thierens
>            Assignee: Stefan Seifert
>            Priority: Major
>             Fix For: Testing OSGi Mock 3.5.6
>
>
> When using a (collection of) reference(s) in a component, OSGi Mock will 
> automatically inject when calling SlingContext/AemContext's 
> registerService/registerInjectActivate.
> When adding bind/unbind/update method to that reference, the mock context 
> will trigger perfectly the bind-methods, but the field itself is never 
> updated. It stays forever null.
> This is different from how OSGi does it.  There I can see the bind methods 
> being triggered + the field being updated automatically.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to