2 # lji: this is basically what Dom has in his regtest. re-do it in bash instead of ksh
4 HOSTPORT="127.0.0.1:3904"
5 ANONTOPIC="anon-topic-$RANDOM"
6 APITOPIC="api-topic-$RANDOM"
9 echo "blah" > /tmp/sample.txt
11 if [ ! -e /usr/bin/jq ]; then
12 apt-get update && apt-get -y install jq
17 curl http://${HOSTPORT}/topics
19 # publish to an anonymous topic (first publish creats the topic)
20 curl -H "Content-Type:text/plain" -X POST -d @/tmp/sample.txt http://${HOSTPORT}/events/$ANONTOPIC
22 # subscribe to an anonymous topic
23 curl -H "Content-Type:text/plain" -X GET http://${HOSTPORT}/events/$ANONTOPIC/group1/C1?timeout=5000 &
24 curl -H "Content-Type:text/plain" -X POST -d @/tmp/sample.txt http://${HOSTPORT}/events/$ANONTOPIC
30 echo '{"email":"no email","description":"API key and secret both in reponse"}' > /tmp/input.txt
31 curl -s -o ${APIKEYFILE} -H "Content-Type:application/json" -X POST -d @/tmp/input.txt http://${HOSTPORT}/apiKeys/create
32 UEBAPIKEYSECRET=`cat ${APIKEYFILE} |jq -r ".secret"`
33 UEBAPIKEYKEY=`cat ${APIKEYFILE} |jq -r ".key"`
35 # create an api key secured topic
36 # pay attendtion to replication count
37 echo '{"topicName":"'${APITOPIC}'","topicDescription":"This is an API key securedTopic","partitionCount":"1","replicationCount":"1","transactionEnabled":"true"}' > /tmp/topicname.txt
38 time=`date --iso-8601=seconds`
39 signature=$(echo -n "$time" | openssl sha1 -hmac $UEBAPIKEYSECRET -binary | openssl base64)
40 xAuth=$UEBAPIKEYKEY:$signature
42 curl -i -H "Content-Type: application/json" -H "X-CambriaAuth:$xAuth" -H "X-CambriaDate:$xDate" -X POST -d @/tmp/topicname.txt http://${HOSTPORT}/topics/create
44 # first subscribe and run it in bg. then publish.
45 time=`date --iso-8601=seconds`
46 signature=$(echo -n "$time" | openssl sha1 -hmac $UEBAPIKEYSECRET -binary | openssl base64)
47 xAuth=$UEBAPIKEYKEY:$signature
49 curl -H "X-CambriaAuth:$xAuth" -H "X-CambriaDate:$xDate" -X GET http://${HOSTPORT}/events/${APITOPIC}/g0/u1 &
50 curl -H "Content-Type:text/plain" -H "X-CambriaAuth:$xAuth" -H "X-CambriaDate:$xDate" -X POST -d @/tmp/sample.txt http://${HOSTPORT}/events/${APITOPIC}