Skip to content

Instantly share code, notes, and snippets.

@lburgazzoli
Created June 9, 2021 06:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lburgazzoli/b3435194034ba35e4aacbfac00ea4c0f to your computer and use it in GitHub Desktop.
Save lburgazzoli/b3435194034ba35e4aacbfac00ea4c0f to your computer and use it in GitHub Desktop.
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