Created
June 9, 2021 06:15
-
-
Save lburgazzoli/b3435194034ba35e4aacbfac00ea4c0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def "kamelet with filter and flow"() { | |
setup: | |
setFlowMode(YamlDeserializationMode.FLOW) | |
loadKamelets ''' | |
apiVersion: camel.apache.org/v1alpha1 | |
kind: Kamelet | |
metadata: | |
name: filter-action | |
spec: | |
definition: | |
title: "Filter" | |
description: "Filter based on the body" | |
flow: | |
from: | |
uri: kamelet:source | |
steps: | |
- filter: | |
simple: '${header.foo} == "a"' | |
- to: | |
uri: "kamelet:sink" | |
''' | |
loadRoutes ''' | |
- from: | |
uri: "direct:start" | |
steps: | |
- kamelet: | |
name: "filter-action" | |
- to: | |
uri: "mock:result" | |
''' | |
withMock('mock:result') { | |
expectedBodiesReceived '1', '3' | |
} | |
when: | |
context.start() | |
withTemplate { | |
to('direct:start').withBody('1').withHeader('foo', 'a').send() | |
to('direct:start').withBody('2').withHeader('foo', 'b').send() | |
to('direct:start').withBody('3').withHeader('foo', 'a').send() | |
to('direct:start').withBody('4').withHeader('foo', 'c').send() | |
} | |
then: | |
MockEndpoint.assertIsSatisfied(context) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment