Testing commands with Apache Karaf

After you've gone through the first two recipes, you should be set for thorough testing of OSGi bundles, either standalone or in Apache Karaf. When working with Apache Karaf, it is sometimes necessary to also have new commands. This recipe will cover how to test with commands and make sure these commands are executed inside the Apache Karaf shell.

Getting ready

It's best to have gone through the Testing Apache Karaf features recipe before starting this recipe, as this one is a follow up. The sources can be found at https://github.com/jgoodyear/ApacheKarafCookbook/tree/master/chapter10/chapter10-recipe3.

How to do it...

To test the execution of an Apache Karaf shell command, you need to tweak the test class. First, ...

Get Apache Karaf Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.