forked from kaoto-archive/kaoto-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Expressions languages are more complex than we thought
Fixes kaoto-archive#479
- Loading branch information
Showing
34 changed files
with
899 additions
and
115 deletions.
There are no files selected for viewing
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
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
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
76 changes: 76 additions & 0 deletions
76
...upport/src/test/resources/io/kaoto/backend/api/service/step/parser/camelroute/route2.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
- from: | ||
uri: timer:trigger-gitter-streaming | ||
parameters: | ||
repeatCount: '1' | ||
steps: | ||
- log: | ||
message: Opening connection to Gitter... | ||
- set-header: | ||
name: Authorization | ||
expression: | ||
simple: | ||
expression: Bearer {{token}} | ||
- set-header: | ||
simple: | ||
expression: ${body} | ||
result-type: long | ||
- to: | ||
uri: https://gitter.ems.host/_matrix/client/v3/sync | ||
- log: | ||
message: Gitter HTTP Streaming started | ||
- loop: | ||
expression: | ||
simple: | ||
expression: 'true' | ||
do-while: true | ||
steps: | ||
- remove-headers: | ||
pattern: '*' | ||
- set-property: | ||
name: next_batch | ||
expression: | ||
jsonpath: | ||
expression: $.next_batch | ||
- set-header: | ||
name: Authorization | ||
expression: | ||
simple: | ||
expression: Bearer {{token}} | ||
- to-d: | ||
uri: https://gitter.ems.host/_matrix/client/v3/sync?timeout=30000&filter={"account_data":{"not_types":["*"]},"room":{"account_data":{"not_types":["*"]},"rooms":["{{room}}"],"timeline":{"limit":1,"types":["m.room.message"]},"state":{"not_types":["*"]}} | ||
}&since=${exchangeProperty.next_batch}&disableStreamCache=true | ||
- convert-body-to: | ||
type: String | ||
- choice: | ||
when: | ||
- jsonpath: $['rooms'] | ||
steps: | ||
- set-property: | ||
name: backup-response | ||
expression: | ||
simple: | ||
expression: ${body} | ||
- set-header: | ||
name: CamelJsltString | ||
expression: | ||
constant: | ||
expression: |- | ||
let event = [for (.rooms.join) | ||
.value.timeline.events[0]] { | ||
"fromUser": { | ||
"username": replace($event[0].sender,"@|-(.*)",""), | ||
"displayName": replace($event[0].sender,"@|-(.*)","") | ||
}, | ||
"text": $event[0].content.body, | ||
"sent": format-time(replace($event[0].origin_server_ts, "[\\s\\S]{3}\\z", ""), "yyyy-MM-dd'T'HH:mm:ss.SSSX"), | ||
} | ||
- to: | ||
uri: jslt:dummy | ||
parameters: | ||
allowTemplateFromHeader: 'true' | ||
- wire-tap: | ||
uri: kamelet:sink | ||
- set-body: | ||
expression: | ||
simple: | ||
expression: ${exchangeProperty.backup-response} |
79 changes: 79 additions & 0 deletions
79
...pport/src/test/resources/io/kaoto/backend/api/service/step/parser/camelroute/route2b.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
- from: | ||
uri: "timer:trigger-gitter-streaming" | ||
parameters: | ||
repeatCount: 1 | ||
steps: | ||
- log: | ||
message: Opening connection to Gitter... | ||
- setHeader: | ||
name: Authorization | ||
expression: | ||
simple: | ||
expression: "Bearer {{token}}" | ||
- set-header: | ||
name: test | ||
simple: | ||
expression: ${body} | ||
result-type: long | ||
- to: | ||
uri: >- | ||
https://gitter.ems.host/_matrix/client/v3/sync?filter={"account_data":{"not_types":["*"]},"room":{"account_data":{"not_types":["*"]},"rooms":["{{room}}"],"timeline":{"limit":1,"types":["m.room.message"]},"state":{"not_types":["*"]} | ||
} } | ||
- log: | ||
message: Gitter HTTP Streaming started | ||
- loop: | ||
doWhile: true | ||
expression: | ||
simple: | ||
expression: true | ||
steps: | ||
- removeHeaders: | ||
pattern: "*" | ||
- setProperty: | ||
name: next_batch | ||
expression: | ||
jsonpath: | ||
expression: $.next_batch | ||
- setHeader: | ||
name: Authorization | ||
expression: | ||
simple: | ||
expression: "Bearer {{token}}" | ||
- toD: | ||
uri: >- | ||
https://gitter.ems.host/_matrix/client/v3/sync?timeout=30000&filter={"account_data":{"not_types":["*"]},"room":{"account_data":{"not_types":["*"]},"rooms":["{{room}}"],"timeline":{"limit":1,"types":["m.room.message"]},"state":{"not_types":["*"]} | ||
} }&since=${exchangeProperty.next_batch}&disableStreamCache=true | ||
- convertBodyTo: | ||
type: String | ||
- when: | ||
expression: | ||
jsonpath: | ||
suppressExceptions: true | ||
expression: "$['rooms']" | ||
steps: | ||
- setProperty: | ||
name: backup-response | ||
expression: | ||
simple: | ||
expression: "${body}" | ||
- setHeader: | ||
name: CamelJsltString | ||
expression: | ||
constant: | ||
expression: >- | ||
let event = [for (.rooms.join) | ||
.value.timeline.events[0]] { | ||
"fromUser": { | ||
"username": replace($event[0].sender,"@|-(.*)",""), | ||
"displayName": replace($event[0].sender,"@|-(.*)","") | ||
}, | ||
"text": $event[0].content.body, | ||
"sent": format-time(replace($event[0].origin_server_ts, "[\\s\\S]{3}\\z", ""), "yyyy-MM-dd'T'HH:mm:ss.SSSX"), | ||
} | ||
- to: "jslt:dummy?allowTemplateFromHeader=true" | ||
- wire-tap: | ||
uri: "kamelet:sink" | ||
- setBody: | ||
expression: | ||
simple: | ||
expression: "${exchangeProperty.backup-response}" |
9 changes: 9 additions & 0 deletions
9
...upport/src/test/resources/io/kaoto/backend/api/service/step/parser/camelroute/route3.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- from: | ||
uri: direct:set-body | ||
steps: | ||
- set-body: | ||
expression: | ||
simple: | ||
expression: Hello from yaml route set-body | ||
- log: | ||
message: Opening connection to Gitter... |
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
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
Oops, something went wrong.