Headless JUnit4 and DS problem. [message #638841] |
Fri, 12 November 2010 13:00  |
Eclipse User |
|
|
|
I'm trying to debug a problem I have with a simple JUnit4 test case that
runs correctly when launched from the IDE, but when I execute it
headlessly, using the Buckminster junit/emma command triggered by
Hudson, it fails because DS does not activate the bundle.
The test uses DS to inject two services, and waits until those services
have been set before it executes the test. It's basically a copy of the
example in Chapter 8 of the "OSGi and Equinox" book. The problem is
that when run headlessly, the wait times out, but when run interactively
from Eclipse, the services are injected and the test works perfectly.
The launch configuration for both cases is the same.
My naive diagnosis of the problem is that DS is not running when the
test is running headless. Now what?
Any advice on how to proceed would be appreciated. I tried enabling
debug by setting equinox.ds.debug=true to see what was going on, but
that resulted in a stack overflow exception (!)
Thanks
Dan
|
|
|
|
Re: Headless JUnit4 and DS problem. [message #639277 is a reply to message #638917] |
Mon, 15 November 2010 16:12  |
Eclipse User |
|
|
|
Gunnar, thanks for the response.
Checking the config.ini file on the build server did the trick. I
discovered that DS was in the configuration and it was started. I then
was able to determine that stub implementation of the service that DS
was failing to inject was, to my great surprise, not in the config.ini,
even though it was in the launch configuration and in the workspace
checked out by Hudson. It turns out that the problem was that a cquery
I was using for Buckminster to get the test plugin that contained the
stub service. The "test feature" targeted by the cquery did not
reference the bundle that contained the stub service as a dependency.
So, basically, the service was invisible to the Buckminster JUnit command.
Dan
On 11/13/2010 2:33 AM, Gunnar Wagenknecht wrote:
> Am 12.11.2010 19:00, schrieb Daniel Ford:
>> My naive diagnosis of the problem is that DS is not running when the
>> test is running headless. Now what?
>
> Can you make sure that the DS bundle is started prior to starting your
> unit tests?
>
> You can do that either manually in your tests or (the better option)
> externally through config.ini (list of bundles and their start level).
>
> -Gunnar
>
|
|
|
Powered by
FUDForum. Page generated in 0.04090 seconds