Indeed its strange that I used @After! MetricsServiceImpl has a required dependency on MBeanServer and earlier OsgiMock does not activate the service if MBeanServer service is not registered. Hence the "intention" was to get it registered before activation
Looks like it does not fail which I somehow recall used to fail and required Reference contract was enforced. Would have a look. Anyways thinking about it, MBeanServer should be considered optional and if not provided default platform server should be used Chetan Mehrotra On Tue, Jan 12, 2016 at 2:41 PM, Bertrand Delacretaz <bdelacre...@apache.org> wrote: > Hi (Chetan mostly), > > Is this code in in MetricServiceTest. [1] useful? > > @After > public void registerMBeanServer() { > context.registerService(MBeanServer.class, > ManagementFactory.getPlatformMBeanServer()); > } > > The tests pass for me without it, and registering a service after the > tests is surprising - but I might be missing something. > > -Bertrand > > [1] > https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/metrics/src/test/java/org/apache/sling/commons/metrics/internal/MetricServiceTest.java