Coder Social home page Coder Social logo

Comments (18)

ben-manes avatar ben-manes commented on June 15, 2024

Its generated via the Gradle build file.

Do you have any recommendations for how to test OSGi? I've never used it and I seem to screw up the manifest in every release. Is PaxExam the right approach for compatibility testing?

from caffeine.

ben-manes avatar ben-manes commented on June 15, 2024

I was partially successful and need your help to debug. I added a JUnit sanity test in the caffeine and guava modules, due to the TestNG integration eagerly initializing the container even if the test is skipped (broke tests). The caffeine sanity test passes after your fix.

The guava test fails with the exception below. The class should be exported and the manifest looks correct to me. Can you take a look at the osgi branch?

You can run using gradlew :guava:test.

com.github.benmanes.caffeine.guava.OSGiTest > sanity FAILED
    java.lang.ClassNotFoundException: com.github.benmanes.caffeine.guava.CaffeinatedGuava not found by PAXEXAM-PROBE-bee238e9-41a5-4071-8e3e-776f37fe25be [16]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at com.github.benmanes.caffeine.guava.OSGiTest.sanity(OSGiTest.java:59)

from caffeine.

nedtwigg avatar nedtwigg commented on June 15, 2024

I'll take a look. I can see the problem in your build.gradle now, but I don't know much about unit-testing OSGi (I do all unit testing as plain-jane Java, and OSGi problems get rattled out in final integration tests). I'll check out your branch and take a look.

Great work, btw, big fan of the library 👍

from caffeine.

ben-manes avatar ben-manes commented on June 15, 2024

got it!

The error is due to using Guava 18.0 in test's mavenBundle, while the build uses 19.0-rc2. This caused the resolution to fail with a misleading error message. The reason why they differed is because I accidentally set the version to the full artifact coordinate, which it said wasn't on maven central, so I hard coded it to an earlier version. Fixing the system property and it passes. I guess I'm tired :)

I'll try to finish the integration tests tomorrow and cut a patch release.

from caffeine.

nedtwigg avatar nedtwigg commented on June 15, 2024

Good find, I was stuck! I've got a workaround, so no rush on my account.

from caffeine.

ben-manes avatar ben-manes commented on June 15, 2024

Any chance you're familiar with OSGi + ServiceLoaders? I tried adding the instructions described here, but no luck so far. Probably because tests are consumers and I'm not declaring that right.

com.github.benmanes.caffeine.jcache.OSGiTest > sanity FAILED
    java.util.ServiceConfigurationError: javax.cache.spi.CachingProvider: Provider com.github.benmanes.caffeine.jcache.spi.CaffeineCachingProvider not a subtype
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
        at javax.cache.Caching$CachingProviderRegistry$1.run(Caching.java:438)
        at javax.cache.Caching$CachingProviderRegistry$1.run(Caching.java:432)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.cache.Caching$CachingProviderRegistry.getCachingProviders(Caching.java:432)
        at javax.cache.Caching$CachingProviderRegistry.getCachingProvider(Caching.java:370)
        at javax.cache.Caching$CachingProviderRegistry.getCachingProvider(Caching.java:351)
        at javax.cache.Caching.getCachingProvider(Caching.java:142)
        at javax.cache.Caching.getCache(Caching.java:279)
        at com.github.benmanes.caffeine.jcache.OSGiTest.sanity(OSGiTest.java:54)

from caffeine.

nedtwigg avatar nedtwigg commented on June 15, 2024

I can't find com.github.benmanes.caffeine.jcache.OSGiTest. Maybe you need to push your latest to osgi?

from caffeine.

ben-manes avatar ben-manes commented on June 15, 2024

Did you pull from upstream? Its pushed

from caffeine.

nedtwigg avatar nedtwigg commented on June 15, 2024

Aha! My bad.

from caffeine.

ben-manes avatar ben-manes commented on June 15, 2024

This might also be due to JCache #326 or at least be a future blocker.

from caffeine.

nedtwigg avatar nedtwigg commented on June 15, 2024

Sorry, I've got no clue.

from caffeine.

ben-manes avatar ben-manes commented on June 15, 2024

Thanks for trying. It looks like Ehcache3's tests bypass the service loader so I'll try that tonight. I gave it a quick shot and it reported another not found error, so at least its a path to debug down.

from caffeine.

ben-manes avatar ben-manes commented on June 15, 2024

It turns out that the underling error message goes to standard error, which is available as a separate tab in the html report. The problem is due jsr107 not exporting its packages, as noted in the bug report.

org.osgi.framework.BundleException: Unable to resolve com.github.ben-manes.caffeine.jcache [17](R 17.0): missing requirement [com.github.ben-manes.caffeine.jcache [17](R 17.0)] osgi.wiring.package; (osgi.wiring.package=javax.cache.configuration) Unresolved requirements: [[com.github.ben-manes.caffeine.jcache [17](R 17.0)] osgi.wiring.package; (osgi.wiring.package=javax.cache.configuration)]
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2117)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
    at java.lang.Thread.run(Thread.java:745)

from caffeine.

ben-manes avatar ben-manes commented on June 15, 2024

Can you try the snapshot jar and verify that it works for you? If so, I'll then release the update.

from caffeine.

nedtwigg avatar nedtwigg commented on June 15, 2024

Verified good.

from caffeine.

ben-manes avatar ben-manes commented on June 15, 2024

Awesome, thanks!

from caffeine.

ben-manes avatar ben-manes commented on June 15, 2024

Released. Might take a hour or two before all the mirrors get in sync. Thanks for the help on this one.

from caffeine.

nedtwigg avatar nedtwigg commented on June 15, 2024

Thanks for putting so much work into the tests! I use a lot of OSGi plugins, they all break the manifests all the time, you're the first person to actually add tests to fix it and keep it fixed. 👍

from caffeine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.