This is an automated email from the ASF dual-hosted git repository.

smihaylov pushed a commit to branch readme
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-dta.git

commit eba53638583e8f694238802336e1ef67b470595c
Author: Stanislav Mihaylov <[email protected]>
AuthorDate: Wed Sep 4 12:32:55 2019 +0300

    Pass the API URL as command line param of e2e_test.sh
---
 cmd/servicetester/e2e_test.sh | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/cmd/servicetester/e2e_test.sh b/cmd/servicetester/e2e_test.sh
index 1b3588c..b6b1d1e 100755
--- a/cmd/servicetester/e2e_test.sh
+++ b/cmd/servicetester/e2e_test.sh
@@ -2,10 +2,12 @@
 #End to End Test of Services using curl/bash
 
 apiVersion="v1"
+defaultURL="http://localhost:5556";
+apiURL="${1:-$defaultURL}"
 
 status () {
   #Determine if an extension is running
-  statusOutput=$(curl -s -X GET "http://localhost:5556/$apiVersion/status"; -H 
"accept: */*" -H "Content-Type: application/json")
+  statusOutput=$(curl -s -X GET "$apiURL/$apiVersion/status" -H "accept: */*" 
-H "Content-Type: application/json")
   identity=$(echo $statusOutput | jq .nodeCID)
   extensionVendor=$(echo $statusOutput | jq -r .extensionVendor)
   plugin=$(echo $statusOutput | jq -r .plugin)
@@ -22,12 +24,12 @@ status () {
 execute_bitcoin () {
   #Run 2 Tests against the Bitcoin Extension
   echo "Bitcoin Plugin Tests [2 Tests]"
-  output1=$(curl -s -X POST "http://localhost:5556/$apiVersion/order"; -H 
"accept: */*" -H "Content-Type: application/json" -d 
"{\"beneficiaryIDDocumentCID\":\"\",\"extension\":{\"coin\":\"0\"}}")
+  output1=$(curl -s -X POST "$apiURL/$apiVersion/order" -H "accept: */*" -H 
"Content-Type: application/json" -d 
"{\"beneficiaryIDDocumentCID\":\"\",\"extension\":{\"coin\":\"0\"}}")
   echo $output1
   op1=$(echo $output1 | jq .orderReference)
   commitment1=$(echo $output1 | jq .commitment)
   address1=$(echo $output1 | jq .extension.address)
-  output2=$(curl -s -X POST "http://localhost:5556/$apiVersion/order/secret"; 
-H "accept: */*" -H "Content-Type: application/json" -d 
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity}")
+  output2=$(curl -s -X POST "$apiURL/$apiVersion/order/secret" -H "accept: 
*/*" -H "Content-Type: application/json" -d 
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity}")
   address2=$(echo $output2 | jq .extension.address)
   commitment2=$(echo $output2 | jq .commitment)
 
@@ -46,12 +48,12 @@ execute_bitcoin () {
     exit 1
   fi
 
-  output3=$(curl -s -X POST "http://localhost:5556/$apiVersion/order"; -H 
"accept: */*" -H "Content-Type: application/json" -d 
"{\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"coin\":\"0\"}}")
+  output3=$(curl -s -X POST "$apiURL/$apiVersion/order" -H "accept: */*" -H 
"Content-Type: application/json" -d 
"{\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"coin\":\"0\"}}")
 
   op3=$(echo $output3 | jq .orderReference)
   commitment3=$(echo $output3 | jq .commitment)
   address3=$(echo $output3 | jq .extension.address)
-  output4=$(curl -s -X POST "http://localhost:5556/$apiVersion/order/secret"; 
-H "accept: */*" -H "Content-Type: application/json" -d 
"{\"orderReference\":$op3}")
+  output4=$(curl -s -X POST "$apiURL/$apiVersion/order/secret" -H "accept: 
*/*" -H "Content-Type: application/json" -d "{\"orderReference\":$op3}")
   commitment4=$(echo $output4 | jq .commitment)
   address4=$(echo $output4 | jq .extension.address)
   orderReference=$(echo $output4 | jq .orderReference)
@@ -80,14 +82,14 @@ execute_safeguardsecret () {
   inputString="This is some random test text 1234567890!"
   echo "Encrypt a String [1 Test]"
   echo $output1
-  output1=$(curl -s -X POST "http://localhost:5556/$apiVersion/order"; -H 
"accept: */*" -H "Content-Type: application/json" -d 
"{\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"plainText\":\"$inputString\"}}")
+  output1=$(curl -s -X POST "$apiURL/$apiVersion/order" -H "accept: */*" -H 
"Content-Type: application/json" -d 
"{\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"plainText\":\"$inputString\"}}")
   echo $output1
   op1=$(echo $output1 | jq .orderReference)
   cipherText=$(echo $output1 | jq .extension.cypherText)
   tvalue=$(echo $output1 | jq .extension.t)
   vvalue=$(echo $output1 | jq .extension.v)
   commitment1=$(echo $output1 | jq .commitment)
-  output2=$(curl -s -X POST "http://localhost:5556/$apiVersion/order/secret"; 
-H "accept: */*" -H "Content-Type: application/json" -d 
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"cypherText\":$cipherText,\"t\":$tvalue,\"v\":$vvalue}}")
+  output2=$(curl -s -X POST "$apiURL/$apiVersion/order/secret" -H "accept: 
*/*" -H "Content-Type: application/json" -d 
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity,\"extension\":{\"cypherText\":$cipherText,\"t\":$tvalue,\"v\":$vvalue}}")
   result=$(echo $output2 | jq -r .extension.plainText)
 
   orderReference=$(echo $output2 | jq .orderReference)
@@ -107,13 +109,13 @@ execute_safeguardsecret () {
 
 execute_milagro () {
   echo "Milagro Tests [1 Test]"
-  output1=$(curl -s -X POST "http://localhost:5556/$apiVersion/order"; -H 
"accept: */*" -H "Content-Type: application/json" -d 
"{\"beneficiaryIDDocumentCID\":$identity}")
+  output1=$(curl -s -X POST "$apiURL/$apiVersion/order" -H "accept: */*" -H 
"Content-Type: application/json" -d "{\"beneficiaryIDDocumentCID\":$identity}")
   echo $output1  
   op1=$(echo $output1 | jq .orderReference)
 
 
   commitment1=$(echo $output1 | jq .commitment)
-  output2=$(curl -s -X POST "http://localhost:5556/$apiVersion/order/secret"; 
-H "accept: */*" -H "Content-Type: application/json" -d 
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity}")
+  output2=$(curl -s -X POST "$apiURL/$apiVersion/order/secret" -H "accept: 
*/*" -H "Content-Type: application/json" -d 
"{\"orderReference\":$op1,\"beneficiaryIDDocumentCID\":$identity}")
   commitment2=$(echo $output2 | jq .commitment)
 
   orderReference=$(echo $output2 | jq .orderReference)
@@ -146,9 +148,9 @@ execute_milagro () {
 execute_orderlist () {
   echo "Milagro Tests [1 Test]"
   commitment2=$(echo $output2 | jq .commitment)
-  outputList=$(curl -s -X GET 
"http://localhost:5556/$apiVersion/order?page=0&perPage=2&sortBy=dateCreatedDsc";
 -H "accept: */*")
+  outputList=$(curl -s -X GET 
"$apiURL/$apiVersion/order?page=0&perPage=2&sortBy=dateCreatedDsc" -H "accept: 
*/*")
   orderReference=$(echo $outputList | jq -r ".orderReference | .[$orderIndex]")
-  outputOrder=$(curl -s -X GET 
"http://localhost:5556/$apiVersion/order/$orderReference"; -H "accept: */*")
+  outputOrder=$(curl -s -X GET "$apiURL/$apiVersion/order/$orderReference" -H 
"accept: */*")
 
   #A simple smoke test to ensure some sort of order is returned
   hasSecret=`echo $outputOrder | grep "Secret"`

Reply via email to