[
https://issues.apache.org/jira/browse/SLING-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12795565#action_12795565
]
Carsten Ziegeler commented on SLING-1195:
-----------------------------------------
I think the easiest way would be to make the INSTANCE field in the
AdapterManagerImpl public - this causes no problems in an OSGi environment as
the whole class is private.
Within a junit test one can simple set an own AdapterManager through the static
field without knowing any implemetation details of the adapter manager
implementation.
> Make AdapterManager implementation somehow accessible for junit tests
> ---------------------------------------------------------------------
>
> Key: SLING-1195
> URL: https://issues.apache.org/jira/browse/SLING-1195
> Project: Sling
> Issue Type: Improvement
> Components: Extensions
> Affects Versions: Adapter 2.0.4
> Reporter: Carsten Ziegeler
> Fix For: Adapter 2.0.6
>
>
> The SlingAdaptable directly uses the internal AdapterManagerImpl class to get
> adapter factories. This works fine in an OSGi context.
> Using a SlingAdaptable within a junit test is harder, especially if one wants
> to use an adapter factory. This requires manual instantiation of the
> adaptermanager impl and some reflection tricks etc. to get the factory
> registered.
> We should find a better way which makes writing junit tests easier.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.