Hi Stefan, On Tue, 2014-11-25 at 15:55 +0100, Stefan Seifert wrote: > the first variant should work if SCR metadata are present in the classpath. > did you test this by running the unit tests on the command line, or within an > IDE?
>From Eclipse > if you use eclipse make sure to use m2e and make sure the maven scr plugin > gets executed as well before running the test (e.g. by clean/rebuild the > project). Right, now I understand how this works. I had some (transient) configuration errors. > > the latest (not-yet-relased) version of osgi-mock implements a better error > handling when the SCR metadata is not present [1] That looks good to me, and would've pointed me in the right direction earlier. > > some of this hints are documented here: [2]. perhaps this could be more > prominent. OK, got it. Thanks, Robert > > stefan > > [1] https://issues.apache.org/jira/browse/SLING-4165 > [2] > http://sling.apache.org/documentation/development/osgi-mock.html#activation-and-dependency-injection > > > >-----Original Message----- > >From: Robert Munteanu [mailto:[email protected]] > >Sent: Tuesday, November 25, 2014 3:39 PM > >To: [email protected] > >Subject: Sling Mocks: registering AdapterFactory service > > > >Hi, > > > >I'm following the documentation at [1] to register a new adapter > >factory service. I'm using the SlingContext @Rule for this. > > > >What I see is that the short form does not work > > > > context.registerService(new MyAdapterFactory()); > > > >However, the long form works > > > > context.registerService(AdapterFactory.class, new MyAdapterFactory()); > > > >I'm not sure whether this is intended ( and therefore the docs should > >be adjusted ) or a bug ( and therefore the code should be fixed ). > > > >Thoughts? > > > >Robert > > > > > >[1]: http://sling.apache.org/documentation/development/sling- > >mock.html#adapter-factories
