You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by ken <an...@gmail.com> on 2014/03/28 01:42:01 UTC

integration testing with karaf

Hi,

I've been reading and trying to write some integration testing using karaf,
looking at
http://karaf.apache.org/manual/latest/developers-guide/writing-tests.html
seems rather straightforward.  

However, I am getting java.lang.NoClassDefFoundError:
org/ops4j/pax/exam/options/extra/FeaturesScannerProvisionOption which isn't
in pax-exam 3.4.0

But if i use 2.6.0, it'll satisfy the requirement but it will raise
java.lang.NoClassDefFoundError:
org/ops4j/pax/exam/ExamConfigurationException

Has anyone created integration test using gradle successfully?

Thanks,

Ken



--
View this message in context: http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: integration testing with karaf

Posted by Christian Schneider <ch...@die-schneider.net>.
Can you try with the example from the pax exam site?
https://ops4j1.jira.com/wiki/display/PAXEXAM3/Karaf+Container

Christian

On 28.03.2014 01:42, ken wrote:
> Hi,
>
> I've been reading and trying to write some integration testing using karaf,
> looking at
> http://karaf.apache.org/manual/latest/developers-guide/writing-tests.html
> seems rather straightforward.
>
> However, I am getting java.lang.NoClassDefFoundError:
> org/ops4j/pax/exam/options/extra/FeaturesScannerProvisionOption which isn't
> in pax-exam 3.4.0
>
> But if i use 2.6.0, it'll satisfy the requirement but it will raise
> java.lang.NoClassDefFoundError:
> org/ops4j/pax/exam/ExamConfigurationException
>
> Has anyone created integration test using gradle successfully?
>
> Thanks,
>
> Ken
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439.html
> Sent from the Karaf - User mailing list archive at Nabble.com.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: integration testing with karaf

