Posts

Showing posts with the label test

Testing custom Apache Karaf distributions

Apache Karaf provides KarafTestSupport to easily implement test on Karaf runtime. Karaf itself uses it to test most of Karaf services in the build (including Jenkins CI). This approach doesn’t only work for Karaf “vanilla” distribution, but also for any custom distributions based on Karaf. Custom distribution is available via Maven URL To illustrate, I’m implementing a test for Apache Unommi. Apache Unomi is a actually a custom Karaf distribution. It’s available on Maven Central. For this blog, I gonna test Unomi 1.5.1 release: https://repo1.maven.org/maven2/org/apache/unomi/unomi/1.5.1/ . Let’s start with the pom.xml . It basically contains: Karaf itest common and pax exam dependencies Unomi distribution we want to test Here’s the pom.xml : <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.

Testing (utest and itest) Apache Camel Blueprint route

Image
In any integration project, testing is vital for multiple reasons: to guarantee that the integration logic matches the expectations to quickly identify some regression issues to test some special cases, like the errors for instance to validate the succesful provisioning (deployment) on a runtime as close as possible to the target platform We distinguish two kinds of tests: the unit tests (utest) aim to test the behaviors of integration logic, and define the expectations that the logic has to match the integration tests (itest) aim to provision the integration logic artifact to a runtime, and check the behaviors on the actual platform Camel is THE framework to implement your integration logic (mediation). It provides the Camel Test Kit, based on JUnit to implement utest. In combinaison with Karaf and Pax Exam, we can cover both utest and itest. In this blog, we will: create an OSGi service create a Camel route using the Blueprint DSL, using the previously created OSGi service implement