Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344455 - Automatically add Declarative Service support to test execution
Summary: Automatically add Declarative Service support to test execution
Status: RESOLVED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-02 09:35 EDT by Tobias Oberlies CLA
Modified: 2021-04-28 16:54 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Oberlies CLA 2011-05-02 09:35:27 EDT
Currently, a test needs to declare a dependency to org.eclipse.equinox.ds in order to get Declarative Service running in the test execution. (The start level is then configured automatically.) IMHO, this is not the best default:

- If org.eclipse.equinox.ds is not part of the test runtime, tests fail without pointer to the root cause.
- When executing a test as JUnit Plug-in test, the dependency to org.eclipse.equinox.ds is not required - it is automatically added and started in the runtime.

Proposal: Add an optional dependency to org.eclipse.equinox.ds in the test execution, so that the bundle is present and started whenever it is available from the target platform.
Comment 1 Igor Fedorenko CLA 2011-05-02 10:06:56 EDT
I am -1 on unconditionally adding org.eclipse.equinox.ds to test runtime. I am +0 on making this optional behaviour, even if it is "on" by default.
Comment 2 Jan Sievers CLA 2011-05-03 10:17:56 EDT
I wouldn't add a magic dependency to org.eclipse.equinox.ds .
You want control over your test runtime and always adding this dependency can lead to unexpected effects. Also, removing the hardcoded dependency is then no longer possible.

I would rather see this as an FAQ.
I added https://docs.sonatype.org/display/TYCHO/FAQ#FAQ-Q.HowtotestOSGideclarativeservices%3F
Comment 3 Tobias Oberlies CLA 2011-05-03 10:32:58 EDT
It is kind of obvious that you need DS if you are testing your own declared services. The more likely case is however that your tests are just using something transitively that uses a declaratively registered service. Wit the ds bundle missing, you get error messages about missing services, but nothing pointing to the root cause.

Tycho should make it easy for most users - most users are not bothered by a ds bundle - but also a) provide documentation and debug output to describe what it does automatically (the "convention") and b) provide a switch to disable the automatism.

The most important argument for me is still that it works out of the box in Eclipse, and should be just as easy in Tycho.
Comment 4 Igor Fedorenko CLA 2011-05-03 11:01:11 EDT
I believe mojo configuration parameter, which is on by default, is a reasonable compromise. Or we can detect use of DS by checking for Service-Component manifest attribute in all bundles present in the target platform. In either case I believe it is important to provide a way to disable automatic injection DS implementation into target runtime.
Comment 5 Tobias Oberlies CLA 2011-10-17 12:21:08 EDT
Just to let you know: I have changed my mind about this request, and since I was the only one who liked it in the first place, I'm closing the request as WONTFIX.

With Tycho 0.13.0, the test runtime only consists of bundles which are explicitly required. If there are implicit dependencies (like an implicit dependency to DS), the test will fail. This is good, because in an installation of the bundle, the bundle may also not work if the implicit dependencies are not there. This new behaviour forces you to make implicit dependencies explicit. The recommendation is to do this in the feature which is used to ship the bundle, and add that bundle to the test runtime [1]. Then, both the test will run and all installations which include the feature will be valid.

[1] http://wiki.eclipse.org/Tycho/Packaging_Types#eclipse-test-plugin