Skip to content

About

Citrus sample projects using Java DSL tests and Spring Java configuration

Resources

Stars

70 stars

Watchers

9 watching

Forks

Repository files navigation

Citrus samples Logo

Executable examples for Citrus integration testing

This repository contains small, independent Citrus 5.2.0 projects. Each sample focuses on one testing capability, runtime, endpoint, connector, validation technology, or complete showcase. Most samples test the shared todo application; larger showcases keep their own system under test.

Sample index

Learning path

  1. Run getting-started and compare its four equivalent DSL scenarios.
  2. Compare annotation configuration with Java configuration.
  3. Choose a test runtime in runtimes, then explore HTTP basic or SOAP basic.
  4. Add payload checks with the XML and JSON validation samples.
  5. Explore transport and browser connectors, then run a complete showcase.

DSL coverage matrix

The matrix is maintained by hand. Update it when you add, move, or remove a sample, or change its purpose, main module, runtime, or DSL coverage.

Sample Description Main module Runtime Java XML YAML Groovy
getting-started Runs one scenario in Java, XML, YAML, and Groovy citrus-base testng Yes Yes Yes Yes
core/annotation-config Configures endpoints with annotations citrus-base testng Yes Yes Yes —
core/java-config Configures endpoints with plain Java and Spring configuration classes citrus-spring testng Yes Yes Yes —
core/behaviors Reuses test actions through test behaviors citrus-base testng Yes Yes Yes —
core/data-dictionaries Manipulates messages with data dictionaries citrus-base testng Yes Yes Yes —
core/message-store Reads exchanged messages from the internal message store citrus-base testng Yes Yes Yes —
core/dynamic-endpoints Creates endpoints dynamically from endpoint URIs citrus-base testng Yes Yes Yes —
core/reporting Adds a custom test reporter citrus-base testng Yes Yes Yes —
runtimes/testng Runs Citrus tests with TestNG citrus-testng testng Yes Yes Yes —
runtimes/testng-dataprovider Parameterizes tests with TestNG data providers citrus-testng testng Yes Yes Yes —
runtimes/junit4 Runs Citrus tests with JUnit 4 citrus-junit junit4 Yes Yes Yes —
runtimes/junit-jupiter Runs Citrus tests with JUnit Jupiter citrus-junit-jupiter junit-jupiter Yes Yes Yes —
runtimes/cucumber Writes BDD scenarios with Cucumber citrus-cucumber cucumber Yes — — —
runtimes/cucumber-spring Writes BDD scenarios with Cucumber and Spring injection citrus-cucumber cucumber Yes — — —
endpoints/http/basic Calls a REST API as an HTTP client citrus-http testng Yes Yes Yes Yes
endpoints/http/basic-auth Uses basic authentication on HTTP client and server citrus-http testng Yes Yes Yes —
endpoints/http/form-data Sends and validates x-www-form-urlencoded form data citrus-http testng Yes Yes Yes —
endpoints/http/query-param Sends and validates HTTP query parameters citrus-http testng Yes Yes Yes —
endpoints/http/static-response Serves static responses from an HTTP server citrus-http testng Yes Yes Yes —
endpoints/http/https Uses SSL on HTTP client and server citrus-http testng Yes Yes Yes —
endpoints/http/load-test Calls a REST API from multiple threads for load testing citrus-http testng Yes Yes Yes —
endpoints/ws/basic Calls a SOAP web service as a client citrus-ws testng Yes Yes Yes Yes
endpoints/ws/attachment Sends SOAP attachments to a server citrus-ws testng Yes — — —
endpoints/ws/mtom Sends and receives MTOM-enabled SOAP attachments citrus-ws testng Yes — — —
endpoints/ws/ssl Uses SSL on a SOAP web service citrus-ws testng Yes — — —
endpoints/ws/static-response Serves static responses from a SOAP server citrus-ws testng Yes — — —
endpoints/ws/ws-addressing Uses WS-Addressing on SOAP client and server citrus-ws testng Yes — — —
endpoints/ws/ws-security Uses WS-Security on SOAP client and server citrus-ws testng Yes — — —
endpoints/ws/wsdl Generates tests from a WSDL citrus-ws testng Yes — — —
endpoints/jms Integrates with a JMS message broker citrus-jms testng Yes Yes Yes —
endpoints/kafka Integrates with Kafka citrus-kafka testng Yes Yes Yes —
endpoints/mail Simulates a mail server citrus-mail testng Yes Yes Yes —
endpoints/rmi Uses RMI as client and server citrus-rmi testng Yes — — —
endpoints/camel Interacts with an Apache Camel context and routes citrus-camel testng Yes Yes Yes —
endpoints/ftp/ftp Uses FTP as client and server citrus-ftp testng Yes — — —
endpoints/ftp/scp Uses SCP as client and server citrus-ftp testng Yes — — —
endpoints/ftp/sftp Uses SFTP as client and server citrus-ftp testng Yes — — —
endpoints/websocket/client Connects to a WebSocket as a client citrus-websocket quarkus Yes Yes Yes —
endpoints/websocket/server Provides a WebSocket server for clients citrus-websocket quarkus Yes Yes Yes —
connectors/docker Runs tests inside Docker infrastructure citrus-docker testng Yes — — —
connectors/kubernetes Runs tests inside Kubernetes infrastructure citrus-kubernetes testng Yes Yes Yes —
connectors/selenium Tests a web UI with Selenium citrus-selenium testng Yes Yes Yes —
connectors/playwright Tests a web UI with Playwright citrus-playwright testng Yes Yes Yes —
connectors/openapi Generates tests from an OpenAPI (Swagger) specification citrus-http testng Yes — — —
connectors/sql Validates data stored in a relational database citrus-sql testng Yes Yes Yes —
validation/xml/xml Validates XML with schemas and XPath citrus-validation-xml testng Yes Yes Yes —
validation/xml/xhtml Validates XHTML content citrus-validation-xml testng Yes Yes Yes —
validation/xml/oxm Marshals XML messages to and from objects citrus-validation-xml testng Yes Yes Yes —
validation/json/json Validates JSON payloads with JsonPath citrus-validation-json testng Yes Yes Yes —
validation/json/databind Maps JSON messages to and from objects citrus-validation-json testng Yes — — —
validation/hamcrest Uses Hamcrest matchers in validation and conditions citrus-validation-hamcrest testng Yes Yes Yes —
validation/binary Handles binary message content citrus-validation-binary testng Yes Yes Yes —
showcases/bakery Bakery order workflow across web, worker, and report services citrus-jms, citrus-http testng Yes — — —
showcases/bookstore Bookstore SOAP service with JMS backend citrus-ws, citrus-jms testng Yes Yes Yes —
showcases/flight-booking Flight booking with JMS, HTTP, and a database citrus-jms, citrus-http testng Yes Yes Yes —
showcases/greeting Greeting service over JMS and message channels citrus-jms, citrus-spring-integration testng Yes Yes Yes —
showcases/incident Incident management across SOAP, JMS, and HTTP citrus-ws, citrus-jms, citrus-http testng Yes Yes Yes —
showcases/quarkus Quarkus application with Kafka, HTTP, SQL, and a web UI citrus-quarkus quarkus Yes — — —
build-tools/gradle Runs Citrus tests with a Gradle build citrus-base gradle Yes Yes Yes —

