diff options
Diffstat (limited to 'cds-regression-test/test/lock-device/success')
9 files changed, 236 insertions, 0 deletions
diff --git a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-1.json b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-1.json new file mode 100644 index 0000000..b70b502 --- /dev/null +++ b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-1.json @@ -0,0 +1,28 @@ +{ + "correlationUUID": null, + "commonHeader": { + "timestamp": "2020-06-30T17:46:47.772Z", + "originatorId": "System", + "requestId": "lock-request-1", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-06-30T17:47:02.922Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "resolve-deploy-kotlin-response": { + "response-data": "Success: lock-request-1" + } + } +} diff --git a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-2.json b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-2.json new file mode 100644 index 0000000..bd0dfdc --- /dev/null +++ b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-2.json @@ -0,0 +1,28 @@ +{ + "correlationUUID": null, + "commonHeader": { + "timestamp": "2020-06-30T17:46:50.008Z", + "originatorId": "System", + "requestId": "lock-request-2", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin", + "mode": "sync" + }, + "status": { + "code": 200, + "eventType": "EVENT_COMPONENT_EXECUTED", + "timestamp": "2020-06-30T17:47:18.221Z", + "errorMessage": null, + "message": "success" + }, + "payload": { + "resolve-deploy-kotlin-response": { + "response-data": "Success: lock-request-2" + } + } +} diff --git a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-3.json b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-3.json new file mode 100644 index 0000000..9743758 --- /dev/null +++ b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-3.json @@ -0,0 +1,26 @@ +{ + "correlationUUID": null, + "commonHeader": { + "timestamp": "2020-06-30T17:46:51.761Z", + "originatorId": "System", + "requestId": "lock-request-3", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-06-30T17:47:12.301Z", + "errorMessage": "Failed in ComponentScriptExecutor : Failed to acquire lock within timeout, failed to get execution property(node_templates/execute-kotlin/attributes/response-data)", + "message": "failure" + }, + "payload": { + "resolve-deploy-kotlin-response": {} + } +} diff --git a/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-4.json b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-4.json new file mode 100644 index 0000000..3b916ed --- /dev/null +++ b/cds-regression-test/test/lock-device/success/expected-payloads/expected-payload-4.json @@ -0,0 +1,26 @@ +{ + "correlationUUID": null, + "commonHeader": { + "timestamp": "2020-06-30T17:46:54.081Z", + "originatorId": "System", + "requestId": "lock-request-4", + "subRequestId": "1", + "flags": null + }, + "actionIdentifiers": { + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin", + "mode": "sync" + }, + "status": { + "code": 500, + "eventType": "EVENT_COMPONENT_FAILURE", + "timestamp": "2020-06-30T17:47:14.865Z", + "errorMessage": "Failed in ComponentScriptExecutor : Failed to acquire lock within timeout, failed to get execution property(node_templates/execute-kotlin/attributes/response-data)", + "message": "failure" + }, + "payload": { + "resolve-deploy-kotlin-response": {} + } +} diff --git a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-1.json b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-1.json new file mode 100644 index 0000000..20be12a --- /dev/null +++ b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-1.json @@ -0,0 +1,20 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin" + }, + "payload": { + "resolve-deploy-kotlin-request": { + "resolve-deploy-kotlin-properties": { + "lock-acquire-timeout": 5 + } + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "lock-request-1", + "originatorId": "System" + } +} diff --git a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-2.json b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-2.json new file mode 100644 index 0000000..3fdc8d2 --- /dev/null +++ b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-2.json @@ -0,0 +1,20 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin" + }, + "payload": { + "resolve-deploy-kotlin-request": { + "resolve-deploy-kotlin-properties": { + "lock-acquire-timeout": 25 + } + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "lock-request-2", + "originatorId": "System" + } +} diff --git a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-3.json b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-3.json new file mode 100644 index 0000000..f0277bc --- /dev/null +++ b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-3.json @@ -0,0 +1,20 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin" + }, + "payload": { + "resolve-deploy-kotlin-request": { + "resolve-deploy-kotlin-properties": { + "lock-acquire-timeout": 15 + } + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "lock-request-3", + "originatorId": "System" + } +} diff --git a/cds-regression-test/test/lock-device/success/request-payloads/request-payload-4.json b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-4.json new file mode 100644 index 0000000..2ba6b89 --- /dev/null +++ b/cds-regression-test/test/lock-device/success/request-payloads/request-payload-4.json @@ -0,0 +1,20 @@ +{ + "actionIdentifiers": { + "mode": "sync", + "blueprintName": "RT-lock-device", + "blueprintVersion": "1.0.0", + "actionName": "resolve-deploy-kotlin" + }, + "payload": { + "resolve-deploy-kotlin-request": { + "resolve-deploy-kotlin-properties": { + "lock-acquire-timeout": 15 + } + } + }, + "commonHeader": { + "subRequestId": "1", + "requestId": "lock-request-4", + "originatorId": "System" + } +} diff --git a/cds-regression-test/test/lock-device/success/test.sh b/cds-regression-test/test/lock-device/success/test.sh new file mode 100644 index 0000000..5553e5f --- /dev/null +++ b/cds-regression-test/test/lock-device/success/test.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +CBA_NAME="lock-device" +TEST_NAME="success" +TEST_NUMBER=$RANDOM +mkdir -p "$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/" + +. ./$TEST_DIRECTORY/utils.sh + +echo "Running test: $CBA_NAME:$TEST_NUMBER:$TEST_NAME" + +for i in `seq 1 4` +do + echo "Sending request $i" + RESPONSE_HEADERS_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-headers-$i" + RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-$i" + REQUEST_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/request-payloads/request-payload-$i.json" + + process_cba $REQUEST_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE $RESPONSE_HEADERS_FILE & + pids[${i}]=$! + sleep 3 +done + +echo "Waiting for responses" +for pid in ${pids[*]} +do + wait $pid +done + +echo "Assert payload - request 1" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-1" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-1.json" +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE + +echo "Assert payload - request 2" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-2" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-2.json" +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE + +echo "Assert payload - request 3" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-3" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-3.json" +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE + +echo "Assert payload - request 4" +RESPONSE_PAYLOAD_FILE="$RESPONSES_DIRECTORY/$CBA_NAME/$TEST_NAME/$TEST_NUMBER/response-payload-4" +EXPECTED_PAYLOAD_FILE="$TEST_DIRECTORY/$CBA_NAME/$TEST_NAME/expected-payloads/expected-payload-4.json" +assert_cds_response_equals $EXPECTED_PAYLOAD_FILE $RESPONSE_PAYLOAD_FILE |