Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/camel-kamelets-itest/src/test/java/CommonIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,24 @@ public Stream<DynamicTest> transformation() {
public Stream<DynamicTest> crypto() {
return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("crypto");
}

@CitrusTestFactory
public Stream<DynamicTest> header() {
return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("header");
}

@CitrusTestFactory
public Stream<DynamicTest> filter() {
return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("filter");
}

@CitrusTestFactory
public Stream<DynamicTest> httpTests() {
return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("http");
}

@CitrusTestFactory
public Stream<DynamicTest> log() {
return CitrusTestFactorySupport.factory(TestLoader.YAML).packageScan("log");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

name: has-header-filter-action-pipe-test
variables:
- name: "id"
value: "citrus:randomUUID()"
- name: "header.name"
value: "myTestHeader"
- name: "header.value"
value: "myTestValue"
actions:
- createVariables:
variables:
- name: "http.server.url"
value: "http://localhost:${http.server.port}"
# Create Camel JBang integration
- camel:
jbang:
run:
waitForRunningState: false
integration:
file: "filter/has-header-filter-action-pipe.yaml"
systemProperties:
properties:
- name: "http.sink.url"
value: "${http.server.url}"
- name: "header.name"
value: "${header.name}"
- name: "header.value"
value: "${header.value}"
- name: "input"
value: |
{ \"id\": \"${id}\" }

# Verify Http request - message should pass through because header exists
- http:
server: "httpServer"
receiveRequest:
POST:
path: "/result"
headers:
- name: "${header.name}"
value: "${header.value}"

- http:
server: "httpServer"
sendResponse:
response:
status: 200
reasonPhrase: "OK"
version: "HTTP/1.1"
body:
data: "Thank You!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: has-header-filter-action-pipe
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: timer-source
properties:
period: 10000
message: "{{input}}"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: insert-header-action
properties:
name: "{{header.name}}"
value: "{{header.value}}"
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: has-header-filter-action
properties:
name: "{{header.name}}"
sink:
uri: "{{http.sink.url}}/result"
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

name: predicate-filter-action-pipe-test
variables:
- name: "name.value"
value: "Camel"
actions:
- createVariables:
variables:
- name: "http.server.url"
value: "http://localhost:${http.server.port}"
# Create Camel JBang integration
- camel:
jbang:
run:
waitForRunningState: false
integration:
file: "filter/predicate-filter-action-pipe.yaml"
systemProperties:
properties:
- name: "http.sink.url"
value: "${http.server.url}"
- name: "filter.expression"
value: "@.name =~ /.*Camel.*/"
- name: "input"
value: |
{ \"name\": \"${name.value}\" }

# Verify Http request - message should pass through because expression matches
- http:
server: "httpServer"
receiveRequest:
POST:
path: "/result"
body:
data: |
{ "name": "${name.value}" }

- http:
server: "httpServer"
sendResponse:
response:
status: 200
reasonPhrase: "OK"
version: "HTTP/1.1"
body:
data: "Thank You!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: predicate-filter-action-pipe
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: timer-source
properties:
period: 10000
contentType: application/json
message: "{{input}}"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: predicate-filter-action
properties:
expression: "{{filter.expression}}"
sink:
uri: "{{http.sink.url}}/result"
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

name: insert-header-action-pipe-test
variables:
- name: "id"
value: "citrus:randomUUID()"
- name: "header.name"
value: "myTestHeader"
- name: "header.value"
value: "myTestValue"
actions:
- createVariables:
variables:
- name: "http.server.url"
value: "http://localhost:${http.server.port}"
# Create Camel JBang integration
- camel:
jbang:
run:
waitForRunningState: false
integration:
file: "header/insert-header-action-pipe.yaml"
systemProperties:
properties:
- name: "http.sink.url"
value: "${http.server.url}"
- name: "header.name"
value: "${header.name}"
- name: "header.value"
value: "${header.value}"
- name: "input"
value: |
{ \"id\": \"${id}\" }

# Verify Http request with the inserted header
- http:
server: "httpServer"
receiveRequest:
POST:
path: "/result"
headers:
- name: "${header.name}"
value: "${header.value}"

- http:
server: "httpServer"
sendResponse:
response:
status: 200
reasonPhrase: "OK"
version: "HTTP/1.1"
body:
data: "Thank You!"
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

apiVersion: camel.apache.org/v1
kind: Pipe
metadata:
name: insert-header-action-pipe
spec:
source:
ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: timer-source
properties:
period: 10000
message: "{{input}}"
steps:
- ref:
kind: Kamelet
apiVersion: camel.apache.org/v1
name: insert-header-action
properties:
name: "{{header.name}}"
value: "{{header.value}}"
sink:
uri: "{{http.sink.url}}/result"
Loading
Loading