how to use pax-exam to test loaded features

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

how to use pax-exam to test loaded features

Taro Fukunaga
How would I use pax-exam to test whether a feature that I'm developing is properly loaded or not?

Right now what I would do in the karaf client is the following:

karaf@root> features:list

and check whether my feature is [installed]. If not then I have to dig into the logs to see what's wrong.

Can we have a command like features:status so that I don't have to do a visual inspection?

Cheers,
Taro
Reply | Threaded
Open this post in threaded view
|

Re: how to use pax-exam to test loaded features

Andreas Pieber
Hey Taro,

The easiest method via pax-exam might be to get the feature service, get your feature and check the status; this would look somehow like (I've written this one from memory so don't expect that there are no typos :-))):

@Inject
private FeaturesService featureService;

@Test
public void myTest() throws Exception {
  Feature myFeature = featureService.getFeature("myFeature");
  assertTrue(featureService.isInstalled(myFeature));
}

In the shell you can easily do something like "features:list | grep myFeature"; Depending on your need you can also automate the check of all your features writing a shell script for karaf checking if all your features containing "Started" in the same line...

TBH, thanks to grep, I do not consider a feature:status command for really required, but on the other hand it wouldn't hurt neither ;-) would you like to create a Jira for this? Might be a good and easy starter task for someone who would like to start contributing to Karaf.

Kind regards,
Andreas


On Tue, Nov 29, 2011 at 02:34, Taro Fukunaga <[hidden email]> wrote:
How would I use pax-exam to test whether a feature that I'm developing is
properly loaded or not?

Right now what I would do in the karaf client is the following:

karaf@root> features:list

and check whether my feature is [installed]. If not then I have to dig into
the logs to see what's wrong.

Can we have a command like features:status so that I don't have to do a
visual inspection?

Cheers,
Taro

--
View this message in context: http://karaf.922171.n3.nabble.com/how-to-use-pax-exam-to-test-loaded-features-tp3543986p3543986.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: how to use pax-exam to test loaded features

Taro Fukunaga
Hi Andreas,

The technique you describe using pax-exam is really awesome and is exactly what I was looking for.

And features:status would be nice so I will work on creating a Jira for it.

Regards,
Taro
Reply | Threaded
Open this post in threaded view
|

Re: how to use pax-exam to test loaded features

Andreas Pieber
Good to hear that the idea works for you. BTW, if you use pax-exam to test Karaf you might also want to give paxexam-karaf a shot (https://github.com/openengsb/labs-paxexam-karaf). This one is also included in the master and will be released with 3.0.0 somewhere in December.

Kind regards,
Andreas

On Tue, Nov 29, 2011 at 20:01, Taro Fukunaga <[hidden email]> wrote:
Hi Andreas,

The technique you describe using pax-exam is really awesome and is exactly
what I was looking for.

And features:status would be nice so I will work on creating a Jira for it.

Regards,
Taro

--
View this message in context: http://karaf.922171.n3.nabble.com/how-to-use-pax-exam-to-test-loaded-features-tp3543986p3546131.html
Sent from the Karaf - User mailing list archive at Nabble.com.