59 lines
2.0 KiB
Plaintext
59 lines
2.0 KiB
Plaintext
=== Stub Runner for Messaging
|
|
|
|
Stub Runner has the functionality to run the published stubs in memory. It can integrate with the following frameworks out of the box
|
|
|
|
- Spring Integration
|
|
- Spring Cloud Stream
|
|
- Apache Camel
|
|
- Spring AMQP
|
|
|
|
It also provides points of entry to integrate with any other solution on the market.
|
|
|
|
==== Stub triggering
|
|
|
|
To trigger a message it's enough to use the `StubTrigger` interface:
|
|
|
|
[source,groovy]
|
|
----
|
|
include::{stubrunner_core_path}/src/main/java/org/springframework/cloud/contract/stubrunner/StubTrigger.java[lines=16..-1]
|
|
----
|
|
|
|
For convenience the `StubFinder` interface extends `StubTrigger` so it's enough to use only one in your tests.
|
|
|
|
`StubTrigger` gives you the following options to trigger a message:
|
|
|
|
===== Trigger by label
|
|
|
|
[source,groovy]
|
|
----
|
|
include::{tests_path}/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=client_trigger,indent=0]
|
|
----
|
|
|
|
====== Trigger by group and artifact ids
|
|
|
|
[source,groovy]
|
|
----
|
|
include::{tests_path}/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=trigger_group_artifact,indent=0]
|
|
----
|
|
|
|
====== Trigger by artifact ids
|
|
|
|
[source,groovy]
|
|
----
|
|
include::{tests_path}/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=trigger_artifact,indent=0]
|
|
----
|
|
|
|
===== Trigger all messages
|
|
|
|
[source,groovy]
|
|
----
|
|
include::{tests_path}/spring-cloud-contract-stub-runner-camel/src/test/groovy/org/springframework/cloud/contract/stubrunner/messaging/camel/CamelStubRunnerSpec.groovy[tags=trigger_all,indent=0]
|
|
----
|
|
|
|
include::{tests_path}/spring-cloud-contract-stub-runner-camel/README.adoc[]
|
|
|
|
include::{tests_path}/spring-cloud-contract-stub-runner-integration/README.adoc[]
|
|
|
|
include::{tests_path}/spring-cloud-contract-stub-runner-stream/README.adoc[]
|
|
|
|
include::{tests_path}/spring-cloud-contract-stub-runner-amqp/README.adoc[] |