the dependency to the old osgi version is by design to not force all users to use a newer osgi version in their maven dependencies. but we try to support the newer versions as well by adding the required methods wherever possible. can you create a ticket for this in the issue tracker at [1]?
stefan [1] https://issues.apache.org/jira/browse/SLING >-----Original Message----- >From: Steinar Bang [mailto:s...@dod.no] >Sent: Saturday, April 04, 2015 6:33 PM >To: users@sling.apache.org >Subject: Old OSGi version in osgi-mocks (AbstractMethodError missing >functionality) > >Hi, > >I've been using the osgi-mocks v. 1.2 to do unit test on stuff in my >bundles, and I've run into AbstractMethodError for stuff I've used. It >took me some time to figure out why this was, but then I found that >MockBundleContext and MockBundle were compiled against an OSGi version >where the methods I was calling was missing from the interfaces. > >Stuff that was missing, was: > - The generic BundleContext.registerService, ie. > >https://osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#regi >sterService(java.lang.Class, S, java.util.Dictionary) > - The BundleWiring API, which I use to get the classLoader, right now > the test fails with AbstractMethodError in Bundle.adapt when I try > using it to get a BundleWiring > >https://osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html#adapt(java. >lang.Class) > >Here's the code line that currently fails for me: > BundleWiring bundleWiring = bundle.adapt(BundleWiring.class); > >Are there plans to update osgi-mock to the newest OSGi version? > >Speaking for myself I can live without the generics, but it would be >nice to be able to use a non-deprecated way of finding the classLoader. > >I looked into subclassing and adding methods, but that wasn't easy. > >(So I guess for now I'm back to mockito and creating by own mocks, even >if there will be an updated osgi-mock, it won't be here tomorrow).