Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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`

Expand Down
190 changes: 190 additions & 0 deletions postman/requests.postman_collection.json
Original file line number Diff line number Diff line change
@@ -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": {}
}