-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurlCommandsStreamingAsync.sh
More file actions
executable file
·110 lines (92 loc) · 4.5 KB
/
curlCommandsStreamingAsync.sh
File metadata and controls
executable file
·110 lines (92 loc) · 4.5 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
# A script to invoke some sample curl commands on a Linux/Mac machine
# against a running container image of the app-specific Gilhari microservice
# gilhari_streaming_example:1.0.
#
# The responses are recorded in a log file (curl.log).
#
# These curl commands invoke the REST APIs in the default (async) mode.
#
# Note that these curl commands use a default mapped port number of 80
# even though the port number exposed by the app-specific
# microservice may be different (e.g., 8081) inside the container shell.
#
# You may optionally specify a non-default port number as the first
# command line argument to this script. For example, to specify a
# port number of 8899, use the following command:
# curlCommands 8899
# Check if a port is provided as an argument, if not, use default port 80
# Check if a port is provided as an argument, if not, use default port 80
if [ -z "$1" ]; then
port=80
else
port=$1
fi
# Log file where output will be saved
log_file="curl.log"
# Start logging
echo "** BEGIN OUTPUT **" > "$log_file"
echo "" >> "$log_file"
# Log port information
echo "Using PORT number $port" >> "$log_file"
echo "" >> "$log_file"
# ** Query all Employee objects
echo "** Query all Employee objects" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# ** Start a streaming query for all Employee objects, get first two
echo "** Start a streaming query for all Employee objects, get first two" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee/startStream?maxObjects=2" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# ** Fetch 3 more Employee objects from the stream
echo "** Fetch 3 more Employee objects from the stream" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee/fetchMore?maxObjects=3" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# ** Fetch the remaining Employee objects from the stream
echo "** Fetch the remaining Employee objects from the stream" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee/fetchMore?maxObjects=-1" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# ** Close the streaming query for the Employee objects
echo "** Close the streaming query for the Employee objects" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee/closeStream" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# ** Close again the streaming query for the Employee objects
echo "** Close again the streaming query for the Employee objects" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee/closeStream" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# ** Close once again the streaming query for the Employee objects
echo "** Close once again the streaming query for the Employee objects" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee/closeStream" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# ** Fetch 3 more Employee objects from the stream
echo "** Fetch 3 more Employee objects from the stream" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee/fetchMore?maxObjects=3" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# ** Fetch 3 more Employee objects from the stream
echo "** Fetch 3 more Employee objects from the stream" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee/fetchMore?maxObjects=3" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# ** Query non-exempted Employee objects
echo "** Query non-exempted Employee objects" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee?filter=exempt=0" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# ** Query the count of all Employee objects
echo "** Query the count of all Employee objects" >> "$log_file"
curl -X GET "http://localhost:$port/gilhari/v1/Employee/getAggregate?attribute=id&aggregateType=COUNT" -H "Content-Type: application/json" >> "$log_file"
echo "" >> "$log_file"
echo "" >> "$log_file"
# End logging
echo "** END OUTPUT **" >> "$log_file"
echo "" >> "$log_file"
# Display the log content
cat "$log_file"