forked from gt-health/GT-FHIR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGT-FHIRPostInstallTest.sh
executable file
·63 lines (54 loc) · 1.45 KB
/
GT-FHIRPostInstallTest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/bash
#This is a simple endpoint test script for GT-FHIR
#It uses wget to call out to GT-FHIR
# The first param can change the base domain. default=localhost
# The second param can change the port number. default=8080
logError ()
{
echo "WGET URL: $1"
echo "RESULT: $2"
exit 1
}
echo "Starting GT-FHIRPostInstallTest script"
BASE_DOMAIN=$1
BASE_PORT=$2
WGET_PARAMS="-q -O -"
ENDPOINTS=(/Patient /Condition /Encounter /Medication /MedicationOrder /Observation /Organization /Practitioner /Procedure)
IDS=(1 16 4 1 1 1 1 128 7)
if [ -z $1 ]
then
BASE_DOMAIN=localhost
fi
if [ -z $2 ]
then
BASE_PORT=8080
fi
BASE_URL=http://$BASE_DOMAIN:$BASE_PORT/gt-fhir-webapp/base
NUM_OF_ENDPOINTS=${#ENDPOINTS[@]}
INDEX=0
while [ $INDEX -lt $NUM_OF_ENDPOINTS ]
do
ENDPOINT=${ENDPOINTS[INDEX]}
ID=${IDS[INDEX]}
SEARCH_URL=$BASE_URL$ENDPOINT?_id=$ID
DIRECT_GET_URL=$BASE_URL$ENDPOINT/$ID
SEARCH_COMMAND="wget $SEARCH_URL $WGET_PARAMS"
echo "$SEARCH_COMMAND ......"
SEARCH_RESULT=eval $SEARCH_COMMAND
if [ $? -ne 0 ]
then
echo "Error code $? on search"
logError $SEARCH_URL $SEARCH_RESULT
fi
DIRECT_GET_COMMAND="wget $DIRECT_GET_URL $WGET_PARAMS"
echo "$DIRECT_GET_COMMAND ......"
DIRECT_GET_RESULT=eval $DIRECT_GET_COMMAND
if [ $? -ne 0 ]
then
echo "Error code $? on direct GET"
logError $DIRECT_GET_URL $DIRECT_GET_RESULT
fi
INDEX=$((INDEX+1))
done
echo "Stopping GT-FHIRPostInstallTest script"
exit 0