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
10 # http://www.apache.org/licenses/LICENSE-2.0
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=================================================
20 # Automated test script for callback receiver container
22 # callbackreciver port
25 # source function to do curl and check result
26 . ../common/do_curl_function.sh
28 echo "=== CR hello world ==="
33 echo "=== Get counter - callbacks ==="
35 do_curl GET /counter/received_callbacks 200
37 echo "=== Get counter - fetched events ==="
39 do_curl GET /counter/fetched_callbacks 200
41 echo "=== Get counter - current events ==="
43 do_curl GET /counter/current_messages 200
46 echo "=== Send a request ==="
49 echo "\"DATA-MSG\"" > .tmp.json
50 do_curl POST '/callbacks/test' 200 .tmp.json
53 echo "=== Fetch an event, wrong id==="
55 do_curl GET '/get-event/wrongid' 204
58 echo "=== Get counter - callbacks ==="
60 do_curl GET /counter/received_callbacks 200
62 echo "=== Get counter - fetched events ==="
64 do_curl GET /counter/fetched_callbacks 200
66 echo "=== Get counter - current events ==="
68 do_curl GET /counter/current_messages 200
71 echo "=== Fetch an event ==="
73 do_curl GET '/get-event/test' 200
75 echo "=== Fetch an event again ==="
77 do_curl GET '/get-event/test' 204
79 echo "=== Get counter - callbacks ==="
81 do_curl GET /counter/received_callbacks 200
83 echo "=== Get counter - fetched events ==="
85 do_curl GET /counter/fetched_callbacks 200
87 echo "=== Get counter - current events ==="
89 do_curl GET /counter/current_messages 200
91 echo "=== CR reset ==="
93 do_curl GET /reset 200
95 echo "=== Get counter - callbacks ==="
97 do_curl GET /counter/received_callbacks 200
99 echo "=== Get counter - fetched events ==="
101 do_curl GET /counter/fetched_callbacks 200
103 echo "=== Get counter - current events ==="
105 do_curl GET /counter/current_messages 200
108 echo "********************"
109 echo "*** All tests ok ***"
110 echo "********************"