[compress] Need Help With PAX Exam Tests

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[compress] Need Help With PAX Exam Tests

Stefan Bodewig
Hi all

I'm trying to resolve COMPRESS-443 which talks about having a regression
test that fails if we break the OSGi bundle again (has already happened
three times duing the life of Compress so far). But unfortunately I'm
getting stuck with my limited Maven and even more limited PAX Exam Fu.

You can see what I've tried in the COMPRESS-443 branch:
https://github.com/apache/commons-compress/tree/COMPRESS-443

The OsgiITest I've added loads the SNAPSHOT version I've installed into
my local repo last and doen't care about the current classes and POM,
which is quite understandable as the bundle hasn't even been built when
I try to run the test.

Do I have to create a separate maven project just for the tests? If so,
I'll probably just drop the very idea as turning compress into a reactor
build just for a single test case feels wrong.

I really hope I am missing something obvious. This has been true often
enough that I'm optimisitic :-)

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [compress] Need Help With PAX Exam Tests

garydgregory
You should take a look at the Log4j 2 module log4j-osgi. We do some "bare
bones let's make sure we can load modules" tests using both Eclipse Equinox
and Apache Felix.

Gary

On Mon, Apr 23, 2018 at 2:21 PM, Stefan Bodewig <[hidden email]> wrote:

> Hi all
>
> I'm trying to resolve COMPRESS-443 which talks about having a regression
> test that fails if we break the OSGi bundle again (has already happened
> three times duing the life of Compress so far). But unfortunately I'm
> getting stuck with my limited Maven and even more limited PAX Exam Fu.
>
> You can see what I've tried in the COMPRESS-443 branch:
> https://github.com/apache/commons-compress/tree/COMPRESS-443
>
> The OsgiITest I've added loads the SNAPSHOT version I've installed into
> my local repo last and doen't care about the current classes and POM,
> which is quite understandable as the bundle hasn't even been built when
> I try to run the test.
>
> Do I have to create a separate maven project just for the tests? If so,
> I'll probably just drop the very idea as turning compress into a reactor
> build just for a single test case feels wrong.
>
> I really hope I am missing something obvious. This has been true often
> enough that I'm optimisitic :-)
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [compress] Need Help With PAX Exam Tests

Stefan Bodewig
On 2018-04-24, Gary Gregory wrote:

> You should take a look at the Log4j 2 module log4j-osgi. We do some "bare
> bones let's make sure we can load modules" tests using both Eclipse Equinox
> and Apache Felix.

Will do, thanks.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [compress] Need Help With PAX Exam Tests

Oliver Heger-3
In reply to this post by Stefan Bodewig
Hi,

Am 23.04.2018 um 22:21 schrieb Stefan Bodewig:

> Hi all
>
> I'm trying to resolve COMPRESS-443 which talks about having a regression
> test that fails if we break the OSGi bundle again (has already happened
> three times duing the life of Compress so far). But unfortunately I'm
> getting stuck with my limited Maven and even more limited PAX Exam Fu.
>
> You can see what I've tried in the COMPRESS-443 branch:
> https://github.com/apache/commons-compress/tree/COMPRESS-443
>
> The OsgiITest I've added loads the SNAPSHOT version I've installed into
> my local repo last and doen't care about the current classes and POM,
> which is quite understandable as the bundle hasn't even been built when
> I try to run the test.
>
> Do I have to create a separate maven project just for the tests? If so,
> I'll probably just drop the very idea as turning compress into a reactor
> build just for a single test case feels wrong.
>
> I really hope I am missing something obvious. This has been true often
> enough that I'm optimisitic :-)

at work we used PaxExam to test OSGi-based applications consisting of
multiple modules. Here the (integration) tests have always been in a
separate module as they require a more complex setup.

To have only a single module, maybe it would work to run the test in the
verify phase and reference the artifact via PaxExam's streamBundle()
option directly from the file system?

We could also think about having a separate Commons-internal project
that contains OSGi-related tests. Such tests are useful for most of our
components, and we could even test whether they collaborate correctly in
their current versions. Well, this is certainly not trivial.

Oliver

>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [compress] Need Help With PAX Exam Tests

