ecaiyanlinux | 586432b | 2021-10-25 15:24:37 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # ============LICENSE_START=============================================== |
| 4 | # Copyright (C) 2021 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 |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 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================================================= |
| 18 | # |
| 19 | |
| 20 | # The scripts in data/ will generate some dummy data in the running system. |
| 21 | # It will send a dmaap msg of job to mediator: |
| 22 | |
| 23 | # Run command: |
| 24 | # ./sendMsgToMediator.sh [dmaap-mr port] [http/https] |
| 25 | |
| 26 | SHELL_FOLDER=$(cd "$(dirname "$0")";pwd) |
| 27 | bash ${SHELL_FOLDER}/prepareEcsData.sh |
| 28 | |
| 29 | dmaa_mr_port=${1:-3904} |
| 30 | httpx=${2:-"http"} |
| 31 | |
| 32 | echo "using dmaap-mr port: "$dmaa_mr_port |
| 33 | echo "using protocol: "$httpx |
| 34 | echo -e "\n" |
| 35 | |
| 36 | echo "dmaap-mr topics:" |
| 37 | curl -skw %{http_code} $httpx://localhost:$dmaa_mr_port/topics/listAll |
| 38 | echo -e "\n" |
| 39 | |
| 40 | echo "dmaap-mr create topic unauthenticated.VES_NOTIFICATION_OUTPUT:" |
| 41 | curl -skw %{http_code} -X POST "$httpx://localhost:$dmaa_mr_port/topics/create" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"topicName\": \"unauthenticated.VES_NOTIFICATION_OUTPUT\", \"topicDescription\": \"test topic\", \"partitionCount\": 1, \"replicationCount\": 1, \"transactionEnabled\": \"false\"}" |
| 42 | echo -e "\n" |
| 43 | |
| 44 | echo "dmaap-mr topics:" |
| 45 | curl -skw %{http_code} $httpx://localhost:$dmaa_mr_port/topics/listAll |
| 46 | echo -e "\n" |
| 47 | |
| 48 | echo "send job msg to dmaap-mr:" |
| 49 | curl -k -X POST -sw %{http_code} -H accept:application/json -H Content-Type:application/json "$httpx://localhost:$dmaa_mr_port/events/unauthenticated.VES_NOTIFICATION_OUTPUT/" --data-binary @${SHELL_FOLDER}/testdata/dmaap-mediator-java/job.json |
| 50 | echo -e "\n" |