diff --git a/README.md b/README.md index d307758..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 @@ -60,6 +62,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 +79,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