+ecs_api_edp_get_producer() {
+ __log_test_start $@
+
+ #Possible arg count: 2, 5 6, 8, 10 etc
+ paramError=1
+ if [ $# -eq 2 ]; then
+ paramError=0
+ fi
+ if [ $# -eq 5 ] && [ "$5" == "EMPTY" ]; then
+ paramError=0
+ fi
+ variablecount=$(($#-4))
+ if [ $# -gt 5 ] && [ $(($variablecount%2)) -eq 0 ]; then
+ paramError=0
+ fi
+
+ if [ $paramError -ne 0 ]; then
+ __print_err "<response-code> <producer-id> [<job-callback> <supervision-callback> (NOID | [<type-id> <schema-file>]+) ]" $@
+ return 1
+ fi
+
+ query="/ei-producer/v1/eiproducers/$2"
+ res="$(__do_curl_to_api ECS GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ if [ $# -gt 2 ]; then
+ body=${res:0:${#res}-3}
+ targetJson="["
+ if [ $# -gt 5 ]; then
+ arr=(${@:5})
+ for ((i=0; i<$(($#-5)); i=i+2)); do
+ if [ "$targetJson" != "[" ]; then
+ targetJson=$targetJson","
+ fi
+ if [ -f ${arr[$i+1]} ]; then
+ schema=$(cat ${arr[$i+1]})
+ else
+ __log_test_fail_general "Schema file "${arr[$i+1]}", does not exist"
+ return 1
+ fi
+
+ targetJson=$targetJson"{\"ei_type_identity\":\"${arr[$i]}\",\"ei_job_data_schema\":$schema}"
+ done
+ fi
+ targetJson=$targetJson"]"
+ if [ $# -gt 4 ]; then
+ targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}"
+ fi
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
+ fi
+ fi
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
+# args (v1_2): <response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]
+# (Function for test scripts)
+ecs_api_edp_get_producer_2() {
+ __log_test_start $@
+
+ #Possible arg count: 2, 5, 6, 7, 8 etc
+ paramError=1
+ if [ $# -eq 2 ]; then
+ paramError=0
+ fi
+ if [ $# -eq 5 ] && [ "$5" == "EMPTY" ]; then
+ paramError=0
+ fi
+ if [ $# -ge 5 ]; then
+ paramError=0
+ fi
+
+ if [ $paramError -ne 0 ]; then
+ __print_err "<response-code> <producer-id> [<job-callback> <supervision-callback> (EMPTY | <type-id>+) ]" $@
+ return 1
+ fi
+
+ query="/ei-producer/v1/eiproducers/$2"
+ res="$(__do_curl_to_api ECS GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ if [ $# -gt 2 ]; then
+ body=${res:0:${#res}-3}
+ targetJson="["
+ if [ $# -gt 4 ] && [ "$5" != "EMPTY" ]; then
+ arr=(${@:5})
+ for ((i=0; i<$(($#-4)); i=i+1)); do
+ if [ "$targetJson" != "[" ]; then
+ targetJson=$targetJson","
+ fi
+ targetJson=$targetJson"\"${arr[$i]}\""
+ done
+ fi
+ targetJson=$targetJson"]"
+ if [ $# -gt 4 ]; then
+ targetJson="{\"supported_ei_types\":$targetJson,\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\"}"
+ fi
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
+ fi
+ fi
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: DELETE /ei-producer/v1/eiproducers/{eiProducerId}
+# args: <response-code> <producer-id>
+# (Function for test scripts)
+ecs_api_edp_delete_producer() {
+ __log_test_start $@
+
+ if [ $# -lt 2 ]; then
+ __print_err "<response-code> <producer-id>" $@
+ return 1
+ fi
+
+ query="/ei-producer/v1/eiproducers/$2"
+ res="$(__do_curl_to_api ECS DELETE $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
+# args: (v1_1) <response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+
+# (Function for test scripts)
+ecs_api_edp_put_producer() {
+ __log_test_start $@
+
+ #Valid number of parametrer 5,6,8,10,
+ paramError=1
+ if [ $# -eq 5 ] && [ "$5" == "NOTYPE" ]; then
+ paramError=0
+ elif [ $# -gt 5 ] && [ $(($#%2)) -eq 0 ]; then
+ paramError=0
+ fi
+ if [ $paramError -ne 0 ]; then
+ __print_err "<response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id> <schema-file>]+" $@
+ return 1
+ fi
+
+ inputJson="["
+ if [ $# -gt 5 ]; then
+ arr=(${@:5})
+ for ((i=0; i<$(($#-5)); i=i+2)); do
+ if [ "$inputJson" != "[" ]; then
+ inputJson=$inputJson","
+ fi
+ if [ -f ${arr[$i+1]} ]; then
+ schema=$(cat ${arr[$i+1]})
+ else
+ __log_test_fail_general "Schema file "${arr[$i+1]}", does not exist"
+ return 1
+ fi
+ inputJson=$inputJson"{\"ei_type_identity\":\"${arr[$i]}\",\"ei_job_data_schema\":$schema}"
+ done
+ fi
+ inputJson="\"supported_ei_types\":"$inputJson"]"
+
+ inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\""
+
+ inputJson="{"$inputJson"}"
+
+ file="./tmp/.p.json"
+ echo "$inputJson" > $file
+ query="/ei-producer/v1/eiproducers/$2"
+ res="$(__do_curl_to_api ECS PUT $query $file)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
+# args: (v1_2) <response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id>+]
+# (Function for test scripts)
+ecs_api_edp_put_producer_2() {
+ __log_test_start $@
+
+ #Valid number of parametrer 5,6,8,10,
+ paramError=1
+ if [ $# -eq 5 ] && [ "$5" == "NOTYPE" ]; then
+ paramError=0
+ elif [ $# -ge 5 ]; then
+ paramError=0
+ fi
+ if [ $paramError -ne 0 ]; then
+ __print_err "<response-code> <producer-id> <job-callback> <supervision-callback> NOTYPE|[<type-id>+]" $@
+ return 1
+ fi
+
+ inputJson="["
+ if [ $# -gt 4 ] && [ "$5" != "NOTYPE" ]; then
+ arr=(${@:5})
+ for ((i=0; i<$(($#-4)); i=i+1)); do
+ if [ "$inputJson" != "[" ]; then
+ inputJson=$inputJson","
+ fi
+ inputJson=$inputJson"\""${arr[$i]}"\""
+ done
+ fi
+ inputJson="\"supported_ei_types\":"$inputJson"]"
+
+ inputJson=$inputJson",\"ei_job_callback_url\": \"$3\",\"ei_producer_supervision_callback_url\": \"$4\""
+
+ inputJson="{"$inputJson"}"
+
+ file="./tmp/.p.json"
+ echo "$inputJson" > $file
+ query="/ei-producer/v1/eiproducers/$2"
+ res="$(__do_curl_to_api ECS PUT $query $file)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs
+# args: (V1-1) <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)
+# (Function for test scripts)
+ecs_api_edp_get_producer_jobs() {
+ __log_test_start $@
+
+ #Valid number of parameter 2,3,7,11
+ paramError=1
+ if [ $# -eq 2 ]; then
+ paramError=0
+ fi
+ if [ $# -eq 3 ] && [ "$3" == "EMPTY" ]; then
+ paramError=0
+ fi
+ variablecount=$(($#-2))
+ if [ $# -gt 3 ] && [ $(($variablecount%5)) -eq 0 ]; then
+ paramError=0
+ fi
+ if [ $paramError -eq 1 ]; then
+ __print_err "<response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)" $@
+ return 1
+ fi
+
+ query="/ei-producer/v1/eiproducers/$2/eijobs"
+ res="$(__do_curl_to_api ECS GET $query)"
+ status=${res:${#res}-3}
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+ if [ $# -gt 2 ]; then
+ body=${res:0:${#res}-3}
+ targetJson="["
+ if [ $# -gt 3 ]; then
+ arr=(${@:3})
+ for ((i=0; i<$(($#-3)); i=i+5)); do
+ if [ "$targetJson" != "[" ]; then
+ targetJson=$targetJson","
+ fi
+ if [ -f ${arr[$i+4]} ]; then
+ jobfile=$(cat ${arr[$i+4]})
+ jobfile=$(echo "$jobfile" | sed "s/XXXX/${arr[$i]}/g")
+ else
+ __log_test_fail_general "Job template file "${arr[$i+4]}", does not exist"
+ return 1
+ fi
+ targetJson=$targetJson"{\"ei_job_identity\":\"${arr[$i]}\",\"ei_type_identity\":\"${arr[$i+1]}\",\"target_uri\":\"${arr[$i+2]}\",\"owner\":\"${arr[$i+3]}\",\"ei_job_data\":$jobfile}"
+ done
+ fi
+ targetJson=$targetJson"]"
+
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
+ fi
+ fi
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs
+# args: (V1-2) <response-code> <producer-id> (EMPTY | [<job-id> <type-id> <target-url> <job-owner> <template-job-file>]+)
+# (Function for test scripts)
+ecs_api_edp_get_producer_jobs_2() {