Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 416982 - Surefire should detect bundles to be exploded from p2 metadata
Summary: Surefire should detect bundles to be exploded from p2 metadata
Status: RESOLVED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-11 03:47 EDT by Mickael Istria CLA
Modified: 2021-04-28 16:51 EDT (History)
3 users (show)

See Also:
t-oberlies: documentation-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mickael Istria CLA 2013-09-11 03:47:03 EDT
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).
Comment 1 Jan Sievers CLA 2013-09-11 04:07:39 EDT
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
Comment 2 Mickael Istria CLA 2013-09-11 04:12:20 EDT
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
Comment 3 Igor Fedorenko CLA 2013-09-11 07:12:12 EDT
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.
Comment 4 Igor Fedorenko CLA 2013-09-11 07:12:54 EDT
(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?
Comment 5 Jan Sievers CLA 2013-09-11 07:15:25 EDT
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
Comment 6 Mickael Istria CLA 2013-09-11 07:33:36 EDT
(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.
Comment 7 Tobias Oberlies CLA 2013-10-22 07:24:14 EDT
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