Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Headless JUnit4 and DS problem.
Headless JUnit4 and DS problem. [message #638841] Fri, 12 November 2010 18:00 Go to next message
Daniel Ford is currently offline Daniel FordFriend
Messages: 138
Registered: July 2009
Location: New York
Senior Member
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 #638917 is a reply to message #638841] Sat, 13 November 2010 07:33 Go to previous messageGo to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 452
Registered: July 2009
Location: Germany ✈ Vancouver
Senior Member

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

--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
Re: Headless JUnit4 and DS problem. [message #639277 is a reply to message #638917] Mon, 15 November 2010 21:12 Go to previous message
Daniel Ford is currently offline Daniel FordFriend
Messages: 138
Registered: July 2009
Location: New York
Senior Member
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
>
Previous Topic:how to prevent bundle modification ?
Next Topic:BundleContext.installBundle() and URLs with spaces
Goto Forum:
  


Current Time: Mon Nov 24 20:19:12 GMT 2014

Powered by FUDForum. Page generated in 0.02602 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software