Fix for radio buttons
[sdc.git] / asdc-tests / src / test / resources / CI / importResource-MMSC / deleteNormative.sh
1 #!/bin/bash
2
3 function usage {
4         echo "Usage: $0 <hostIp> <hostPort> <resourceName>"
5 }
6
7 function deleteResource() {
8
9         ELEMENT_NAME=$1
10         echo -e "############### Removing Element ${ELEMENT_NAME} Start ######################"
11         http_code=$(curl -s -o /dev/null -w "%{http_code}" -X "DELETE" -H "USER_ID: jh0003" ${HOST_IP}:${HOST_PORT}/sdc2/rest/v1/catalog/resources/res_${ELEMENT_NAME}".1.0")
12         if [ ${http_code} -eq 204  ]; then
13                 echo -e "\n############### Removing Element ${ELEMENT_NAME} status code:${http_code} End #######\n\n\n"
14         elif [ ${http_code} -eq 500 ]; then
15                 echo -e "\n############### Failed to remove Element ${ELEMENT_NAME} status code:${http_code} End #######\n\n\n"
16                 exit 1
17         elif [ ${http_code} -eq 404 ]; then
18                 echo -e "\n############### Element ${ELEMENT_NAME} not found status code:${http_code} End #######\n\n\n"
19         else
20                 echo -e "\n############### Failed to remove Element ${ELEMENT_NAME} status code:${http_code} End #######\n\n\n"
21                 exit 1
22         fi
23 }
24 if [ $# -lt 3 ]
25 then
26         usage
27         exit 2
28 fi
29
30 HOST_IP=$1
31 HOST_PORT=$2
32
33 deleteResource $3 
34
35 exit 0