blob: a2f3db31b9281de739907612b7c4834716ccc4ad [file] [log] [blame]
ecaiyanlinux586432b2021-10-25 15:24:37 +02001#!/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
26SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
27bash ${SHELL_FOLDER}/prepareEcsData.sh
28
29dmaa_mr_port=${1:-3904}
30httpx=${2:-"http"}
31
32echo "using dmaap-mr port: "$dmaa_mr_port
33echo "using protocol: "$httpx
34echo -e "\n"
35
36echo "dmaap-mr topics:"
37curl -skw %{http_code} $httpx://localhost:$dmaa_mr_port/topics/listAll
38echo -e "\n"
39
40echo "dmaap-mr create topic unauthenticated.VES_NOTIFICATION_OUTPUT:"
41curl -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\"}"
42echo -e "\n"
43
44echo "dmaap-mr topics:"
45curl -skw %{http_code} $httpx://localhost:$dmaa_mr_port/topics/listAll
46echo -e "\n"
47
48echo "send job msg to dmaap-mr:"
49curl -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
50echo -e "\n"