Giter Club home page Giter Club logo

smx-integration-testing's Introduction

This project demonstrates a number of mechanisms for testing OSGi artifacts based on SpringDM that are intended to be deployed against ServiceMix. It is intended to demonstrate:

  • integration testing of OSGi bundles and Karaf features being deployed into a Karaf container
  • integration testing of Spring-DM Camel routes
  • unit testing of the same Camel routes outside of an OSGi container

The integration testing approach expands on that defined in Advanced integration testing with Pax Exam Karaf.

Project layout

The Maven projects contained within are as follows:

  • servicemix-test-utils - Contains utility classes for use with Pax Exam Karaf, that simplify the configuration of an integration with ServiceMix.
  • dm-integration-testing/dm-bundle - Contains a SpringDM bundle with a Camel route to be tested. Includes a pax-exam integration test for the bundle to check that it deploys as expected.
  • dm-integration-testing/dm-features - Defines a features.xml which deploys the dm-bundle; tests the feature as a pax-exam integration test.

Usage

When building the project for the first time, run $> mvn install.

Approach

Integration tests are executed by the maven-failsafe-plugin at the integration-test phase, which is run after packaging but before deployment; any project which fails at this stage will not have its artifacts deployed.

The convention applied is the default of the plugin, which defines integration tests in the src/test/java directory, with names matching *ITCase.java. This avoids clashes with the standard JUnit conventions (*Test.java) applied to unit tests via the maven-surefire-plugin. Build artifacts are sourced from the target directory.

The dm-bundle project defines a number of files of interest that provide maximum reuse of the core source artifacts, while enabling ease of testing:

  • the src/main/resources/META-INF/spring is automatically scanned by the SpringDM framework when the bundle is deployed in a container for any files matching *.xml; these are then treated as standard Spring beans definitions. The project defines two files (this definition is a standard way of doing things):
    • dm-bundle-context.xml - this is a standard Spring file with a Camel context that defines a route. Spring ${} property placeholders are used, but the file intentionally does not define a PropertyPlaceHolderConfigurer.
    • dm-bundle-osgi-context.xml - this defines the SpringDM OSGi bits (defined via the osgi and osgix namespaces). When loaded into a container, this will provide all of the necessary hooks into the configuration service and service registry.
  • the src/test/resources/ directory is used to define configuration that will be used by unit tests only. It contains:
    • dm-bundle-test-context.xml - a substitute for META-INF/spring/dm-bundle-osgi-context.xml; to be used in conjunction with META-INF/spring/dm-bundle-context.xml. It defines a PropertyPlaceHolderConfigurer that will fill in the ${} placeholders.
    • test.properties - the properties used to fill those placeholders.

smx-integration-testing's People

Contributors

jkorab avatar

Stargazers

sully6768 avatar

Watchers

sully6768 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.