Using io.rest-assured in pax exam with Fuse
dbayub Jul 8, 2016 11:30 AMI'm trying to use the io.rest-assured package in an integration test with pax exam on Fuse. The problem I'm having is that it needs the full org.hamcrest distribution, but a partial package is loaded with the org.ops4j.pax.tipi.hamcrest.core bundle. I've found examples of overriding this in the configuration options that supposedly work, like:
mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.hamcrest", "1.3_1"),
// this is copied from junitBundles() to remove the default pax-exam hamcrest bundle that does
// not contains all the nice hamcrest Matchers
new DefaultCompositeOption(new JUnitBundlesOption(), systemProperty("pax.exam.invoker").value("junit"),
bundle("link:classpath:META-INF/links/org.ops4j.pax.exam.invoker.junit.link")),
But then you get two bundles with the same package:
org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve bundle revision org.apache.servicemix.bundles.hamcrest [313.0] because it exports package 'org.hamcrest.internal' and is also exposed to it from bundle revision org.ops4j.pax.tipi.hamcrest.core [308.0] via the following dependency chain:
org.apache.servicemix.bundles.hamcrest [313.0]
import: (osgi.wiring.package=junit.framework)
|
export: osgi.wiring.package=junit.framework; uses:=org.hamcrest
org.ops4j.pax.tipi.junit [309.0]
import: (&(osgi.wiring.package=org.hamcrest)(version>=1.3.0)(!(version>=2.0.0)))
|
export: osgi.wiring.package=org.hamcrest; uses:=org.hamcrest.internal
export: osgi.wiring.package=org.hamcrest.internal
org.ops4j.pax.tipi.hamcrest.core [308.0]
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4006)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
at java.lang.Thread.run(Thread.java:745)
org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve bundle revision org.apache.servicemix.bundles.hamcrest [313.0] because it exports package 'org.hamcrest.internal' and is also exposed to it from bundle revision org.ops4j.pax.tipi.hamcrest.core [308.0] via the following dependency chain:
org.apache.servicemix.bundles.hamcrest [313.0]
import: (osgi.wiring.package=junit.framework)
|
export: osgi.wiring.package=junit.framework; uses:=org.hamcrest
org.ops4j.pax.tipi.junit [309.0]
import: (&(osgi.wiring.package=org.hamcrest)(version>=1.3.0)(!(version>=2.0.0)))
|
export: osgi.wiring.package=org.hamcrest; uses:=org.hamcrest.internal
export: osgi.wiring.package=org.hamcrest.internal
org.ops4j.pax.tipi.hamcrest.core [308.0]
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4006)
at org.apache.felix.framework.Felix.startBundle(Felix.java:2045)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
at java.lang.Thread.run(Thread.java:745)
Any suggestions on what needs to be done to replace the existing hamcrest bundle with another?