Posted by Oliver Lietz <ap...@oliverlietz.de>.
On Friday 28 March 2014 23:23:53 ken wrote:
> jbonofre,
> 
> so org.ops4j.pax.exam:pax-exam-container-karaf:3.4.0 is deprecated and I
> should be using
> 'org.apache.karaf.tooling.exam:org.apache.karaf.tooling.exam.container:3.0.
> 0.RC1' ?
> 
> Also, issue arises :(  I am still playing around with pax-exam and trying
> to install a bundle and see if it exist.  This is so I get the hang of
> things before writing real integration tests.
> 
> 
> and my check is as simple as
> 
> it doesn't seem to be able to find the bundle.

Ken, I'm doing exactly that in my tests to make sure a certain feature is 
ready to use (all bundles active). Did you have a look?

O.

> any suggestions as to what i am doing wrong?
> 
> Thanks,
> 
> Ken
> 

Re: integration testing with karaf

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
No

it's the opposite: org.apache.karaf.tooling.exam.container is 
deprecated, you should use pax-exam-container-karaf >= 3.4.0.

It's what Karaf uses for its own itests.

Regards
JB

On 03/28/2014 11:23 PM, ken wrote:
> jbonofre,
>
> so org.ops4j.pax.exam:pax-exam-container-karaf:3.4.0 is deprecated and I
> should be using
> 'org.apache.karaf.tooling.exam:org.apache.karaf.tooling.exam.container:3.0.0.RC1'
> ?
>
> Also, issue arises :(  I am still playing around with pax-exam and trying to
> install a bundle and see if it exist.  This is so I get the hang of things
> before writing real integration tests.
>
>
> and my check is as simple as
>
> it doesn't seem to be able to find the bundle.
>
> any suggestions as to what i am doing wrong?
>
> Thanks,
>
> Ken
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439p4032459.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: integration testing with karaf

Posted by Achim Nierbeck <bc...@googlemail.com>.
erf,

no the pax-exam is the one to use, the Karaf one is the old one that is
deprecated :)

regards, Achim


2014-03-28 23:23 GMT+01:00 ken <an...@gmail.com>:

> jbonofre,
>
> so org.ops4j.pax.exam:pax-exam-container-karaf:3.4.0 is deprecated and I
> should be using
>
> 'org.apache.karaf.tooling.exam:org.apache.karaf.tooling.exam.container:3.0.0.RC1'
> ?
>
> Also, issue arises :(  I am still playing around with pax-exam and trying
> to
> install a bundle and see if it exist.  This is so I get the hang of things
> before writing real integration tests.
>
>
> and my check is as simple as
>
> it doesn't seem to be able to find the bundle.
>
> any suggestions as to what i am doing wrong?
>
> Thanks,
>
> Ken
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439p4032459.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>

Software Architect / Project Manager / Scrum Master

Re: integration testing with karaf

Posted by ken <an...@gmail.com>.
Here's the stack trace when the test fails.




--
View this message in context: http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439p4032521.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: integration testing with karaf

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
It's maybe due to DeadLock issue:
https://ops4j1.jira.com/browse/PAXEXAM-609

Do you have something in log/messages when container doesn't come up ?

Regards
JB

On 03/29/2014 11:48 PM, ken wrote:
> I managed to figure the useDeployFolder flag and it is now working.
>
> However, it seems as though the deeper I dig into the pax-exam, the more
> problems I find.  Sometimes I get a RuntimeException saying "container never
> came up".  Somehow, it is not starting in a timely fashion and I am only
> starting 2 bundles from my features repo.  Are there any tricks to speed it
> up?
>
> Thanks
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439p4032478.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: integration testing with karaf

Posted by ken <an...@gmail.com>.
I managed to figure the useDeployFolder flag and it is now working.

However, it seems as though the deeper I dig into the pax-exam, the more
problems I find.  Sometimes I get a RuntimeException saying "container never
came up".  Somehow, it is not starting in a timely fashion and I am only
starting 2 bundles from my features repo.  Are there any tricks to speed it
up?

Thanks



--
View this message in context: http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439p4032478.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: integration testing with karaf

Posted by Christian Schneider <ch...@die-schneider.net>.
Maybe you let pax exam do the bundle install using the deploy folder of 
karaf.
Then it is possible that your test code runs before the bundle is installed.

Try this:
|.useDeployFolder(||false||)|
Then a feature file will be used and pax exam will make sure the bundle 
is started before your test runs.

In most pax exam tests you simply inject a service into the test. 
Besides providing the service for your test class this makes sure the bundle
containing the service is up and running.

Christian


Am 28.03.2014 23:23, schrieb ken:
>
> Also, issue arises :(  I am still playing around with pax-exam and trying to
> install a bundle and see if it exist.  This is so I get the hang of things
> before writing real integration tests.
>
>
> and my check is as simple as
>
> it doesn't seem to be able to find the bundle.
>
> any suggestions as to what i am doing wrong?
>
> Thanks,
>
> Ken
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439p4032459.html
> Sent from the Karaf - User mailing list archive at Nabble.com.


-- 
  
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Re: integration testing with karaf

Posted by ken <an...@gmail.com>.
jbonofre,

so org.ops4j.pax.exam:pax-exam-container-karaf:3.4.0 is deprecated and I
should be using
'org.apache.karaf.tooling.exam:org.apache.karaf.tooling.exam.container:3.0.0.RC1'
?

Also, issue arises :(  I am still playing around with pax-exam and trying to
install a bundle and see if it exist.  This is so I get the hang of things
before writing real integration tests.


and my check is as simple as

it doesn't seem to be able to find the bundle.

any suggestions as to what i am doing wrong?

Thanks,

Ken



--
View this message in context: http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439p4032459.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: integration testing with karaf

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Ken,

pax-exam-container-karaf is now deprecated: it has been donated directly 
in pax-exam (you need at least pax-exam 3.4.0).

Regards
JB

On 03/28/2014 07:19 PM, ken wrote:
> Christian, Oliver,
>
> Thanks for the tips and I got the integration test to work.
>
> One last question - what is the difference between
> org.apache.karaf.tooling.exam.container and pax-exam-container-karaf?
>
> I am using pax-exam-container-karaf like Christian suggested and it works.
>
> Thanks,
>
> Ken
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439p4032457.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: integration testing with karaf

Posted by ken <an...@gmail.com>.
Christian, Oliver,

Thanks for the tips and I got the integration test to work.  

One last question - what is the difference between
org.apache.karaf.tooling.exam.container and pax-exam-container-karaf?

I am using pax-exam-container-karaf like Christian suggested and it works.

Thanks,

Ken



--
View this message in context: http://karaf.922171.n3.nabble.com/integration-testing-with-karaf-tp4032439p4032457.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: integration testing with karaf

Posted by Oliver Lietz <ap...@oliverlietz.de>.
On Friday 28 March 2014 01:42:01 ken wrote:
> Hi,

hi Ken,

> I've been reading and trying to write some integration testing using karaf,
> looking at
> http://karaf.apache.org/manual/latest/developers-guide/writing-tests.html
> seems rather straightforward.
> 
> However, I am getting java.lang.NoClassDefFoundError:
> org/ops4j/pax/exam/options/extra/FeaturesScannerProvisionOption which isn't
> in pax-exam 3.4.0
> 
> But if i use 2.6.0, it'll satisfy the requirement but it will raise
> java.lang.NoClassDefFoundError:
> org/ops4j/pax/exam/ExamConfigurationException

I had similar issues and got around by setting headers for Import- and Export-
Package in a test bundle:

http://svn.apache.org/viewvc/sling/trunk/contrib/launchpad/karaf/org.apache.sling.launchpad.karaf-
integration-
tests/src/main/java/org/apache/sling/launchpad/karaf/testing/KarafTestSupport.java?view=markup

> Has anyone created integration test using gradle successfully?
> 
> Thanks,
> 
> Ken

hth,
O.