From 165a55810155e761eda662bef14a6b1cd81ec73d Mon Sep 17 00:00:00 2001 From: Juhan Aasaru Date: Fri, 15 Nov 2019 09:53:31 +0200 Subject: [PATCH 1/2] postman scripts, note about Lombok to readme --- README.md | 3 +- postman/requests.postman_collection.json | 190 +++++++++++++++++++++++ 2 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 postman/requests.postman_collection.json diff --git a/README.md b/README.md index d307758..60fb140 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ management. * [Maven](https://maven.apache.org/install.html) * [SAM CLI](https://github.com/awslabs/aws-sam-cli) * [Python 3](https://docs.python.org/3/) +* [Lombok](https://projectlombok.org/) plugin for your IDE ## Setup process @@ -76,7 +77,7 @@ mvn package **Invoking function locally through local API Gateway** 1. Start DynamoDB Local in a Docker container. `docker run -p 8000:8000 amazon/dynamodb-local` 2. Start the SAM local API. - - On a Mac: `sam local start-api --env-vars src/test/resources/test_environment_mac.json`. + - On a Mac: `sam local start-api --env-vars src/test/resources/test_environment_mac.json` - On Windows: `sam local start-api --env-vars src/test/resources/test_environment_windows.json` - On Linux: `sam local start-api --env-vars src/test/resources/test_environment_linux.json` diff --git a/postman/requests.postman_collection.json b/postman/requests.postman_collection.json new file mode 100644 index 0000000..855cf46 --- /dev/null +++ b/postman/requests.postman_collection.json @@ -0,0 +1,190 @@ +{ + "info": { + "_postman_id": "bfdc95c0-4714-497c-b090-78e9f7ade3d8", + "name": "aws-sam-java-rest requests", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "create orders table", + "request": { + "method": "POST", + "header": [], + "url": { + "raw": "http://127.0.0.1:3000/_create_orders_table", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "port": "3000", + "path": [ + "_create_orders_table" + ] + } + }, + "response": [] + }, + { + "name": "create order", + "event": [ + { + "listen": "test", + "script": { + "id": "c52e8a0f-c1b0-4ee0-ae41-d688289615e0", + "exec": [ + "var jsonData = JSON.parse(responseBody);", + "postman.setEnvironmentVariable(\"orderId\", jsonData.orderId);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"customerId\": \"1\",\n\t\"preTaxAmount\": 10,\n\t\"postTaxAmount\": 12\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://127.0.0.1:3000/orders", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "port": "3000", + "path": [ + "orders" + ] + } + }, + "response": [] + }, + { + "name": "get order", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://127.0.0.1:3000/orders/{{orderId}}", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "port": "3000", + "path": [ + "orders", + "{{orderId}}" + ] + } + }, + "response": [] + }, + { + "name": "update order", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n\t\"orderId\": \"{{orderId}}\",\n\t\"customerId\": \"1\",\n\t\"preTaxAmount\": 20,\n\t\"postTaxAmount\": 24,\n\t\"version\": 1\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://127.0.0.1:3000/orders/{{orderId}}", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "port": "3000", + "path": [ + "orders", + "{{orderId}}" + ] + } + }, + "response": [] + }, + { + "name": "get orders", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://127.0.0.1:3000/orders", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "port": "3000", + "path": [ + "orders" + ] + } + }, + "response": [] + }, + { + "name": "delete order", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "http://127.0.0.1:3000/orders/{{orderId}}", + "protocol": "http", + "host": [ + "127", + "0", + "0", + "1" + ], + "port": "3000", + "path": [ + "orders", + "{{orderId}}" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {} +} \ No newline at end of file From 713dfb3fef610f915f61bf5da1952168f4661632 Mon Sep 17 00:00:00 2001 From: Juhan Aasaru Date: Fri, 15 Nov 2019 09:58:24 +0200 Subject: [PATCH 2/2] postman scripts to readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 60fb140..42cf04b 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ management. ├── README.md <-- This instructions file ├── LICENSE.txt <-- Apache Software License 2.0 ├── NOTICE.txt <-- Copyright notices +└── postman <-- Postman scripts +│ └── requests.postman_collection.json <-- Requests to create/read/update/delete orders ├── pom.xml <-- Java dependencies, Docker integration test orchestration ├── src │ ├── main