If found a workaround by extracting the repository logic into a separate class that I replace with a dummy in OSGi. So I currently test the repository logic outside OSGi.
I think we can improve the situation though. How about making org.apache.sling.testing.resourceresolver-mock a bundle? This way I could register the mock resolver factory as a service. Christian Am Mi., 4. März 2020 um 12:01 Uhr schrieb Carsten Ziegeler < [email protected]>: > ok, i see...I would assume there is some pax magic to include the > testing jar as a bundle and then you just register the mock as a service > > Regards > Carsten > > On 04.03.2020 11:28, Christian Schneider wrote: > > Testing the config admin functionality outside of OSGi is not very > reliable > > as it misses many possible error cases. > > My current tests that involve config admin already use OSGi. > > Now that I added a @Reference ResourceResolverFactory my OSGi tests of > > course stopped working as it can not be found. > > > > Christian > > > > Am Mi., 4. März 2020 um 11:04 Uhr schrieb Carsten Ziegeler < > > [email protected]>: > > > >> If you just need config admin and a RRF, why do you need OSGi for the > test? > >> > >> Carsten > >> > >> On 04.03.2020 11:02, Christian Schneider wrote: > >>> I am currently working on a small bundle that will run in sling. It > needs > >>> only config admin and ResourceResolverFactory. > >>> > >>> For the tests I am currently using plain pax exam. I started with just > >> the > >>> need for config admin. > >>> Now I also need to change nodes in the repository. Is there a way to > test > >>> this without the full sling pax exam testing? > >>> > >>> I thought about exporting a mock ResourceResolverFactory as a service > >>> but org.apache.sling.testing.resourceresolver-mock > >>> is not even a bundle. > >>> So I can not use it in OSGi. > >>> > >>> Is there any easy way to use a mock ResourceResolverFactory in OSGi? > >>> > >>> Christian > >>> > >> > >> -- > >> -- > >> Carsten Ziegeler > >> Adobe Research Switzerland > >> [email protected] > >> > > > > > > -- > -- > Carsten Ziegeler > Adobe Research Switzerland > [email protected] > -- -- Christian Schneider http://www.liquid-reality.de Computer Scientist http://www.adobe.com
