blob: 04a749bed7d02859326058fa7940b7a82e82c045 [file] [log] [blame]
BjornMagnussonXA663566c2021-11-08 10:25:07 +01001#!/usr/bin/env bash
2
3# ============LICENSE_START===============================================
4# Copyright (C) 2020 Nordix Foundation. All rights reserved.
5# ========================================================================
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17# ============LICENSE_END=================================================
18#
19
20TC_ONELINE_DESCR="App test DMAAP Meditor and DMAAP Adapter"
21
22#App names to include in the test when running docker, space separated list
BjornMagnussonXA007b6452021-11-29 08:03:38 +010023DOCKER_INCLUDED_IMAGES="ICS DMAAPMED DMAAPADP KUBEPROXY MR DMAAPMR CR"
BjornMagnussonXA663566c2021-11-08 10:25:07 +010024
25#App names to include in the test when running kubernetes, space separated list
BjornMagnussonXA007b6452021-11-29 08:03:38 +010026KUBE_INCLUDED_IMAGES=" ICS DMAAPMED DMAAPADP KUBEPROXY MR DMAAPMR CR"
BjornMagnussonXA663566c2021-11-08 10:25:07 +010027
28#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
29KUBE_PRESTARTED_IMAGES=""
30
31#Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if
32#the image is not configured in the supplied env_file
33#Used for images not applicable to all supported profile
34CONDITIONALLY_IGNORED_IMAGES=""
35
36#Supported test environment profiles
37SUPPORTED_PROFILES="ORAN-E-RELEASE"
38#Supported run modes
39SUPPORTED_RUNMODES="DOCKER KUBE"
40
41. ../common/testcase_common.sh $@
BjornMagnussonXA663566c2021-11-08 10:25:07 +010042
43setup_testenvironment
44
45#### TEST BEGIN ####
46
47#Local vars in test script
48##########################
49FLAT_A1_EI="1"
BjornMagnussonXA79e37002021-11-22 13:36:04 +010050NUM_CR=10 # Number of callback receivers, divide all callbacks to this number of servers - for load sharing
51## Note: The number jobs must be a multiple of the number of CRs in order to calculate the number of expected event in each CR
52NUM_JOBS=200 # Mediator and adapter gets same number of jobs for every type
53
54if [ $NUM_JOBS -lt $NUM_CR ]; then
55 __log_conf_fail_general "Number of jobs: $NUM_JOBS must be greater then the number of CRs: $NUM_CR"
56fi
BjornMagnussonXA663566c2021-11-08 10:25:07 +010057
58clean_environment
59
60#use_cr_https
61use_cr_http
BjornMagnussonXA007b6452021-11-29 08:03:38 +010062use_ics_rest_https
BjornMagnussonXA663566c2021-11-08 10:25:07 +010063use_mr_https
64use_dmaapadp_https
65use_dmaapmed_https
66
67start_kube_proxy
68
BjornMagnussonXA79e37002021-11-22 13:36:04 +010069start_cr $NUM_CR
BjornMagnussonXA663566c2021-11-08 10:25:07 +010070
BjornMagnussonXA007b6452021-11-29 08:03:38 +010071start_ics NOPROXY $SIM_GROUP/$ICS_COMPOSE_DIR/$ICS_CONFIG_FILE
BjornMagnussonXA663566c2021-11-08 10:25:07 +010072
BjornMagnussonXA007b6452021-11-29 08:03:38 +010073set_ics_trace
BjornMagnussonXA663566c2021-11-08 10:25:07 +010074
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +010075start_mr "unauthenticated.dmaapmed.json" "/events" "dmaapmediatorproducer/STD_Fault_Messages" \
76 "unauthenticated.dmaapadp.json" "/events" "dmaapadapterproducer/msgs" \
77 "unauthenticated.dmaapadp_kafka.text" "/events" "dmaapadapterproducer/msgs"
BjornMagnussonXA663566c2021-11-08 10:25:07 +010078
79start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
80
81set_dmaapadp_trace
82
83start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_DATA_FILE
84
BjornMagnussonXA007b6452021-11-29 08:03:38 +010085ics_equal json:data-producer/v1/info-producers 2 60
BjornMagnussonXA663566c2021-11-08 10:25:07 +010086
87# Check producers
BjornMagnussonXA007b6452021-11-29 08:03:38 +010088ics_api_idc_get_job_ids 200 NOTYPE NOWNER EMPTY
89ics_api_idc_get_type_ids 200 ExampleInformationType STD_Fault_Messages ExampleInformationTypeKafka
90ics_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer DMaaP_Mediator_Producer
BjornMagnussonXA663566c2021-11-08 10:25:07 +010091
92
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +010093# Create jobs for adapter - CR stores data as MD5 hash
BjornMagnussonXA663566c2021-11-08 10:25:07 +010094start_timer "Create adapter jobs: $NUM_JOBS"
95for ((i=1; i<=$NUM_JOBS; i++))
96do
BjornMagnussonXA79e37002021-11-22 13:36:04 +010097 cr_index=$(($i%$NUM_CR))
98 service_mr="CR_SERVICE_MR_PATH_"$cr_index
99 service_app="CR_SERVICE_APP_PATH_"$cr_index
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100100 ics_api_idc_put_job 201 job-adp-$i ExampleInformationType ${!service_mr}/job-adp-data$i"?storeas=md5" info-owner-adp-$i ${!service_app}/job_status_info-owner-adp-$i testdata/dmaap-adapter/job-template.json
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100101
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100102done
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100103print_timer
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100104
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100105# Create jobs for adapter kafka - CR stores data as MD5 hash
106start_timer "Create adapter (kafka) jobs: $NUM_JOBS"
107for ((i=1; i<=$NUM_JOBS; i++))
108do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100109 cr_index=$(($i%$NUM_CR))
110 service_text="CR_SERVICE_TEXT_PATH_"$cr_index
111 service_app="CR_SERVICE_APP_PATH_"$cr_index
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100112 ics_api_idc_put_job 201 job-adp-kafka-$i ExampleInformationTypeKafka ${!service_text}/job-adp-kafka-data$i"?storeas=md5" info-owner-adp-kafka-$i ${!service_app}/job_status_info-owner-adp-kafka-$i testdata/dmaap-adapter/job-template-1-kafka.json
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100113
114done
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100115print_timer
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100116
117# Create jobs for mediator - CR stores data as MD5 hash
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100118start_timer "Create mediator jobs: $NUM_JOBS"
119for ((i=1; i<=$NUM_JOBS; i++))
120do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100121 cr_index=$(($i%$NUM_CR))
122 service_mr="CR_SERVICE_MR_PATH_"$cr_index
123 service_app="CR_SERVICE_APP_PATH_"$cr_index
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100124 ics_api_idc_put_job 201 job-med-$i STD_Fault_Messages ${!service_mr}/job-med-data$i"?storeas=md5" info-owner-med-$i ${!service_app}/job_status_info-owner-med-$i testdata/dmaap-adapter/job-template.json
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100125done
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100126print_timer
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100127
128# Check job status
129for ((i=1; i<=$NUM_JOBS; i++))
130do
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100131 ics_api_a1_get_job_status 200 job-med-$i ENABLED 30
132 ics_api_a1_get_job_status 200 job-adp-$i ENABLED 30
133 ics_api_a1_get_job_status 200 job-adp-kafka-$i ENABLED 30
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100134done
135
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100136
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100137EXPECTED_DATA_DELIV=0 #Total delivered msg per CR
138DATA_DELIV_JOBS=0 #Total delivered msg per job per CR
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100139
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100140mr_api_generate_json_payload_file 1 ./tmp/data_for_dmaap_test.json
141mr_api_generate_text_payload_file 1 ./tmp/data_for_dmaap_test.txt
142
143## Send json file via message-router to adapter
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100144DATA_DELIV_JOBS=5 #Each job will eventuall get 2 msgs
145EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100146mr_api_send_json_file "/events/unauthenticated.dmaapadp.json" ./tmp/data_for_dmaap_test.json
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100147for ((i=0; i<$NUM_CR; i++))
148do
149 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
150done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100151
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100152EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100153mr_api_send_json_file "/events/unauthenticated.dmaapadp.json" ./tmp/data_for_dmaap_test.json
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100154for ((i=0; i<$NUM_CR; i++))
155do
156 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
157done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100158
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100159EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100160mr_api_send_json_file "/events/unauthenticated.dmaapadp.json" ./tmp/data_for_dmaap_test.json
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100161for ((i=0; i<$NUM_CR; i++))
162do
163 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
164done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100165
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100166EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100167mr_api_send_json_file "/events/unauthenticated.dmaapadp.json" ./tmp/data_for_dmaap_test.json
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100168for ((i=0; i<$NUM_CR; i++))
169do
170 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
171done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100172
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100173EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100174mr_api_send_json_file "/events/unauthenticated.dmaapadp.json" ./tmp/data_for_dmaap_test.json
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100175for ((i=0; i<$NUM_CR; i++))
176do
177 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
178done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100179
180# Check received data callbacks from adapter
181for ((i=1; i<=$NUM_JOBS; i++))
182do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100183 cr_index=$(($i%$NUM_CR))
184 cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-data$i ./tmp/data_for_dmaap_test.json
185 cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-data$i ./tmp/data_for_dmaap_test.json
186 cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-data$i ./tmp/data_for_dmaap_test.json
187 cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-data$i ./tmp/data_for_dmaap_test.json
188 cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-data$i ./tmp/data_for_dmaap_test.json
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100189done
190
191
192## Send text file via message-router to adapter kafka
193
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100194EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100195mr_api_send_text_file "/events/unauthenticated.dmaapadp_kafka.text" ./tmp/data_for_dmaap_test.txt
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100196for ((i=0; i<$NUM_CR; i++))
197do
198 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
199done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100200
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100201EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100202mr_api_send_text_file "/events/unauthenticated.dmaapadp_kafka.text" ./tmp/data_for_dmaap_test.txt
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100203for ((i=0; i<$NUM_CR; i++))
204do
205 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
206done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100207
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100208EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100209mr_api_send_text_file "/events/unauthenticated.dmaapadp_kafka.text" ./tmp/data_for_dmaap_test.txt
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100210for ((i=0; i<$NUM_CR; i++))
211do
212 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
213done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100214
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100215EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100216mr_api_send_text_file "/events/unauthenticated.dmaapadp_kafka.text" ./tmp/data_for_dmaap_test.txt
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100217for ((i=0; i<$NUM_CR; i++))
218do
219 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
220done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100221
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100222EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100223mr_api_send_text_file "/events/unauthenticated.dmaapadp_kafka.text" ./tmp/data_for_dmaap_test.txt
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100224for ((i=0; i<$NUM_CR; i++))
225do
226 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
227done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100228
229# Check received data callbacks from adapter kafka
230for ((i=1; i<=$NUM_JOBS; i++))
231do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100232 cr_index=$(($i%$NUM_CR))
233 cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-kafka-data$i ./tmp/data_for_dmaap_test.txt
234 cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-kafka-data$i ./tmp/data_for_dmaap_test.txt
235 cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-kafka-data$i ./tmp/data_for_dmaap_test.txt
236 cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-kafka-data$i ./tmp/data_for_dmaap_test.txt
237 cr_api_check_single_genric_event_md5_file 200 $cr_index job-adp-kafka-data$i ./tmp/data_for_dmaap_test.txt
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100238done
239
240## Send json file via message-router to mediator
241
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100242EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100243mr_api_send_json_file "/events/unauthenticated.dmaapmed.json" ./tmp/data_for_dmaap_test.json
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100244for ((i=0; i<$NUM_CR; i++))
245do
246 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
247done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100248
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100249EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100250mr_api_send_json_file "/events/unauthenticated.dmaapmed.json" ./tmp/data_for_dmaap_test.json
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100251for ((i=0; i<$NUM_CR; i++))
252do
253 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
254done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100255
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100256EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100257mr_api_send_json_file "/events/unauthenticated.dmaapmed.json" ./tmp/data_for_dmaap_test.json
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100258for ((i=0; i<$NUM_CR; i++))
259do
260 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
261done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100262
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100263EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100264mr_api_send_json_file "/events/unauthenticated.dmaapmed.json" ./tmp/data_for_dmaap_test.json
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100265for ((i=0; i<$NUM_CR; i++))
266do
267 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
268done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100269
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100270EXPECTED_DATA_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100271mr_api_send_json_file "/events/unauthenticated.dmaapmed.json" ./tmp/data_for_dmaap_test.json
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100272for ((i=0; i<$NUM_CR; i++))
273do
274 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
275done
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100276
277# Check received data callbacks from mediator
278for ((i=1; i<=$NUM_JOBS; i++))
279do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100280 cr_index=$(($i%$NUM_CR))
281 cr_api_check_single_genric_event_md5_file 200 $cr_index job-med-data$i ./tmp/data_for_dmaap_test.json
282 cr_api_check_single_genric_event_md5_file 200 $cr_index job-med-data$i ./tmp/data_for_dmaap_test.json
283 cr_api_check_single_genric_event_md5_file 200 $cr_index job-med-data$i ./tmp/data_for_dmaap_test.json
284 cr_api_check_single_genric_event_md5_file 200 $cr_index job-med-data$i ./tmp/data_for_dmaap_test.json
285 cr_api_check_single_genric_event_md5_file 200 $cr_index job-med-data$i ./tmp/data_for_dmaap_test.json
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100286done
287
288
289# Send small json via message-router to adapter
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100290mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
291mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
292
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100293DATA_DELIV_JOBS=7 #Each job will eventuall get 5+2 msgs
294
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100295# Wait for data recetption, adapter
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100296EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100297start_timer "Data delivery adapter, 2 json per job"
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100298for ((i=0; i<$NUM_CR; i++))
299do
300 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
301done
302print_timer
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100303
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100304# Send small text via message-routere to adapter
305mr_api_send_text "/events/unauthenticated.dmaapadp_kafka.text" 'Message-------1'
306mr_api_send_text "/events/unauthenticated.dmaapadp_kafka.text" 'Message-------3'
307
308# Wait for data recetption, adapter kafka
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100309EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV))
310start_timer "Data delivery adapter kafka, 2 strings per job"
311for ((i=0; i<$NUM_CR; i++))
312do
313 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 60
314done
315print_timer
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100316
317# Send small json via message-router to mediator
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100318mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}'
319mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}'
320
321# Wait for data reception, mediator
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100322EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100323start_timer "Data delivery mediator, 2 json per job"
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100324for ((i=0; i<$NUM_CR; i++))
325do
326 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 100
327done
328print_timer
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100329
330# Check received number of messages for mediator and adapter callbacks
331for ((i=1; i<=$NUM_JOBS; i++))
332do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100333 cr_index=$(($i%$NUM_CR))
334 cr_equal $cr_index received_callbacks?id=job-med-data$i $DATA_DELIV_JOBS
335 cr_equal $cr_index received_callbacks?id=job-adp-data$i $DATA_DELIV_JOBS
336 cr_equal $cr_index received_callbacks?id=job-adp-kafka-data$i $DATA_DELIV_JOBS
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100337done
338
339# Check received data and order for mediator and adapter callbacks
340for ((i=1; i<=$NUM_JOBS; i++))
341do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100342 cr_index=$(($i%$NUM_CR))
343 cr_api_check_single_genric_event_md5 200 $cr_index job-med-data$i '{"msg":"msg-0"}'
344 cr_api_check_single_genric_event_md5 200 $cr_index job-med-data$i '{"msg":"msg-2"}'
345 cr_api_check_single_genric_event_md5 200 $cr_index job-adp-data$i '{"msg":"msg-1"}'
346 cr_api_check_single_genric_event_md5 200 $cr_index job-adp-data$i '{"msg":"msg-3"}'
347 cr_api_check_single_genric_event_md5 200 $cr_index job-adp-kafka-data$i 'Message-------1'
348 cr_api_check_single_genric_event_md5 200 $cr_index job-adp-kafka-data$i 'Message-------3'
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100349done
350
351# Set delay in the callback receiver to slow down callbacks
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100352SEC_DELAY=2
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100353for ((i=0; i<$NUM_CR; i++))
354do
355 cr_delay_callback 200 $i $SEC_DELAY
356done
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100357
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100358# Send small json via message-router to adapter
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100359mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-5"}'
360mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-7"}'
361
362# Wait for data recetption, adapter
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100363EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100364start_timer "Data delivery adapter with $SEC_DELAY seconds delay in consumer, 2 json per job"
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100365for ((i=0; i<$NUM_CR; i++))
366do
367 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 100
368done
369print_timer
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100370
371
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100372# Send small text via message-router to adapter kafka
373mr_api_send_text "/events/unauthenticated.dmaapadp_kafka.text" 'Message-------5'
374mr_api_send_text "/events/unauthenticated.dmaapadp_kafka.text" 'Message-------7'
375
376# Wait for data recetption, adapter kafka
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100377EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100378start_timer "Data delivery adapter kafka with $SEC_DELAY seconds delay in consumer, 2 strings per job"
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100379for ((i=0; i<$NUM_CR; i++))
380do
381 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 100
382done
383print_timer
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100384
385
386# Send small json via message-router to mediator
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100387mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-4"}'
388mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-6"}'
389
390# Wait for data reception, mediator
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100391EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV))
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100392start_timer "Data delivery mediator with $SEC_DELAY seconds delay in consumer, 2 json per job"
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100393for ((i=0; i<$NUM_CR; i++))
394do
395 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV 100
396done
397print_timer
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100398
399# Check received number of messages for mediator and adapter callbacks
400for ((i=1; i<=$NUM_JOBS; i++))
401do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100402 cr_index=$(($i%$NUM_CR))
403 cr_equal $cr_index received_callbacks?id=job-med-data$i 9
404 cr_equal $cr_index received_callbacks?id=job-adp-data$i 9
405 cr_equal $cr_index received_callbacks?id=job-adp-kafka-data$i 9
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100406done
407
408# Check received data and order for mediator and adapter callbacks
409for ((i=1; i<=$NUM_JOBS; i++))
410do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100411 cr_index=$(($i%$NUM_CR))
412 cr_api_check_single_genric_event_md5 200 $cr_index job-med-data$i '{"msg":"msg-4"}'
413 cr_api_check_single_genric_event_md5 200 $cr_index job-med-data$i '{"msg":"msg-6"}'
414 cr_api_check_single_genric_event_md5 200 $cr_index job-adp-data$i '{"msg":"msg-5"}'
415 cr_api_check_single_genric_event_md5 200 $cr_index job-adp-data$i '{"msg":"msg-7"}'
416 cr_api_check_single_genric_event_md5 200 $cr_index job-adp-kafka-data$i 'Message-------5'
417 cr_api_check_single_genric_event_md5 200 $cr_index job-adp-kafka-data$i 'Message-------7'
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100418done
419
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100420#### TEST COMPLETE ####
421
422store_logs END
423
424print_result
425
BjornMagnussonXA6fc58fd2021-11-18 08:19:45 +0100426auto_clean_environment