diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index aaace75..ceb9b53 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -19,6 +19,8 @@ jobs: # wait a minute for all services to be up - run: sleep 30 && hurl --very-verbose tests/*.hurl shell: bash + - run: hurl --very-verbose tests/flows/*.hurl + shell: bash unit-tests: runs-on: ubuntu-latest steps: diff --git a/.gitignore b/.gitignore index 250654d..75a16dc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,12 @@ gradle/ build/ target/ +bin/ gradlew.bat gradlew .idea/ +.vscode/ postgres-data/ .db/ diff --git a/customer-service/Dockerfile b/customer-service/Dockerfile index 3efde45..8fc824d 100644 --- a/customer-service/Dockerfile +++ b/customer-service/Dockerfile @@ -5,7 +5,7 @@ EXPOSE 8081 ## Use this if you want to just copy the executable COPY customer-service/build/libs/customer-service.jar app.jar COPY customer-service/build/resources resources -CMD java -jar app.jar +CMD java -jar app.jar --debug # Use this if you want to build in docker #WORKDIR /app diff --git a/inventory-service/Dockerfile b/inventory-service/Dockerfile index 50832c6..76519c0 100644 --- a/inventory-service/Dockerfile +++ b/inventory-service/Dockerfile @@ -5,7 +5,7 @@ EXPOSE 8087 ## Use this if you want to just copy the executable COPY inventory-service/build/libs/inventory-service.jar app.jar COPY inventory-service/build/resources resources -CMD java -jar app.jar +CMD java -jar app.jar --debug # Use this if you want to build in docker #WORKDIR /app diff --git a/order-management-service/Dockerfile b/order-management-service/Dockerfile index b1cddaf..31b5113 100644 --- a/order-management-service/Dockerfile +++ b/order-management-service/Dockerfile @@ -5,7 +5,7 @@ EXPOSE 8088 ## Use this if you want to just copy the executable COPY order-management-service/build/libs/order-management-service.jar app.jar COPY order-management-service/build/resources resources -CMD java -jar app.jar +CMD java -jar app.jar --debug # Use this if you want to build in docker #WORKDIR /app diff --git a/tests/flows/1.hurl b/tests/flows/1.hurl new file mode 100644 index 0000000..8bf69da --- /dev/null +++ b/tests/flows/1.hurl @@ -0,0 +1,104 @@ +### PRODUCT, INVENTORY & STAFF SET-UP ### +POST http://localhost:8080/api/Products +{ + "category": "TODO-1", + "name": "Pizza", + "price": 1100 +} +HTTP 201 +[Captures] +product-id1: jsonpath "$.id" + +POST http://localhost:8080/api/Products +{ + "category": "TODO-1", + "name": "Blynai", + "price": 780 +} +HTTP 201 +[Captures] +product-id2: jsonpath "$.id" + +POST http://localhost:8080/api/Products +{ + "category": "TODO-2", + "name": "Alus", + "price": 320 +} +HTTP 201 +[Captures] +product-id3: jsonpath "$.id" + +POST http://localhost:8080/api/Inventory +{ + "product_id": {{product-id1}}, + "stockQuantity": 100 +} +HTTP 201 + +POST http://localhost:8080/api/Inventory +{ + "product_id": {{product-id2}}, + "stockQuantity": 50 +} +HTTP 201 + +POST http://localhost:8080/api/Inventory +{ + "product_id": {{product-id3}}, + "stockQuantity": 5 +} +HTTP 201 + +POST http://localhost:8080/api/Staff +{ + "name": "Vardenis Pavardenis", + "email": "example@example.com", + "password": "password" +} +HTTP 201 +[Captures] +staff-id: jsonpath "$.id" + + +### Create Order ### + +#POST http://localhost:8080/api/OrderItem +#{ +# "name": "Blynai", +# "quantity": 1, +# "priceOfUnit": 780 +#} +#HTTP 201 + +#POST http://localhost:8080/api/OrderItem +#{ +# "name": "Alus", +# "quantity": 2, +# "priceOfUnit": 320 +#} + +POST http://localhost:8080/api/Orders +{ + "staffUserId": {{staff-id}}, + "items": [ + { + "name": "Alus", + "quantity": 2, + "priceOfUnit": 320 + }, + { + "name": "Blynai", + "quantity": 1, + "priceOfUnit": 780 + } + ], + "status": "ACTIVE" +} +HTTP 201 + +### ADD ITEMS TO THE ORDER ### + +# TODO: implement add product +# TODO: implement remove product +