RE: Mock Osgi Services via Sling Mocks

2018-09-03 Thread Stefan Seifert
hello dominik. do you have a small example project to show the problem? from what you describe this should be no problem with osgi mocks/sling mocks - but i do not get the exact problem you encounter. if you want to mock an OSGi services it's easiest to use somehing like mockito and register

Mock Osgi Services via Sling Mocks

2018-09-03 Thread Dominik Süß
Hi everyone, in my case I would like to register a mocked version of an osgi service - in the past IIRC I could have scr metadata in a mock class under src/test/java and just register this one. With the more recent osgi annotations to generate the scr metadata there is an extra execution for scr

Re: Mock Osgi Services via Sling Mocks

2018-09-03 Thread Dominik Süß
Hi Stefan, you're right I just thought too complicated trying to register via SCR. The snippet below seems to work just fine: @Spy PackageRegistry registry = new FSPackageRegistry(); [...] BundleContext bundleContext = MockOsgi.newBundleContext();