users@glassfish.java.net

Re: Using GlassFish with Pax Exam

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Mon, 15 Aug 2011 23:57:12 +0530

Hi Harald,

I did a round of clean up of our use of pax-exam in FighteFish modules
and in the process have taken care of #3. Will address #2 when I upgrade
to exam 2.2.0. I will write a short note of how one can use pax-exam and
GlassFish together to test enterprise OSGi applications easily and post
it in our Wiki page when I have some time. It is really simple to use
pax-exam based test cases and test them against GlassFish as you have
rightly observed.

Thanks,
Sahoo

On Friday 12 August 2011 01:04 AM, Harald Wellmann wrote:
> 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
>>
>>
>