From a283d4be465832620b8613428fa306d7e59ba872 Mon Sep 17 00:00:00 2001 From: Philipp Theyssen Date: Mon, 27 Feb 2023 11:48:03 +0100 Subject: [PATCH] Refine example scenario for eshop --- .../operations/op_basket_add_item.json | 36 +++++----- .../operations/op_catalog_add_item.json | 6 +- .../operations/op_catalog_get_items.json | 19 +++++- .../operations/op_catalog_update_price.json | 19 ++++++ .../transactions/add_items_to_basket.json | 65 ++++++++++++++++--- 5 files changed, 116 insertions(+), 29 deletions(-) diff --git a/scenario-definition/operations/op_basket_add_item.json b/scenario-definition/operations/op_basket_add_item.json index f314d5d20..019c1ee2c 100644 --- a/scenario-definition/operations/op_basket_add_item.json +++ b/scenario-definition/operations/op_basket_add_item.json @@ -3,35 +3,35 @@ "type": "http", "httpMethod": "post", "arguments": [ + { + "name": "buyerId", + "required": true, + "type": "guid" + }, { - "name": "items", + "name": "item-1", "required": true, "type": "object" }, - { - "name": "buyerId", + { + "name": "item-2", "required": true, - "type": "guid" - }, - ], - "dynamicVariables": [ + "type": "object" + }, { - "name": "basket-item-id", - "type": "unsignedInt" + "name": "item-3", + "required": true, + "type": "object" } - ] - "payload": { + ], + "requestPayload": { "type": "json", "content": { "buyerId": "{{buyerId}}", "items": [ - "id": "1", - "productId": "{{items}}", - "productName": "string", - "unitPrice": 0, - "oldUnitPrice": 0, - "quantity": 0, - "pictureUrl": "" + "{{item-1}}", + "{{item-2}}", + "{{item-3}}" ] } }, diff --git a/scenario-definition/operations/op_catalog_add_item.json b/scenario-definition/operations/op_catalog_add_item.json index e2c1155fe..8074cbe0e 100644 --- a/scenario-definition/operations/op_catalog_add_item.json +++ b/scenario-definition/operations/op_catalog_add_item.json @@ -2,6 +2,10 @@ "id": "catalog-add-item", "type": "http", "httpMethod": "post", + "arguments": [ + "name": "product-id", + "type": "unsignedInt" + ] "dynamicVariables": [ { "name": "item-name", @@ -35,7 +39,7 @@ "payload": { "type": "json", "content": { - "id": 0, + "id": "{{product-id}}", "name": "{{item-name}}", "description": "{{item-description}}", "price": "{{price}}", diff --git a/scenario-definition/operations/op_catalog_get_items.json b/scenario-definition/operations/op_catalog_get_items.json index c7527c4e7..bcc71db77 100644 --- a/scenario-definition/operations/op_catalog_get_items.json +++ b/scenario-definition/operations/op_catalog_get_items.json @@ -7,6 +7,23 @@ "key": "pageSize", "value": 3 } - ], + ], + "returnValues": [ + { + "key": "item-1", + "value": "@@response.payload.data[0]@@", + "type": "object" + }, + { + "key": "item-2", + "value": "@@response.payload.data[1]@@", + "type": "object" + }, + { + "key": "item-3", + "value": "@@response.payload.data[2]@@", + "type": "object" + } + ] "url": "http://localhost:5101/catalog-api/api/v1/Catalog/items" } diff --git a/scenario-definition/operations/op_catalog_update_price.json b/scenario-definition/operations/op_catalog_update_price.json index e69de29bb..1cac6d8c4 100644 --- a/scenario-definition/operations/op_catalog_update_price.json +++ b/scenario-definition/operations/op_catalog_update_price.json @@ -0,0 +1,19 @@ +{ + "id": "catalog-update-price", + "type": "http", + "httpMethod": "put", + "arguments": [ + { + "name": "item-1", + "required": true, + "type": "object" + } + ], + "payload": { + "type": "json", + "content": { + "{{item-1}}" + } + }, + "url": "http://localhost:5101/catalog-api/api/v1/Catalog/items" +} diff --git a/scenario-definition/transactions/add_items_to_basket.json b/scenario-definition/transactions/add_items_to_basket.json index 72618a0f8..7aa59cfe3 100644 --- a/scenario-definition/transactions/add_items_to_basket.json +++ b/scenario-definition/transactions/add_items_to_basket.json @@ -1,17 +1,64 @@ -transaction: +"transaction": { "id": "add-items-to-basket", - "operations": [ + "arguments": [ { - operationRefId: "catalog-get-items", - id: "op-1", + "name": "user-id", + "type": "guid" + } + ], + "operations": [ + { + "operationRefId": "catalog-get-items", + "id": "op-1", }, { - operationRefId: "op-id-2", - id: "second-op-in-this-transaction", - arguments: [ - userId, - @first-op-in-this-transaction.response.id + "operationRefId": "basket-add-item", + "id": "op-2", + "providedValues": [ + { + "key": "buyerId", + "value": "{{user-id}}" + }, + { + "key": "item-1", + "value": + { + "id": "1", + "productId": "@@op-1.response[0].id@@", + "productName": "@@op-1.response[0].name@@", + "unitPrice": "@@op-1.response[0].price@@", + "oldUnitPrice": "@@op-1.response[0].price@@", + "quantity": "@@op-1.response[0].availablestock@@", + "pictureUrl": "" + }, + }, + { + "key": "item-2", + "value": + { + "id": "2", + "productId": "@@op-1.response[1].id@@", + "productName": "@@op-1.response[1].name@@", + "unitPrice": "@@op-1.response[1].price@@", + "oldUnitPrice": "@@op-1.response[1].price@@", + "quantity": "@@op-1.response[1].availablestock@@", + "pictureUrl": "" + }, + }, + { + "key": "item-3", + "value": + { + "id": "3", + "productId": "@@op-1.response[2].id@@", + "productName": "@@op-1.response[2].name@@", + "unitPrice": "@@op-1.response[2].price@@", + "oldUnitPrice": "@@op-1.response[2].price@@", + "quantity": "@@op-1.response[2].availablestock@@", + "pictureUrl": "" + } + } ] } ]