Stefan Bodewig
On 2018-04-24, Oliver Heger wrote:

> at work we used PaxExam to test OSGi-based applications consisting of
> multiple modules. Here the (integration) tests have always been in a
> separate module as they require a more complex setup.

> To have only a single module, maybe it would work to run the test in the
> verify phase and reference the artifact via PaxExam's streamBundle()
> option directly from the file system?

On its own this would probably still require the jar to be built before
running the test. It may be possible to construct the bundle on the fly
with Tinybundles but I'm afraid it would be too easy to end up with an
articial bundle that's different from the JAR we ship.

> We could also think about having a separate Commons-internal project
> that contains OSGi-related tests. Such tests are useful for most of our
> components, and we could even test whether they collaborate correctly in
> their current versions. Well, this is certainly not trivial.

This sounds way more ambitioned then I feel right now - but you are
certainly right this would be extremely useful :-)

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [compress] Need Help With PAX Exam Tests

Stefan Bodewig
In reply to this post by garydgregory
On 2018-04-24, Gary Gregory wrote:

> You should take a look at the Log4j 2 module log4j-osgi. We do some "bare
> bones let's make sure we can load modules" tests using both Eclipse Equinox
> and Apache Felix.

AFAICT this also required the bundle to be built in advance - which is
logical. Unfortunately I haven't got any idea how to achieve that
without using two separate Maven projects.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [compress] Need Help With PAX Exam Tests

Robert Munteanu
Hi Stefan,

On Wed, 2018-04-25 at 18:41 +0200, Stefan Bodewig wrote:

> On 2018-04-24, Gary Gregory wrote:
>
> > You should take a look at the Log4j 2 module log4j-osgi. We do some
> > "bare
> > bones let's make sure we can load modules" tests using both Eclipse
> > Equinox
> > and Apache Felix.
>
> AFAICT this also required the bundle to be built in advance - which
> is
> logical. Unfortunately I haven't got any idea how to achieve that
> without using two separate Maven projects.

It is definitely possible to use a single project with Pax-Exam. Take a
look for instance at

  https://github.com/cschneider/osgi-testing-example

If that does not work for your for some reason I'm sure we can tweak
it.

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [compress] Need Help With PAX Exam Tests

Stefan Bodewig
On 2018-04-25, Robert Munteanu wrote:

> Hi Stefan,

> On Wed, 2018-04-25 at 18:41 +0200, Stefan Bodewig wrote:
>> On 2018-04-24, Gary Gregory wrote:

>>> You should take a look at the Log4j 2 module log4j-osgi. We do some
>>> "bare
>>> bones let's make sure we can load modules" tests using both Eclipse
>>> Equinox
>>> and Apache Felix.

>> AFAICT this also required the bundle to be built in advance - which
>> is
>> logical. Unfortunately I haven't got any idea how to achieve that
>> without using two separate Maven projects.

> It is definitely possible to use a single project with Pax-Exam. Take a
> look for instance at

>   https://github.com/cschneider/osgi-testing-example

Many thanks, this looks promising!

bundle("reference:file:target/classes/") probably is what I was
missing. I'll give it a try later.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [compress] Need Help With PAX Exam Tests

Stefan Bodewig
In reply to this post by Robert Munteanu
On 2018-04-25, Robert Munteanu wrote:

> It is definitely possible to use a single project with Pax-Exam. Take a
> look for instance at

>   https://github.com/cschneider/osgi-testing-example

This is exactly what I needed, many thanks!

I've committed a mostly empty unit test that fails if I remove a colon
from the import-package configuration - exactly the problem that caused
COMPRESS-442.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [compress] Need Help With PAX Exam Tests

Robert Munteanu
On Wed, 2018-04-25 at 20:32 +0200, Stefan Bodewig wrote:

> On 2018-04-25, Robert Munteanu wrote:
>
> > It is definitely possible to use a single project with Pax-Exam.
> > Take a
> > look for instance at
> >   https://github.com/cschneider/osgi-testing-example
>
> This is exactly what I needed, many thanks!
>
> I've committed a mostly empty unit test that fails if I remove a
> colon
> from the import-package configuration - exactly the problem that
> caused
> COMPRESS-442.

Glad to hear that.

RObert

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]