users@glassfish.java.net

Re: Using GlassFish with Pax Exam

From: Harald Wellmann <harald.wellmann_at_gmx.de>
Date: Thu, 11 Aug 2011 21:34:29 +0200

Hi Sahoo,

I'm glad to see you're already using Pax Exam with GlassFish, and
looking at your examples, it's even easier than I expected.

Some notes on your CommonConfiguration class:

1)
mavenBundle().groupId("org.junit").artifactId("com.springsource.org.junit").version("4.8.1"),

Yes, we should really upgrade the Pax Exam default to 4.8.1 or 4.8.2.
The JUnit driver uses 4.8.1 currently, but the container provisions
4.4.0, and I can't see a good reason for that.

2) systemProperty("pax-exam.framework.shutdown.timeout").value(...)

Pax Exam 2.2.0 has a new option

systemTimeout(final long timeoutInMillis)

created by Toni for a self-assigned issue which appears to go back to a
request from you on the mailing list.


3) "Because the provisioning bundles are not uninstalled and because
they are marked persistently started, we use a different cache location."

Hmm yes, I'm not sure if the current default is the best. At least I
think it should be configurable, either by an option or by a reactor
strategy.

Best regards,
Harald


Am 11.08.2011 03:04, schrieb Sahoo:
> Hi Harald,
>
> Yes, it is possible to use Pax-Exam with GlassFish. In fact, I use maven
> + pax-exam + junit as our internal test framework for OSGi Application
> Support related features (aka fighterfish modules) in GlassFish. If you
> want to take a look at some of the existing test cases to see how we use
> these combinations, then you can find them at [1]. The pom.xml has
> profiles to test against different JVMs and different OSGi platforms.
> There is a small utility bundle called test.util which the tests rely
> on. It can be found in [2]. It provides methods like call back when a
> WAB deployment is over, methods to configure data sources and jms
> resources in glassfish, utility to track GlassFish itself, etc. To keep
> each test class small, some of the common functionality like exam
> configuration is provided in a base class called
> CommonConfiguration.java in [1]. Ideally it should be moved to test.util
> as well. As I wrote to someone else yesterday in this forum, I am
> supposed to clean up this test packages a bit and document it so that
> our users could benefit from it if they want. If things go as planned, I
> should be done by this weekend. But, with your knowledge of pax-exam, I
> don't think you need any such document. Look forward to your help and
> feedback,
>
> Sahoo
>
> [1]
> https://svn.java.net/svn/glassfish~svn/trunk/fighterfish/test/test.it/src/test/java/
>
> [2] https://svn.java.net/svn/glassfish~svn/trunk/fighterfish/test/test.util
>
> On Wednesday 10 August 2011 11:11 PM, Harald Wellmann wrote:
>> Is it possible to use Pax Exam to test hybrid OSGi bundles provisioned
>> on GlassFish?
>>
>> This can be reduced to another question: Is it possible to let a
>> running OSGi framework start Glassfish instead of having Glassfish
>> start an OSGi framework?
>>
>> If Sahoo's article
>>
>> http://weblogs.java.net/blog/ss141213/archive/2010/02/14/how-embed-glassfish-existing-osgi-runtime
>>
>>
>> is still up-to-date then this would require some plumbing. I wonder if
>> there's an easier way of doing this in GlassFish 3.1.1.
>>
>> Best regards,
>> Harald
>
>