Showcase transports

Each showcase ships its own system under test and combines several transports:

Showcase Kafka JMS HTTP SOAP Channel SQL Mail Sync Async
showcases/bakery X X X X X
showcases/bookstore X X X
showcases/flight-booking X X X X
showcases/greeting X X X X
showcases/incident X X X X X
showcases/quarkus X X X X X X

Prerequisites

  • JDK 21 or newer, with JAVA_HOME pointing to the JDK.
  • The repository Maven wrapper for in-repository builds, or Maven 3.9+ for copied samples.
  • A local Gradle installation for build-tools/gradle, which has no Gradle wrapper.
  • Additional infrastructure only where a leaf README requires it. Docker and Kubernetes samples are not in the default Maven reactor.

Run samples

Run every default Maven sample from the repository root:

./mvnw clean verify -Dsystem.under.test.mode=embedded

Run one sample without an aggregator parent:

./mvnw -f endpoints/http/basic/pom.xml clean verify -Dsystem.under.test.mode=embedded

Embedded mode starts and stops the sample's system under test with the Maven lifecycle. The standalone Gradle sample uses its own build:

cd build-tools/gradle
gradle clean build

Copy a sample out of the repository

Every sample root is self-contained. Aggregator POMs are not parents, so they do not need to be installed. Multi-module showcases must be copied as complete roots.

For samples that use the shared todo application, install that SUT once from the repository before running the copied project:

./mvnw -f apps/todo-app/pom.xml install -DskipTests
cp -R getting-started /tmp/citrus-getting-started
cd /tmp/citrus-getting-started
mvn clean verify -Dsystem.under.test.mode=embedded

Read the leaf README for its exact purpose, runtime, DSLs, prerequisites, and run command. Multi-DSL basic samples also explain how to remove an unwanted non-Java variant and its runner reference.

Information

For more information see citrusframework.org and the Citrus reference manual.

About

Citrus sample projects using Java DSL tests and Spring Java configuration

Resources

Stars

70 stars

Watchers

9 watching

Forks

Releases

Packages

Used by

Contributors

Languages