Community
Participate
Working Groups
When using tycho-surefire-plugin to test a bundle, the required bundles are listed in config.ini/osgi.bundles property. However, some of this bundles need to be unzipped (it's for example the case of org.junit from Orbit). This information about whether a bundle should be unzipped or not can be found in its p2 metadata (touchpoing/instruction[@key="zipped"]). It looks like Tycho-surefire-plugin generates the config.ini only using path to artifacts, whereas it should consume the p2 metadata and unzip when necessary. This issue prevents JDT JUnit tests to work with Tycho (because they assume org.junit is exploded and can't work with a packed version).
did you try to use http://eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html#explodedBundles Relying on bundle shape is not exactly a good practice, so I'm reluctant to invest more here
Thanks for the tip, I didn't try that, I'll do this now. I agree relying in bundle shape is not a very good practice for a plugin developer, but people who use it generally do this because they have no choice. It's just necessary sometimes. What I have in mind is more that if we can find the "unzip" touchpoint in p2 metadata, the bundles would be automatically pre-exploded (without having to specify that to the test mojo). As a workaround exist, I can mark this report as an enhancement
tycho-surefire-plugin respects "Eclipse-BundleShape: dir" bundle manifest header and there is a way to force exploded bundles via pom.xml configuration. tycho-surefire does not consider feature.xml unpack <plugin/> attribute because I believe placing this attribute in feature.xml was a design flaw in the (old) update manager and I don't want to perpetuate that flaw. Use of the two mechanisms supported by Tycho.
(In reply to Jan Sievers from comment #1) > > Relying on bundle shape is not exactly a good practice, so I'm reluctant to > invest more here Can you provide some links that explain why relying on bundle shape is a bad idea?
slightly off-topic, but I was thinking of e.g. using file access to load resources instead of getClass().getResourceAsStream() which is independent of bundle shape
(In reply to Igor Fedorenko from comment #3) > tycho-surefire-plugin respects "Eclipse-BundleShape: dir" bundle manifest > header and there is a way to force exploded bundles via pom.xml > configuration. Ok, so it seems to be an inconsistency between Tycho and Orbit which happens on org.junit bundle: * Orbit does not set Eclipse-BundleShape (but sets p2 metadata for unzip), cf bug 231144 * Tycho reads Eclipse-BundleShape (not p2 metadata) to decide whether to unzip or not.
I don't think that this enhancement will be ever implemented: * Tycho already supports the recommended, most common (for newer content) configuration parameter Eclipse-BundleShape * There is POM configuration to manually add bundles to be exploded for the corner cases where this doesn't work. * There is testRuntime=p2Installed option (bug 386988, [1]) which reads the p2 metadata for cases where manual POM configuration would be too much effort. IMHO, this is good enough. [1] http://wiki.eclipse.org/Tycho/Release_Notes/0.19#Test_Execution