You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "Vestal, Rick" <ri...@vestalclan.org> on 2012/01/17 22:12:28 UTC

paxexam labs question

Hi all,

Finally back to some osgi work and was very happy to see ServiceMix 4.4.0
out so that I can move to it and not lose the paxexam karaf test framework.

I've got a question on how other users are testing their modules.

Ideally, I'd like to have a set of integration tests live in the osgi
bundle module that use the paxexam labs work.  The problem I'm running into
is that the 'latest' version of my osgi bundle isn't what is provisioned as
the provision option is picking up the last one installed into my local
maven repository.

Is there an option to make the provision call use the 'just packaged'
bundle?

Thanks,

-- Rick

Re: paxexam labs question

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

I guess that you name "pax exam lab" is the Karaf Pax Exam, especially 
providing:

org.openengsb.labs.paxexam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
org.ops4j.pax.exam.CoreOptions.maven;

You can execute commands directly in your Karaf itests with something like:

String response;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
PrintStream printStream = new PrintStream(byteArrayOutputStream);
CommandProcessor commandProcessor = getOsgiService(CommandProcessor.class);
CommandSession commandSession = 
commandProcessor.createSession(System.in, printStream, System.err);
commandSession.execute("bundle:install mvn:groupId/artifactId...");
printStream.flush();
String output = return byteArrayOutputStream.toString();

So it means that you can install your bundle/feature, etc as you can do 
in Karaf directly.

Regards
JB

On 01/17/2012 10:12 PM, Vestal, Rick wrote:
> Hi all,
>
> Finally back to some osgi work and was very happy to see ServiceMix
> 4.4.0 out so that I can move to it and not lose the paxexam karaf test
> framework.
>
> I've got a question on how other users are testing their modules.
>
> Ideally, I'd like to have a set of integration tests live in the osgi
> bundle module that use the paxexam labs work.  The problem I'm running
> into is that the 'latest' version of my osgi bundle isn't what is
> provisioned as the provision option is picking up the last one installed
> into my local maven repository.
>
> Is there an option to make the provision call use the 'just packaged'
> bundle?
>
> Thanks,
>
> -- Rick

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

Re: paxexam labs question

Posted by Caspar MacRae <ea...@gmail.com>.
Not sure if this is available in the Karaf version, but in vanilla Pax Exam
you can do:

bundle("reference:file:" + org.ops4j.pax.exam.util.PathUtils.getBaseDir() +
"/target/classes/")

This requires the manifest is in the correct place (i.e. the target/classes
directory is an unzipped mirror of the final bundle).

The only other option (AFAIK) is to move your integration test into a
separate module that's built after your bundle's module (personally I don't
like this as it moves the test away from its subject - though obviously
this is fine/necessary for end-to-end tests).




On 17 January 2012 21:12, Vestal, Rick <ri...@vestalclan.org> wrote:

> Hi all,
>
> Finally back to some osgi work and was very happy to see ServiceMix 4.4.0
> out so that I can move to it and not lose the paxexam karaf test framework.
>
> I've got a question on how other users are testing their modules.
>
> Ideally, I'd like to have a set of integration tests live in the osgi
> bundle module that use the paxexam labs work.  The problem I'm running into
> is that the 'latest' version of my osgi bundle isn't what is provisioned as
> the provision option is picking up the last one installed into my local
> maven repository.
>
> Is there an option to make the provision call use the 'just packaged'
> bundle?
>
> Thanks,
>
> -- Rick
>

Re: paxexam labs question

Posted by Andreas Pieber <an...@gmail.com>.
instead of using mvn:... you can also use file:... and pointing it to the
one in your target directory.

Kind regards,
Andreas

On Tue, Jan 17, 2012 at 22:12, Vestal, Rick <ri...@vestalclan.org> wrote:

> Hi all,
>
> Finally back to some osgi work and was very happy to see ServiceMix 4.4.0
> out so that I can move to it and not lose the paxexam karaf test framework.
>
> I've got a question on how other users are testing their modules.
>
> Ideally, I'd like to have a set of integration tests live in the osgi
> bundle module that use the paxexam labs work.  The problem I'm running into
> is that the 'latest' version of my osgi bundle isn't what is provisioned as
> the provision option is picking up the last one installed into my local
> maven repository.
>
> Is there an option to make the provision call use the 'just packaged'
> bundle?
>
> Thanks,
>
> -- Rick
>