please note you can also mix sling mocks 1.x and osgi mocks 2.x if you are 
using OSGi R6 in your application but still use an older sling version (e.g. 
AEM 6.1).

this talks lists the possible version matrix combinations
https://adapt.to/2016/en/schedule/unit-testing-with-sling-aem-mocks.html

sefan

>-----Original Message-----
>From: Roy Teeuwen [mailto:r...@teeuwen.be]
>Sent: Wednesday, December 21, 2016 9:12 AM
>To: users@sling.apache.org
>Subject: Re: Using OSGi Mocks with OSGi DS annotations
>
>Hey Robbert,
>
>Aha okey that explains it, I'm still on the 1.x branch for now! I will have
>to wait until I can do an upgrade to the new sling api, or maybe backport
>the functionality, thanks!
>
>Greets
>Roy
>
>> Op 21 dec. 2016 om 08:49 heeft Robert Munteanu <romb...@apache.org> het
>volgende geschreven:
>>
>> Hi Roy,
>>
>>> On Tue, 2016-12-20 at 23:03 +0100, Roy Teeuwen wrote:
>>> Hey all,
>>>
>>> I am trying to use the osgi mocks in the following setup:
>>> @Component
>>> @Designate(ocd = ServiceImpl.Config.class)
>>> public class ServiceImpl implements Service {
>>>
>>>     @ObjectClassDefinition
>>>     @interface Config {
>>>
>>>         String property() default "value";
>>>     }
>>>
>>>     private Config config;
>>>
>>>     @Activate
>>>     public void activate(Config config) {
>>>         this.config = config;
>>>     }
>>> }
>>> Test class:
>>> service = context.registerInjectActivateService(new ServiceImpl(),
>>> "property", "some-value");
>>> But I am getting the following exception:
>>>
>>> java.lang.RuntimeException: No matching activation method with name
>>> 'activate'  found in class some.packagename.ServiceImpl
>>
>> (snip)
>>
>> Support for annotation classes as configuration was added with
>>
>>  https://issues.apache.org/jira/browse/SLING-5327
>>
>> which is part of OSGi Mocks 2.0.0 . What version are you using?
>>
>> Robert


Reply via email to