Re: Best way to test blueprint-based applications with Karaf?

2012-06-26 Thread j...@nanthrax.net
Hi

I would suggest paxexam-karaf.

Regards
JB
--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://wwx.talend.com

- Reply message -
From: Gerald Preissler gpreiss...@talend.com
To: user@karaf.apache.org user@karaf.apache.org
Subject: Best way to test blueprint-based applications with Karaf?
Date: Tue, Jun 26, 2012 9:25 am


Hi Achim,

thanks for the insight. Guess I'll go down the route you suggested, at 
least until I find some time at my hand to do some more experimentation.

Regards
 Jerry

p.s. The classloading issue you describe below could stem from the fact 
that one bundle gets passed an object that implements an interface from 
one bundle, but resolves the interface definition from another bundle, 
maybe even itself. Maybe you could try setting a breakpoint at the code 
location and compare the classloaders?

On 06/25/2012 05:52 PM, Achim Nierbeck wrote:
 Hi Gerald,

 I suggest sticking to testing with pax-exam or even better using 
 paxexam-karaf.
 I have the following reasons for this :)

 If you want to use blueprint jpa or something like this, I experienced
 trouble with pojoSR not being capable of providing some needed
 functionality for the jpa part of blueprint.
 It uses some internal OSGi method which resolves to a null-pointer
 exception. So this is not really capable for doing intense tests right
 now.
 (if I find some time I might add some patches :) )
 But it's good enough to test some basic blueprint wiring stuff.

 pax-exam is far better in usage since it really starts a container
 though this might increase the timing on the test.
 Though this can be some troublesome to get all required bundles
 working together this way. It needs some trial and error
 to have the right set of bundles available :)
 Though right now I also face an issue with this setup and
 blueprint:jpa. A rather strange Classcast excpetion.
 Somehow the javax.persistence Classes used by blueprint-jpa while
 instanciating the Entity objects is not the same when
 trying to find the corresponding meta-data. Somehow the Entity class
 used in both cases are not the same (classloader issue :( )

 Now finally if you use paxexam-karaf you have all the required bundles
 at hand and if you use jpa
 it magically seems to work right away (no idea what the difference is
 right now, still investigating :) )
 And of course if you are gonna use specialties in setup etc. this
 test-framework gives you just
 the right amount of power to get along :)

 Hope this helps some :)

 regards, Achim

 2012/6/25 Gerald Preissler gpreiss...@talend.com:



Re: Best way to test blueprint-based applications with Karaf?

2012-06-25 Thread Achim Nierbeck
Hi Gerald,

I suggest sticking to testing with pax-exam or even better using paxexam-karaf.
I have the following reasons for this :)

If you want to use blueprint jpa or something like this, I experienced
trouble with pojoSR not being capable of providing some needed
functionality for the jpa part of blueprint.
It uses some internal OSGi method which resolves to a null-pointer
exception. So this is not really capable for doing intense tests right
now.
(if I find some time I might add some patches :) )
But it's good enough to test some basic blueprint wiring stuff.

pax-exam is far better in usage since it really starts a container
though this might increase the timing on the test.
Though this can be some troublesome to get all required bundles
working together this way. It needs some trial and error
to have the right set of bundles available :)
Though right now I also face an issue with this setup and
blueprint:jpa. A rather strange Classcast excpetion.
Somehow the javax.persistence Classes used by blueprint-jpa while
instanciating the Entity objects is not the same when
trying to find the corresponding meta-data. Somehow the Entity class
used in both cases are not the same (classloader issue :( )

Now finally if you use paxexam-karaf you have all the required bundles
at hand and if you use jpa
it magically seems to work right away (no idea what the difference is
right now, still investigating :) )
And of course if you are gonna use specialties in setup etc. this
test-framework gives you just
the right amount of power to get along :)

Hope this helps some :)

regards, Achim

2012/6/25 Gerald Preissler gpreiss...@talend.com:
 Hi there,

 I've started to work on a blueprint-based application, and basically the
 subject already says what I'm looking for :-) I googled around a little bit
 and found the following two blogposts that seem interesting:

 http://iocanel.blogspot.de/2012/01/advanced-integration-testing-with-pax.html

 http://gnodet.blogspot.de/2012/01/unit-testing-camel-blueprint-routes.html

 The library provided by Guillaume looks like a possible solution, but I'd
 like to ask if there is anything that I overlooked in my search and that
 might be helpful when testing blueprint contexts

 Any other suggestions or hints regarding the topic are highly welcome as
 well.

 Best regards

     Jerry



-- 

Apache Karaf http://karaf.apache.org/ Committer  PMC
OPS4J Pax Web http://wiki.ops4j.org/display/paxweb/Pax+Web/
Committer  Project Lead
OPS4J Pax for Vaadin
http://team.ops4j.org/wiki/display/PAXVAADIN/Home Commiter  Project
Lead
blog http://notizblog.nierbeck.de/