From 44f44615ead54d1ecf78496f5604f8e0ee425ed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rdos=20Istv=C3=A1n?= Date: Mon, 12 Feb 2024 21:30:13 +0100 Subject: [PATCH 1/9] Refactor API router Change ERP core APIs to be reached via the "service" route. --- .../com/ibardos/motoShop/controller/ManufacturerController.java | 2 +- .../ibardos/motoShop/controller/MotorcycleModelController.java | 2 +- .../ibardos/motoShop/controller/MotorcycleStockController.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ibardos/motoShop/controller/ManufacturerController.java b/src/main/java/com/ibardos/motoShop/controller/ManufacturerController.java index 74502bc..234cce4 100644 --- a/src/main/java/com/ibardos/motoShop/controller/ManufacturerController.java +++ b/src/main/java/com/ibardos/motoShop/controller/ManufacturerController.java @@ -13,7 +13,7 @@ * REST API controller for Manufacturer type. */ @RestController -@RequestMapping("manufacturer") +@RequestMapping("service/manufacturer") public class ManufacturerController { ManufacturerService manufacturerService; diff --git a/src/main/java/com/ibardos/motoShop/controller/MotorcycleModelController.java b/src/main/java/com/ibardos/motoShop/controller/MotorcycleModelController.java index b1fc6fe..4ba8f5d 100644 --- a/src/main/java/com/ibardos/motoShop/controller/MotorcycleModelController.java +++ b/src/main/java/com/ibardos/motoShop/controller/MotorcycleModelController.java @@ -15,7 +15,7 @@ * REST API controller for MotorcycleModel type. */ @RestController -@RequestMapping("motorcycle/model") +@RequestMapping("service/motorcycle/model") public class MotorcycleModelController { MotorcycleModelService motorcycleModelService; diff --git a/src/main/java/com/ibardos/motoShop/controller/MotorcycleStockController.java b/src/main/java/com/ibardos/motoShop/controller/MotorcycleStockController.java index f20e0c5..d977edc 100644 --- a/src/main/java/com/ibardos/motoShop/controller/MotorcycleStockController.java +++ b/src/main/java/com/ibardos/motoShop/controller/MotorcycleStockController.java @@ -13,7 +13,7 @@ * REST API controller for MotorcycleStock type. */ @RestController -@RequestMapping("motorcycle/stock") +@RequestMapping("service/motorcycle/stock") public class MotorcycleStockController { MotorcycleStockService motorcycleStockService; From 4ace477b6081b41808bd93d5d6b7efb258ade590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rdos=20Istv=C3=A1n?= Date: Mon, 12 Feb 2024 21:30:48 +0100 Subject: [PATCH 2/9] Update SecurityConfiguration.java --- .../configuration/SecurityConfiguration.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/ibardos/motoShop/security/configuration/SecurityConfiguration.java b/src/main/java/com/ibardos/motoShop/security/configuration/SecurityConfiguration.java index 0456623..293e995 100644 --- a/src/main/java/com/ibardos/motoShop/security/configuration/SecurityConfiguration.java +++ b/src/main/java/com/ibardos/motoShop/security/configuration/SecurityConfiguration.java @@ -44,20 +44,20 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti .requestMatchers("authentication/register").hasRole("Admin") - .requestMatchers("manufacturer/add").hasAuthority("PERMISSION_Create") - .requestMatchers("manufacturer/get/**").hasAuthority("PERMISSION_Read") - .requestMatchers("manufacturer/update").hasAuthority("PERMISSION_Update") - .requestMatchers("manufacturer/delete/**").hasAuthority("PERMISSION_Delete") + .requestMatchers("service/manufacturer/add").hasAuthority("PERMISSION_Create") + .requestMatchers("service/manufacturer/get/**").hasAuthority("PERMISSION_Read") + .requestMatchers("service/manufacturer/update").hasAuthority("PERMISSION_Update") + .requestMatchers("service/manufacturer/delete/**").hasAuthority("PERMISSION_Delete") - .requestMatchers("motorcycle/model/add").hasAuthority("PERMISSION_Create") - .requestMatchers("motorcycle/model/get/**").hasAuthority("PERMISSION_Read") - .requestMatchers("motorcycle/model/update").hasAuthority("PERMISSION_Update") - .requestMatchers("motorcycle/model/delete/**").hasAuthority("PERMISSION_Delete") + .requestMatchers("service/motorcycle/model/add").hasAuthority("PERMISSION_Create") + .requestMatchers("service/motorcycle/model/get/**").hasAuthority("PERMISSION_Read") + .requestMatchers("service/motorcycle/model/update").hasAuthority("PERMISSION_Update") + .requestMatchers("service/motorcycle/model/delete/**").hasAuthority("PERMISSION_Delete") - .requestMatchers("motorcycle/stock/add").hasAuthority("PERMISSION_Create") - .requestMatchers("motorcycle/stock/get/**").hasAuthority("PERMISSION_Read") - .requestMatchers("motorcycle/stock/update").hasAuthority("PERMISSION_Update") - .requestMatchers("motorcycle/stock/delete/**").hasAuthority("PERMISSION_Delete") + .requestMatchers("service/motorcycle/stock/add").hasAuthority("PERMISSION_Create") + .requestMatchers("service/motorcycle/stock/get/**").hasAuthority("PERMISSION_Read") + .requestMatchers("service/motorcycle/stock/update").hasAuthority("PERMISSION_Update") + .requestMatchers("service/motorcycle/stock/delete/**").hasAuthority("PERMISSION_Delete") .anyRequest() .authenticated() From 5d36f6c8f286b909c194729291a606e45f0bdcdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rdos=20Istv=C3=A1n?= Date: Mon, 12 Feb 2024 21:31:31 +0100 Subject: [PATCH 3/9] Update EndToEndTestUtil.java Refactor retrieveJwtToken() method to work with newly implemented routing strategy. --- .../ibardos/motoShop/endToEndTest/util/EndToEndTestUtil.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/util/EndToEndTestUtil.java b/src/test/java/com/ibardos/motoShop/endToEndTest/util/EndToEndTestUtil.java index 047f520..9c6a689 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/util/EndToEndTestUtil.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/util/EndToEndTestUtil.java @@ -19,7 +19,6 @@ public class EndToEndTestUtil { /** * Retrieves a JWT token from the back-end server related to a test ApplicationUser with the Role passed as parameter. * @param baseUrl a URI where the login request should be sent to. - * @param port a port which the server runs on. * @param client an HTTP client can be used to send HTTP related requests. * @param role String representation of the desired Role embedded in the JWT token. * @return String representation of a valid and signed JWT token retrieved from the back-end server. @@ -27,8 +26,8 @@ public class EndToEndTestUtil { * @throws InterruptedException will be thrown if HTTP request sending fails. * @throws JSONException will be thrown if a JSON object related task fails. */ - public static String retrieveJwtToken(String baseUrl, int port, HttpClient client, String role) throws IOException, InterruptedException, JSONException { - HttpRequest request = HttpRequest.newBuilder(URI.create(baseUrl + port + "/authentication/login")) + public static String retrieveJwtToken(String baseUrl, HttpClient client, String role) throws IOException, InterruptedException, JSONException { + HttpRequest request = HttpRequest.newBuilder(URI.create(baseUrl + "authentication/login")) .headers("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/login/Login" + role + "Role.json"))) .build(); From 01e4e7e79e1d556b4f6240c5628a38ff3ca0606e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rdos=20Istv=C3=A1n?= Date: Mon, 12 Feb 2024 21:32:11 +0100 Subject: [PATCH 4/9] Refactor service APIs end-to-end test classes to work with new routing strategy --- .../AuthenticationControllerApiTests.java | 48 ++++++++++--------- ...nufacturerControllerApiAdminRoleTests.java | 30 ++++++------ ...cycleModelControllerApiAdminRoleTests.java | 32 +++++++------ ...cycleStockControllerApiAdminRoleTests.java | 28 ++++++----- ...nufacturerControllerApiSalesRoleTests.java | 30 ++++++------ ...cycleModelControllerApiSalesRoleTests.java | 32 +++++++------ ...cycleStockControllerApiSalesRoleTests.java | 28 ++++++----- ...anufacturerControllerApiUserRoleTests.java | 30 ++++++------ ...rcycleModelControllerApiUserRoleTests.java | 32 +++++++------ ...rcycleStockControllerApiUserRoleTests.java | 28 ++++++----- 10 files changed, 169 insertions(+), 149 deletions(-) diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/authentication/AuthenticationControllerApiTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/authentication/AuthenticationControllerApiTests.java index be21feb..118124c 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/authentication/AuthenticationControllerApiTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/authentication/AuthenticationControllerApiTests.java @@ -33,7 +33,7 @@ public class AuthenticationControllerApiTests { @LocalServerPort private int port; - private final String baseUrl = "http://localhost:"; + private String baseUrl; private HttpClient client; private String jwtTokenAdminRole; @@ -42,8 +42,10 @@ public class AuthenticationControllerApiTests { void initBeforeAll() throws Exception { client = HttpClient.newBuilder().build(); + baseUrl = "http://localhost:" + port + "/"; + // JWT of authenticated ApplicationUser with Admin role needed to be authorized for calling register endpoint - jwtTokenAdminRole = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "Admin"); + jwtTokenAdminRole = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "Admin"); } @@ -52,7 +54,7 @@ void initBeforeAll() throws Exception { @Order(1) void register_newValidApplicationUserWithoutJwtToken_statusCode403() throws Exception { // Arrange - String registerUrl = baseUrl + port + "/authentication/register"; + String registerUrl = baseUrl + "authentication/register"; int registerExpectedResponseStatus = 403; @@ -79,12 +81,12 @@ void register_newValidApplicationUserWithoutJwtToken_statusCode403() throws Exce @Order(2) void register_newValidApplicationUserWithUserRole_statusCode403() throws Exception { // Arrange - String registerUrl = baseUrl + port + "/authentication/register"; + String registerUrl = baseUrl + "authentication/register"; int registerExpectedResponseStatus = 403; // Retrieve a JWT token of a registered ApplicationUser to be used during the call of the register API - String jwtTokenUserRole = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "User"); + String jwtTokenUserRole = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "User"); HttpRequest registerRequest = HttpRequest.newBuilder(URI.create(registerUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenUserRole) @@ -106,12 +108,12 @@ void register_newValidApplicationUserWithUserRole_statusCode403() throws Excepti @Order(3) void register_newValidApplicationUserWithSalesRole_statusCode403() throws Exception { // Arrange - String registerUrl = baseUrl + port + "/authentication/register"; + String registerUrl = baseUrl + "authentication/register"; int registerExpectedResponseStatus = 403; // Retrieve a JWT token of a registered ApplicationUser to be used during the call of the register API - String jwtTokenSalesRole = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "Sales"); + String jwtTokenSalesRole = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "Sales"); HttpRequest registerRequest = HttpRequest.newBuilder(URI.create(registerUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenSalesRole) @@ -133,7 +135,7 @@ void register_newValidApplicationUserWithSalesRole_statusCode403() throws Except @Order(4) void register_newEmptyBodyApplicationUserWithAdminRole_statusCode400() throws Exception { // Arrange - String registerUrl = baseUrl + port + "/authentication/register"; + String registerUrl = baseUrl + "authentication/register"; int registerExpectedResponseStatus = 400; @@ -157,7 +159,7 @@ void register_newEmptyBodyApplicationUserWithAdminRole_statusCode400() throws Ex @Order(5) void register_newInvalidApplicationUserWithAdminRole_statusCode500() throws Exception { // Arrange - String registerUrl = baseUrl + port + "/authentication/register"; + String registerUrl = baseUrl + "authentication/register"; int registerExpectedResponseStatus = 500; @@ -181,7 +183,7 @@ void register_newInvalidApplicationUserWithAdminRole_statusCode500() throws Exce @Order(6) void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtTokenInResponseForUserRole() throws Exception { // Arrange - String registerUrl = baseUrl + port + "/authentication/register"; + String registerUrl = baseUrl + "authentication/register"; int registerExpectedResponseStatus = 200; @@ -209,7 +211,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke // by utilizing it during a test HTTP call to the server // Arrange - String testCallUrl = baseUrl + port + "/manufacturer/update"; + String testCallUrl = baseUrl + "service/manufacturer/update"; int testCallExpectedResponseStatus = 403; @@ -234,7 +236,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke @Order(7) void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtTokenInResponseForSalesRole() throws Exception { // Arrange - String registerUrl = baseUrl + port + "/authentication/register"; + String registerUrl = baseUrl + "authentication/register"; int registerExpectedResponseStatus = 200; @@ -262,7 +264,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke // by utilizing it during a test HTTP call to the server // Arrange - String testCallUrl = baseUrl + port + "/manufacturer/update"; + String testCallUrl = baseUrl + "service/manufacturer/update"; int testCallExpectedResponseStatus = 204; @@ -287,7 +289,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke @Order(8) void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtTokenInResponseForAdminRole() throws Exception { // Arrange - String registerUrl = baseUrl + port + "/authentication/register"; + String registerUrl = baseUrl + "authentication/register"; int registerExpectedResponseStatus = 200; @@ -315,7 +317,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke // by utilizing it during a test HTTP call to the server // Arrange - String testCallUrl = baseUrl + port + "/manufacturer/update"; + String testCallUrl = baseUrl + "service/manufacturer/update"; int testCallExpectedResponseStatus = 204; @@ -341,7 +343,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke @Order(9) void login_emptyBodyApplicationUser_statusCode400() throws Exception { // Arrange - String loginUrl = baseUrl + port + "/authentication/login"; + String loginUrl = baseUrl + "authentication/login"; int loginExpectedResponseStatus = 400; @@ -365,7 +367,7 @@ void login_emptyBodyApplicationUser_statusCode400() throws Exception { @Order(10) void login_invalidApplicationUser_statusCode403() throws Exception { // Arrange - String loginUrl = baseUrl + port + "/authentication/login"; + String loginUrl = baseUrl + "authentication/login"; int loginExpectedResponseStatus = 403; @@ -389,7 +391,7 @@ void login_invalidApplicationUser_statusCode403() throws Exception { @Order(11) void login_existingApplicationUserWithUserRole_statusCode200WithValidJwtTokenInResponseForUserRole() throws Exception { // Arrange - String loginUrl = baseUrl + port + "/authentication/login"; + String loginUrl = baseUrl + "authentication/login"; int loginExpectedResponseStatus = 200; @@ -419,7 +421,7 @@ void login_existingApplicationUserWithUserRole_statusCode200WithValidJwtTokenInR // by utilizing it during a test HTTP call to the server // Arrange - String testCallUrl = baseUrl + port + "/manufacturer/update"; + String testCallUrl = baseUrl + "service/manufacturer/update"; int testCallExpectedResponseStatus = 403; @@ -441,7 +443,7 @@ void login_existingApplicationUserWithUserRole_statusCode200WithValidJwtTokenInR @Order(12) void login_existingApplicationUserWithSalesRole_statusCode200WithValidJwtTokenInResponseForSalesRole() throws Exception { // Arrange - String loginUrl = baseUrl + port + "/authentication/login"; + String loginUrl = baseUrl + "authentication/login"; int loginExpectedResponseStatus = 200; @@ -471,7 +473,7 @@ void login_existingApplicationUserWithSalesRole_statusCode200WithValidJwtTokenIn // by utilizing it during a test HTTP call to the server // Arrange - String testCallUrl = baseUrl + port + "/manufacturer/update"; + String testCallUrl = baseUrl + "service/manufacturer/update"; int testCallExpectedResponseStatus = 204; @@ -493,7 +495,7 @@ void login_existingApplicationUserWithSalesRole_statusCode200WithValidJwtTokenIn @Order(13) void login_existingApplicationUserWithAdminRole_statusCode200WithValidJwtTokenInResponseForAdminRole() throws Exception { // Arrange - String loginUrl = baseUrl + port + "/authentication/login"; + String loginUrl = baseUrl + "authentication/login"; int loginExpectedResponseStatus = 200; @@ -523,7 +525,7 @@ void login_existingApplicationUserWithAdminRole_statusCode200WithValidJwtTokenIn // by utilizing it during a test HTTP call to the server // Arrange - String testCallUrl = baseUrl + port + "/manufacturer/update"; + String testCallUrl = baseUrl + "service/manufacturer/update"; int testCallExpectedResponseStatus = 204; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/ManufacturerControllerApiAdminRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/ManufacturerControllerApiAdminRoleTests.java index bed6353..056b689 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/ManufacturerControllerApiAdminRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/ManufacturerControllerApiAdminRoleTests.java @@ -37,7 +37,7 @@ public class ManufacturerControllerApiAdminRoleTests { @LocalServerPort private int port; - private final String baseUrl = "http://localhost:"; + private String baseUrl; private HttpClient client; private String jwtToken; @@ -46,7 +46,9 @@ public class ManufacturerControllerApiAdminRoleTests { public void initBeforeAll() throws Exception { client = HttpClient.newBuilder().build(); - jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "Admin"); + baseUrl = "http://localhost:" + port + "/"; + + jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "Admin"); } @@ -54,7 +56,7 @@ public void initBeforeAll() throws Exception { @Order(1) void add_newValidManufacturer_statusCode201WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/add"; + String url = baseUrl + "service/manufacturer/add"; int expectedResponseStatus = 201; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Add.json"))); @@ -79,7 +81,7 @@ void add_newValidManufacturer_statusCode201WithProperJson() throws Exception { @Order(2) void add_newInvalidManufacturer_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/add"; + String url = baseUrl + "service/manufacturer/add"; int expectedResponseStatus = 400; @@ -101,7 +103,7 @@ void add_newInvalidManufacturer_statusCode400() throws Exception { @Order(3) void get_manufacturerWithValidId_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/6"; + String url = baseUrl + "service/manufacturer/get/6"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Get.json"))); @@ -126,7 +128,7 @@ void get_manufacturerWithValidId_statusCode200WithProperJson() throws Exception @Order(4) void get_manufacturerWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/55"; + String url = baseUrl + "service/manufacturer/get/55"; int expectedResponseStatus = 404; @@ -148,7 +150,7 @@ void get_manufacturerWithInvalidId_statusCode404() throws Exception { @Order(5) void getAll_listOfManufacturers_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/all"; + String url = baseUrl + "service/manufacturer/get/all"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/GetAll.json"))); @@ -173,7 +175,7 @@ void getAll_listOfManufacturers_statusCode200WithProperJson() throws Exception { @Order(6) void getAll_listOfManufacturersFromInvalidUrl_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/allInvalid"; + String url = baseUrl + "service/manufacturer/get/allInvalid"; int expectedResponseStatus = 400; @@ -195,7 +197,7 @@ void getAll_listOfManufacturersFromInvalidUrl_statusCode400() throws Exception { @Order(7) void update_manufacturerWithValidId_statusCode204() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/update"; + String url = baseUrl + "service/manufacturer/update"; int expectedResponseStatus = 204; @@ -217,7 +219,7 @@ void update_manufacturerWithValidId_statusCode204() throws Exception { @Order(8) void update_manufacturerWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/update"; + String url = baseUrl + "service/manufacturer/update"; int expectedResponseStatus = 404; @@ -239,7 +241,7 @@ void update_manufacturerWithInvalidId_statusCode404() throws Exception { @Order(9) void update_manufacturerWithInvalidJson_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/update"; + String url = baseUrl + "service/manufacturer/update"; int expectedResponseStatus = 400; @@ -261,7 +263,7 @@ void update_manufacturerWithInvalidJson_statusCode400() throws Exception { @Order(10) void delete_manufacturerWithValidId_statusCode204() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/delete/5"; + String url = baseUrl + "service/manufacturer/delete/5"; int expectedResponseStatus = 204; @@ -283,7 +285,7 @@ void delete_manufacturerWithValidId_statusCode204() throws Exception { @Order(11) void delete_manufacturerWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/delete/33"; + String url = baseUrl + "service/manufacturer/delete/33"; int expectedResponseStatus = 404; @@ -305,7 +307,7 @@ void delete_manufacturerWithInvalidId_statusCode404() throws Exception { @Order(12) void delete_manufacturerWithIdHasForeignKeyRestriction_statusCode500() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/delete/1"; + String url = baseUrl + "service/manufacturer/delete/1"; int expectedResponseStatus = 500; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleModelControllerApiAdminRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleModelControllerApiAdminRoleTests.java index be6e499..064447d 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleModelControllerApiAdminRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleModelControllerApiAdminRoleTests.java @@ -37,7 +37,7 @@ public class MotorcycleModelControllerApiAdminRoleTests { @LocalServerPort private int port; - private final String baseUrl = "http://localhost:"; + private String baseUrl; private HttpClient client; private String jwtToken; @@ -46,7 +46,9 @@ public class MotorcycleModelControllerApiAdminRoleTests { public void initBeforeAll() throws Exception { client = HttpClient.newBuilder().build(); - jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "Admin"); + baseUrl = "http://localhost:" + port + "/"; + + jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "Admin"); } @@ -54,7 +56,7 @@ public void initBeforeAll() throws Exception { @Order(1) void add_newValidMotorcycleModel_statusCode201WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/add"; + String url = baseUrl + "service/motorcycle/model/add"; int expectedResponseStatus = 201; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Add.json"))); @@ -79,7 +81,7 @@ void add_newValidMotorcycleModel_statusCode201WithProperJson() throws Exception @Order(2) void add_newInvalidMotorcycleModel_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/add"; + String url = baseUrl + "service/motorcycle/model/add"; int expectedResponseStatus = 400; @@ -101,7 +103,7 @@ void add_newInvalidMotorcycleModel_statusCode400() throws Exception { @Order(3) void get_motorcycleModelWithValidId_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/1"; + String url = baseUrl + "service/motorcycle/model/get/1"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Get.json"))); @@ -126,7 +128,7 @@ void get_motorcycleModelWithValidId_statusCode200WithProperJson() throws Excepti @Order(4) void get_motorcycleModelWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/55"; + String url = baseUrl + "service/motorcycle/model/get/55"; int expectedResponseStatus = 404; @@ -148,7 +150,7 @@ void get_motorcycleModelWithInvalidId_statusCode404() throws Exception { @Order(5) void getAll_listOfMotorcycleModels_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/all"; + String url = baseUrl + "service/motorcycle/model/get/all"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetAll.json"))); @@ -173,7 +175,7 @@ void getAll_listOfMotorcycleModels_statusCode200WithProperJson() throws Exceptio @Order(6) void getAll_listOfMotorcycleModelsFromInvalidUrl_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/allInvalid"; + String url = baseUrl + "service/motorcycle/model/get/allInvalid"; int expectedResponseStatus = 400; @@ -195,7 +197,7 @@ void getAll_listOfMotorcycleModelsFromInvalidUrl_statusCode400() throws Exceptio @Order(7) void update_motorcycleModelWithValidId_statusCode204() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/update"; + String url = baseUrl + "service/motorcycle/model/update"; int expectedResponseStatus = 204; @@ -217,7 +219,7 @@ void update_motorcycleModelWithValidId_statusCode204() throws Exception { @Order(8) void update_motorcycleModelWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/update"; + String url = baseUrl + "service/motorcycle/model/update"; int expectedResponseStatus = 404; @@ -239,7 +241,7 @@ void update_motorcycleModelWithInvalidId_statusCode404() throws Exception { @Order(9) void update_motorcycleModelWithInvalidJson_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/update"; + String url = baseUrl + "service/motorcycle/model/update"; int expectedResponseStatus = 400; @@ -261,7 +263,7 @@ void update_motorcycleModelWithInvalidJson_statusCode400() throws Exception { @Order(10) void delete_motorcycleModelWithValidId_statusCode204() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/delete/6"; + String url = baseUrl + "service/motorcycle/model/delete/6"; int expectedResponseStatus = 204; @@ -283,7 +285,7 @@ void delete_motorcycleModelWithValidId_statusCode204() throws Exception { @Order(11) void delete_motorcycleModelWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/delete/99"; + String url = baseUrl + "service/motorcycle/model/delete/99"; int expectedResponseStatus = 404; @@ -305,7 +307,7 @@ void delete_motorcycleModelWithInvalidId_statusCode404() throws Exception { @Order(12) void delete_motorcycleModelWithIdHasForeignKeyRestriction_statusCode500() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/delete/7"; + String url = baseUrl + "service/motorcycle/model/delete/7"; int expectedResponseStatus = 500; @@ -327,7 +329,7 @@ void delete_motorcycleModelWithIdHasForeignKeyRestriction_statusCode500() throws @Order(13) void get_motorcycleModelTypes_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/types"; + String url = baseUrl + "service/motorcycle/model/get/types"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetMotorcycleModelTypes.json"))); diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleStockControllerApiAdminRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleStockControllerApiAdminRoleTests.java index 5ce25ad..7e00f6a 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleStockControllerApiAdminRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleStockControllerApiAdminRoleTests.java @@ -37,7 +37,7 @@ public class MotorcycleStockControllerApiAdminRoleTests { @LocalServerPort private int port; - private final String baseUrl = "http://localhost:"; + private String baseUrl; private HttpClient client; private String jwtToken; @@ -46,7 +46,9 @@ public class MotorcycleStockControllerApiAdminRoleTests { public void initBeforeAll() throws Exception { client = HttpClient.newBuilder().build(); - jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "Admin"); + baseUrl = "http://localhost:" + port + "/"; + + jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "Admin"); } @@ -54,7 +56,7 @@ public void initBeforeAll() throws Exception { @Order(1) void add_newValidMotorcycleStock_statusCode201WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/add"; + String url = baseUrl + "service/motorcycle/stock/add"; int expectedResponseStatus = 201; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Add.json"))); @@ -79,7 +81,7 @@ void add_newValidMotorcycleStock_statusCode201WithProperJson() throws Exception @Order(2) void add_newInvalidMotorcycleStock_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/add"; + String url = baseUrl + "service/motorcycle/stock/add"; int expectedResponseStatus = 400; @@ -101,7 +103,7 @@ void add_newInvalidMotorcycleStock_statusCode400() throws Exception { @Order(3) void get_motorcycleStockWithValidId_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/8"; + String url = baseUrl + "service/motorcycle/stock/get/8"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Get.json"))); @@ -126,7 +128,7 @@ void get_motorcycleStockWithValidId_statusCode200WithProperJson() throws Excepti @Order(4) void get_motorcycleStockWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/55"; + String url = baseUrl + "service/motorcycle/stock/get/55"; int expectedResponseStatus = 404; @@ -148,7 +150,7 @@ void get_motorcycleStockWithInvalidId_statusCode404() throws Exception { @Order(5) void getAll_listOfMotorcycleStocks_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/all"; + String url = baseUrl + "service/motorcycle/stock/get/all"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/GetAll.json"))); @@ -173,7 +175,7 @@ void getAll_listOfMotorcycleStocks_statusCode200WithProperJson() throws Exceptio @Order(6) void getAll_listOfMotorcycleStocksFromInvalidUrl_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/allInvalid"; + String url = baseUrl + "service/motorcycle/stock/get/allInvalid"; int expectedResponseStatus = 400; @@ -195,7 +197,7 @@ void getAll_listOfMotorcycleStocksFromInvalidUrl_statusCode400() throws Exceptio @Order(7) void update_motorcycleStockWithValidId_statusCode204() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/update"; + String url = baseUrl + "service/motorcycle/stock/update"; int expectedResponseStatus = 204; @@ -217,7 +219,7 @@ void update_motorcycleStockWithValidId_statusCode204() throws Exception { @Order(8) void update_motorcycleStockWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/update"; + String url = baseUrl + "service/motorcycle/stock/update"; int expectedResponseStatus = 404; @@ -239,7 +241,7 @@ void update_motorcycleStockWithInvalidId_statusCode404() throws Exception { @Order(9) void update_motorcycleStockWithInvalidJson_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/update"; + String url = baseUrl + "service/motorcycle/stock/update"; int expectedResponseStatus = 400; @@ -261,7 +263,7 @@ void update_motorcycleStockWithInvalidJson_statusCode400() throws Exception { @Order(10) void delete_motorcycleStockWithValidId_statusCode204() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/delete/9"; + String url = baseUrl + "service/motorcycle/stock/delete/9"; int expectedResponseStatus = 204; @@ -283,7 +285,7 @@ void delete_motorcycleStockWithValidId_statusCode204() throws Exception { @Order(11) void delete_motorcycleStockWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/delete/99"; + String url = baseUrl + "service/motorcycle/stock/delete/99"; int expectedResponseStatus = 404; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/ManufacturerControllerApiSalesRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/ManufacturerControllerApiSalesRoleTests.java index 870b91b..4fc9df0 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/ManufacturerControllerApiSalesRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/ManufacturerControllerApiSalesRoleTests.java @@ -41,7 +41,7 @@ public class ManufacturerControllerApiSalesRoleTests { @LocalServerPort private int port; - private final String baseUrl = "http://localhost:"; + private String baseUrl; private HttpClient client; private String jwtToken; @@ -50,7 +50,9 @@ public class ManufacturerControllerApiSalesRoleTests { public void initBeforeAll() throws Exception { client = HttpClient.newBuilder().build(); - jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "Sales"); + baseUrl = "http://localhost:" + port + "/"; + + jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "Sales"); } @@ -58,7 +60,7 @@ public void initBeforeAll() throws Exception { @Order(1) void add_newValidManufacturer_statusCode201WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/add"; + String url = baseUrl + "service/manufacturer/add"; int expectedResponseStatus = 201; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Add.json"))); @@ -83,7 +85,7 @@ void add_newValidManufacturer_statusCode201WithProperJson() throws Exception { @Order(2) void add_newInvalidManufacturer_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/add"; + String url = baseUrl + "service/manufacturer/add"; int expectedResponseStatus = 400; @@ -105,7 +107,7 @@ void add_newInvalidManufacturer_statusCode400() throws Exception { @Order(3) void get_manufacturerWithValidId_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/6"; + String url = baseUrl + "service/manufacturer/get/6"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Get.json"))); @@ -130,7 +132,7 @@ void get_manufacturerWithValidId_statusCode200WithProperJson() throws Exception @Order(4) void get_manufacturerWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/55"; + String url = baseUrl + "service/manufacturer/get/55"; int expectedResponseStatus = 404; @@ -152,7 +154,7 @@ void get_manufacturerWithInvalidId_statusCode404() throws Exception { @Order(5) void getAll_listOfManufacturers_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/all"; + String url = baseUrl + "service/manufacturer/get/all"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/GetAll.json"))); @@ -177,7 +179,7 @@ void getAll_listOfManufacturers_statusCode200WithProperJson() throws Exception { @Order(6) void getAll_listOfManufacturersFromInvalidUrl_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/allInvalid"; + String url = baseUrl + "service/manufacturer/get/allInvalid"; int expectedResponseStatus = 400; @@ -199,7 +201,7 @@ void getAll_listOfManufacturersFromInvalidUrl_statusCode400() throws Exception { @Order(7) void update_manufacturerWithValidId_statusCode204() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/update"; + String url = baseUrl + "service/manufacturer/update"; int expectedResponseStatus = 204; @@ -221,7 +223,7 @@ void update_manufacturerWithValidId_statusCode204() throws Exception { @Order(8) void update_manufacturerWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/update"; + String url = baseUrl + "service/manufacturer/update"; int expectedResponseStatus = 404; @@ -243,7 +245,7 @@ void update_manufacturerWithInvalidId_statusCode404() throws Exception { @Order(9) void update_manufacturerWithInvalidJson_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/update"; + String url = baseUrl + "service/manufacturer/update"; int expectedResponseStatus = 400; @@ -265,7 +267,7 @@ void update_manufacturerWithInvalidJson_statusCode400() throws Exception { @Order(10) void delete_manufacturerWithValidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/delete/5"; + String url = baseUrl + "service/manufacturer/delete/5"; int expectedResponseStatus = 403; @@ -287,7 +289,7 @@ void delete_manufacturerWithValidId_statusCode403() throws Exception { @Order(11) void delete_manufacturerWithInvalidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/delete/33"; + String url = baseUrl + "service/manufacturer/delete/33"; int expectedResponseStatus = 403; @@ -309,7 +311,7 @@ void delete_manufacturerWithInvalidId_statusCode403() throws Exception { @Order(12) void delete_manufacturerWithIdHasForeignKeyRestriction_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/delete/1"; + String url = baseUrl + "service/manufacturer/delete/1"; int expectedResponseStatus = 403; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleModelControllerApiSalesRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleModelControllerApiSalesRoleTests.java index eb1712c..ac63de9 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleModelControllerApiSalesRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleModelControllerApiSalesRoleTests.java @@ -41,7 +41,7 @@ public class MotorcycleModelControllerApiSalesRoleTests { @LocalServerPort private int port; - private final String baseUrl = "http://localhost:"; + private String baseUrl; private HttpClient client; private String jwtToken; @@ -50,7 +50,9 @@ public class MotorcycleModelControllerApiSalesRoleTests { public void initBeforeAll() throws Exception { client = HttpClient.newBuilder().build(); - jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "Sales"); + baseUrl = "http://localhost:" + port + "/"; + + jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "Sales"); } @@ -58,7 +60,7 @@ public void initBeforeAll() throws Exception { @Order(1) void add_newValidMotorcycleModel_statusCode201WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/add"; + String url = baseUrl + "service/motorcycle/model/add"; int expectedResponseStatus = 201; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Add.json"))); @@ -83,7 +85,7 @@ void add_newValidMotorcycleModel_statusCode201WithProperJson() throws Exception @Order(2) void add_newInvalidMotorcycleModel_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/add"; + String url = baseUrl + "service/motorcycle/model/add"; int expectedResponseStatus = 400; @@ -105,7 +107,7 @@ void add_newInvalidMotorcycleModel_statusCode400() throws Exception { @Order(3) void get_motorcycleModelWithValidId_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/1"; + String url = baseUrl + "service/motorcycle/model/get/1"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Get.json"))); @@ -130,7 +132,7 @@ void get_motorcycleModelWithValidId_statusCode200WithProperJson() throws Excepti @Order(4) void get_motorcycleModelWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/55"; + String url = baseUrl + "service/motorcycle/model/get/55"; int expectedResponseStatus = 404; @@ -152,7 +154,7 @@ void get_motorcycleModelWithInvalidId_statusCode404() throws Exception { @Order(5) void getAll_listOfMotorcycleModels_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/all"; + String url = baseUrl + "service/motorcycle/model/get/all"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetAll.json"))); @@ -177,7 +179,7 @@ void getAll_listOfMotorcycleModels_statusCode200WithProperJson() throws Exceptio @Order(6) void getAll_listOfMotorcycleModelsFromInvalidUrl_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/allInvalid"; + String url = baseUrl + "service/motorcycle/model/get/allInvalid"; int expectedResponseStatus = 400; @@ -199,7 +201,7 @@ void getAll_listOfMotorcycleModelsFromInvalidUrl_statusCode400() throws Exceptio @Order(7) void update_motorcycleModelWithValidId_statusCode204() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/update"; + String url = baseUrl + "service/motorcycle/model/update"; int expectedResponseStatus = 204; @@ -221,7 +223,7 @@ void update_motorcycleModelWithValidId_statusCode204() throws Exception { @Order(8) void update_motorcycleModelWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/update"; + String url = baseUrl + "service/motorcycle/model/update"; int expectedResponseStatus = 404; @@ -243,7 +245,7 @@ void update_motorcycleModelWithInvalidId_statusCode404() throws Exception { @Order(9) void update_motorcycleModelWithInvalidJson_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/update"; + String url = baseUrl + "service/motorcycle/model/update"; int expectedResponseStatus = 400; @@ -265,7 +267,7 @@ void update_motorcycleModelWithInvalidJson_statusCode400() throws Exception { @Order(10) void delete_motorcycleModelWithValidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/delete/6"; + String url = baseUrl + "service/motorcycle/model/delete/6"; int expectedResponseStatus = 403; @@ -287,7 +289,7 @@ void delete_motorcycleModelWithValidId_statusCode403() throws Exception { @Order(11) void delete_motorcycleModelWithInvalidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/delete/99"; + String url = baseUrl + "service/motorcycle/model/delete/99"; int expectedResponseStatus = 403; @@ -309,7 +311,7 @@ void delete_motorcycleModelWithInvalidId_statusCode403() throws Exception { @Order(12) void delete_motorcycleModelWithIdHasForeignKeyRestriction_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/delete/7"; + String url = baseUrl + "service/motorcycle/model/delete/7"; int expectedResponseStatus = 403; @@ -331,7 +333,7 @@ void delete_motorcycleModelWithIdHasForeignKeyRestriction_statusCode403() throws @Order(13) void get_motorcycleModelTypes_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/types"; + String url = baseUrl + "service/motorcycle/model/get/types"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetMotorcycleModelTypes.json"))); diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleStockControllerApiSalesRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleStockControllerApiSalesRoleTests.java index d5987e8..d6eb56d 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleStockControllerApiSalesRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleStockControllerApiSalesRoleTests.java @@ -41,7 +41,7 @@ public class MotorcycleStockControllerApiSalesRoleTests { @LocalServerPort private int port; - private final String baseUrl = "http://localhost:"; + private String baseUrl; private HttpClient client; private String jwtToken; @@ -50,7 +50,9 @@ public class MotorcycleStockControllerApiSalesRoleTests { public void initBeforeAll() throws Exception { client = HttpClient.newBuilder().build(); - jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "Sales"); + baseUrl = "http://localhost:" + port + "/"; + + jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "Sales"); } @@ -58,7 +60,7 @@ public void initBeforeAll() throws Exception { @Order(1) void add_newValidMotorcycleStock_statusCode201WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/add"; + String url = baseUrl + "service/motorcycle/stock/add"; int expectedResponseStatus = 201; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Add.json"))); @@ -83,7 +85,7 @@ void add_newValidMotorcycleStock_statusCode201WithProperJson() throws Exception @Order(2) void add_newInvalidMotorcycleStock_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/add"; + String url = baseUrl + "service/motorcycle/stock/add"; int expectedResponseStatus = 400; @@ -105,7 +107,7 @@ void add_newInvalidMotorcycleStock_statusCode400() throws Exception { @Order(3) void get_motorcycleStockWithValidId_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/8"; + String url = baseUrl + "service/motorcycle/stock/get/8"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Get.json"))); @@ -130,7 +132,7 @@ void get_motorcycleStockWithValidId_statusCode200WithProperJson() throws Excepti @Order(4) void get_motorcycleStockWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/55"; + String url = baseUrl + "service/motorcycle/stock/get/55"; int expectedResponseStatus = 404; @@ -152,7 +154,7 @@ void get_motorcycleStockWithInvalidId_statusCode404() throws Exception { @Order(5) void getAll_listOfMotorcycleStocks_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/all"; + String url = baseUrl + "service/motorcycle/stock/get/all"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/GetAll.json"))); @@ -177,7 +179,7 @@ void getAll_listOfMotorcycleStocks_statusCode200WithProperJson() throws Exceptio @Order(6) void getAll_listOfMotorcycleStocksFromInvalidUrl_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/allInvalid"; + String url = baseUrl + "service/motorcycle/stock/get/allInvalid"; int expectedResponseStatus = 400; @@ -199,7 +201,7 @@ void getAll_listOfMotorcycleStocksFromInvalidUrl_statusCode400() throws Exceptio @Order(7) void update_motorcycleStockWithValidId_statusCode204() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/update"; + String url = baseUrl + "service/motorcycle/stock/update"; int expectedResponseStatus = 204; @@ -221,7 +223,7 @@ void update_motorcycleStockWithValidId_statusCode204() throws Exception { @Order(8) void update_motorcycleStockWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/update"; + String url = baseUrl + "service/motorcycle/stock/update"; int expectedResponseStatus = 404; @@ -243,7 +245,7 @@ void update_motorcycleStockWithInvalidId_statusCode404() throws Exception { @Order(9) void update_motorcycleStockWithInvalidJson_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/update"; + String url = baseUrl + "service/motorcycle/stock/update"; int expectedResponseStatus = 400; @@ -265,7 +267,7 @@ void update_motorcycleStockWithInvalidJson_statusCode400() throws Exception { @Order(10) void delete_motorcycleStockWithValidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/delete/9"; + String url = baseUrl + "service/motorcycle/stock/delete/9"; int expectedResponseStatus = 403; @@ -287,7 +289,7 @@ void delete_motorcycleStockWithValidId_statusCode403() throws Exception { @Order(11) void delete_motorcycleStockWithInvalidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/delete/99"; + String url = baseUrl + "service/motorcycle/stock/delete/99"; int expectedResponseStatus = 403; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/ManufacturerControllerApiUserRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/ManufacturerControllerApiUserRoleTests.java index 43ba01f..2eedce7 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/ManufacturerControllerApiUserRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/ManufacturerControllerApiUserRoleTests.java @@ -41,7 +41,7 @@ public class ManufacturerControllerApiUserRoleTests { @LocalServerPort private int port; - private final String baseUrl = "http://localhost:"; + private String baseUrl; private HttpClient client; private String jwtToken; @@ -50,7 +50,9 @@ public class ManufacturerControllerApiUserRoleTests { public void initBeforeAll() throws Exception { client = HttpClient.newBuilder().build(); - jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "User"); + baseUrl = "http://localhost:" + port + "/"; + + jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "User"); } @@ -58,7 +60,7 @@ public void initBeforeAll() throws Exception { @Order(1) void add_newValidManufacturer_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/add"; + String url = baseUrl + "service/manufacturer/add"; int expectedResponseStatus = 403; @@ -80,7 +82,7 @@ void add_newValidManufacturer_statusCode403() throws Exception { @Order(2) void add_newInvalidManufacturer_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/add"; + String url = baseUrl + "service/manufacturer/add"; int expectedResponseStatus = 403; @@ -102,7 +104,7 @@ void add_newInvalidManufacturer_statusCode403() throws Exception { @Order(3) void get_manufacturerWithValidId_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/6"; + String url = baseUrl + "service/manufacturer/get/6"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Get.json"))); @@ -127,7 +129,7 @@ void get_manufacturerWithValidId_statusCode200WithProperJson() throws Exception @Order(4) void get_manufacturerWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/55"; + String url = baseUrl + "service/manufacturer/get/55"; int expectedResponseStatus = 404; @@ -149,7 +151,7 @@ void get_manufacturerWithInvalidId_statusCode404() throws Exception { @Order(5) void getAll_listOfManufacturers_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/all"; + String url = baseUrl + "service/manufacturer/get/all"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/GetAll.json"))); @@ -174,7 +176,7 @@ void getAll_listOfManufacturers_statusCode200WithProperJson() throws Exception { @Order(6) void getAll_listOfManufacturersFromInvalidUrl_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/get/allInvalid"; + String url = baseUrl + "service/manufacturer/get/allInvalid"; int expectedResponseStatus = 400; @@ -196,7 +198,7 @@ void getAll_listOfManufacturersFromInvalidUrl_statusCode400() throws Exception { @Order(7) void update_manufacturerWithValidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/update"; + String url = baseUrl + "service/manufacturer/update"; int expectedResponseStatus = 403; @@ -218,7 +220,7 @@ void update_manufacturerWithValidId_statusCode403() throws Exception { @Order(8) void update_manufacturerWithInvalidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/update"; + String url = baseUrl + "service/manufacturer/update"; int expectedResponseStatus = 403; @@ -240,7 +242,7 @@ void update_manufacturerWithInvalidId_statusCode403() throws Exception { @Order(9) void update_manufacturerWithInvalidJson_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/update"; + String url = baseUrl + "service/manufacturer/update"; int expectedResponseStatus = 403; @@ -262,7 +264,7 @@ void update_manufacturerWithInvalidJson_statusCode403() throws Exception { @Order(10) void delete_manufacturerWithValidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/delete/5"; + String url = baseUrl + "service/manufacturer/delete/5"; int expectedResponseStatus = 403; @@ -284,7 +286,7 @@ void delete_manufacturerWithValidId_statusCode403() throws Exception { @Order(11) void delete_manufacturerWithInvalidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/delete/33"; + String url = baseUrl + "service/manufacturer/delete/33"; int expectedResponseStatus = 403; @@ -306,7 +308,7 @@ void delete_manufacturerWithInvalidId_statusCode403() throws Exception { @Order(12) void delete_manufacturerWithIdHasForeignKeyRestriction_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/manufacturer/delete/1"; + String url = baseUrl + "service/manufacturer/delete/1"; int expectedResponseStatus = 403; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleModelControllerApiUserRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleModelControllerApiUserRoleTests.java index 1c1311b..0914e90 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleModelControllerApiUserRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleModelControllerApiUserRoleTests.java @@ -41,7 +41,7 @@ public class MotorcycleModelControllerApiUserRoleTests { @LocalServerPort private int port; - private final String baseUrl = "http://localhost:"; + private String baseUrl; private HttpClient client; private String jwtToken; @@ -50,7 +50,9 @@ public class MotorcycleModelControllerApiUserRoleTests { public void initBeforeAll() throws Exception { client = HttpClient.newBuilder().build(); - jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "User"); + baseUrl = "http://localhost:" + port + "/"; + + jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "User"); } @@ -58,7 +60,7 @@ public void initBeforeAll() throws Exception { @Order(1) void add_newValidMotorcycleModel_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/add"; + String url = baseUrl + "service/motorcycle/model/add"; int expectedResponseStatus = 403; @@ -80,7 +82,7 @@ void add_newValidMotorcycleModel_statusCode403() throws Exception { @Order(2) void add_newInvalidMotorcycleModel_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/add"; + String url = baseUrl + "service/motorcycle/model/add"; int expectedResponseStatus = 403; @@ -102,7 +104,7 @@ void add_newInvalidMotorcycleModel_statusCode403() throws Exception { @Order(3) void get_motorcycleModelWithValidId_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/1"; + String url = baseUrl + "service/motorcycle/model/get/1"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Get.json"))); @@ -129,7 +131,7 @@ void get_motorcycleModelWithValidId_statusCode200WithProperJson() throws Excepti @Order(4) void get_motorcycleModelWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/55"; + String url = baseUrl + "service/motorcycle/model/get/55"; int expectedResponseStatus = 404; @@ -151,7 +153,7 @@ void get_motorcycleModelWithInvalidId_statusCode404() throws Exception { @Order(5) void getAll_listOfMotorcycleModels_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/all"; + String url = baseUrl + "service/motorcycle/model/get/all"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetAll.json"))); @@ -176,7 +178,7 @@ void getAll_listOfMotorcycleModels_statusCode200WithProperJson() throws Exceptio @Order(6) void getAll_listOfMotorcycleModelsFromInvalidUrl_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/allInvalid"; + String url = baseUrl + "service/motorcycle/model/get/allInvalid"; int expectedResponseStatus = 400; @@ -198,7 +200,7 @@ void getAll_listOfMotorcycleModelsFromInvalidUrl_statusCode400() throws Exceptio @Order(7) void update_motorcycleModelWithValidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/update"; + String url = baseUrl + "service/motorcycle/model/update"; int expectedResponseStatus = 403; @@ -220,7 +222,7 @@ void update_motorcycleModelWithValidId_statusCode403() throws Exception { @Order(8) void update_motorcycleModelWithInvalidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/update"; + String url = baseUrl + "service/motorcycle/model/update"; int expectedResponseStatus = 403; @@ -242,7 +244,7 @@ void update_motorcycleModelWithInvalidId_statusCode403() throws Exception { @Order(9) void update_motorcycleModelWithInvalidJson_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/update"; + String url = baseUrl + "service/motorcycle/model/update"; int expectedResponseStatus = 403; @@ -264,7 +266,7 @@ void update_motorcycleModelWithInvalidJson_statusCode403() throws Exception { @Order(10) void delete_motorcycleModelWithValidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/delete/6"; + String url = baseUrl + "service/motorcycle/model/delete/6"; int expectedResponseStatus = 403; @@ -286,7 +288,7 @@ void delete_motorcycleModelWithValidId_statusCode403() throws Exception { @Order(11) void delete_motorcycleModelWithInvalidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/delete/99"; + String url = baseUrl + "service/motorcycle/model/delete/99"; int expectedResponseStatus = 403; @@ -308,7 +310,7 @@ void delete_motorcycleModelWithInvalidId_statusCode403() throws Exception { @Order(12) void delete_motorcycleModelWithIdHasForeignKeyRestriction_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/delete/7"; + String url = baseUrl + "service/motorcycle/model/delete/7"; int expectedResponseStatus = 403; @@ -330,7 +332,7 @@ void delete_motorcycleModelWithIdHasForeignKeyRestriction_statusCode403() throws @Order(13) void get_motorcycleModelTypes_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/model/get/types"; + String url = baseUrl + "service/motorcycle/model/get/types"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetMotorcycleModelTypes.json"))); diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleStockControllerApiUserRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleStockControllerApiUserRoleTests.java index 73223df..cfd0ddd 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleStockControllerApiUserRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleStockControllerApiUserRoleTests.java @@ -41,7 +41,7 @@ public class MotorcycleStockControllerApiUserRoleTests { @LocalServerPort private int port; - private final String baseUrl = "http://localhost:"; + private String baseUrl; private HttpClient client; private String jwtToken; @@ -50,7 +50,9 @@ public class MotorcycleStockControllerApiUserRoleTests { public void initBeforeAll() throws Exception { client = HttpClient.newBuilder().build(); - jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, port, client, "User"); + baseUrl = "http://localhost:" + port + "/"; + + jwtToken = EndToEndTestUtil.retrieveJwtToken(baseUrl, client, "User"); } @@ -58,7 +60,7 @@ public void initBeforeAll() throws Exception { @Order(1) void add_newValidMotorcycleStock_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/add"; + String url = baseUrl + "service/motorcycle/stock/add"; int expectedResponseStatus = 403; @@ -80,7 +82,7 @@ void add_newValidMotorcycleStock_statusCode403() throws Exception { @Order(2) void add_newInvalidMotorcycleStock_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/add"; + String url = baseUrl + "service/motorcycle/stock/add"; int expectedResponseStatus = 403; @@ -102,7 +104,7 @@ void add_newInvalidMotorcycleStock_statusCode403() throws Exception { @Order(3) void get_motorcycleStockWithValidId_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/8"; + String url = baseUrl + "service/motorcycle/stock/get/8"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Get.json"))); @@ -127,7 +129,7 @@ void get_motorcycleStockWithValidId_statusCode200WithProperJson() throws Excepti @Order(4) void get_motorcycleStockWithInvalidId_statusCode404() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/55"; + String url = baseUrl + "service/motorcycle/stock/get/55"; int expectedResponseStatus = 404; @@ -149,7 +151,7 @@ void get_motorcycleStockWithInvalidId_statusCode404() throws Exception { @Order(5) void getAll_listOfMotorcycleStocks_statusCode200WithProperJson() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/all"; + String url = baseUrl + "service/motorcycle/stock/get/all"; int expectedResponseStatus = 200; String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/GetAll.json"))); @@ -174,7 +176,7 @@ void getAll_listOfMotorcycleStocks_statusCode200WithProperJson() throws Exceptio @Order(6) void getAll_listOfMotorcycleStocksFromInvalidUrl_statusCode400() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/get/allInvalid"; + String url = baseUrl + "service/motorcycle/stock/get/allInvalid"; int expectedResponseStatus = 400; @@ -196,7 +198,7 @@ void getAll_listOfMotorcycleStocksFromInvalidUrl_statusCode400() throws Exceptio @Order(7) void update_motorcycleStockWithValidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/update"; + String url = baseUrl + "service/motorcycle/stock/update"; int expectedResponseStatus = 403; @@ -218,7 +220,7 @@ void update_motorcycleStockWithValidId_statusCode403() throws Exception { @Order(8) void update_motorcycleStockWithInvalidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/update"; + String url = baseUrl + "service/motorcycle/stock/update"; int expectedResponseStatus = 403; @@ -240,7 +242,7 @@ void update_motorcycleStockWithInvalidId_statusCode403() throws Exception { @Order(9) void update_motorcycleStockWithInvalidJson_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/update"; + String url = baseUrl + "service/motorcycle/stock/update"; int expectedResponseStatus = 403; @@ -262,7 +264,7 @@ void update_motorcycleStockWithInvalidJson_statusCode403() throws Exception { @Order(10) void delete_motorcycleStockWithValidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/delete/9"; + String url = baseUrl + "service/motorcycle/stock/delete/9"; int expectedResponseStatus = 403; @@ -284,7 +286,7 @@ void delete_motorcycleStockWithValidId_statusCode403() throws Exception { @Order(11) void delete_motorcycleStockWithInvalidId_statusCode403() throws Exception { // Arrange - String url = baseUrl + port + "/motorcycle/stock/delete/99"; + String url = baseUrl + "service/motorcycle/stock/delete/99"; int expectedResponseStatus = 403; From ab9ea51e676cb537ded7d683db4f682a9219a5c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rdos=20Istv=C3=A1n?= Date: Tue, 13 Feb 2024 09:49:08 +0100 Subject: [PATCH 5/9] Update motoShop.postman_collection.json Update HTTP requests according to new routing policy. --- .../motoShop.postman_collection.json | 256 +++++++----------- 1 file changed, 103 insertions(+), 153 deletions(-) diff --git a/src/test/resources/motoShop.postman_collection.json b/src/test/resources/motoShop.postman_collection.json index 53cad16..6f4510d 100644 --- a/src/test/resources/motoShop.postman_collection.json +++ b/src/test/resources/motoShop.postman_collection.json @@ -34,12 +34,11 @@ } }, "url": { - "raw": "{{base_url}}/authentication/login", + "raw": "{{base_url}}authentication/login", "host": [ - "{{base_url}}" + "{{base_url}}authentication" ], "path": [ - "authentication", "login" ] } @@ -64,12 +63,11 @@ } }, "url": { - "raw": "{{base_url}}/authentication/login", + "raw": "{{base_url}}authentication/login", "host": [ - "{{base_url}}" + "{{base_url}}authentication" ], "path": [ - "authentication", "login" ] } @@ -94,12 +92,11 @@ } }, "url": { - "raw": "{{base_url}}/authentication/login", + "raw": "{{base_url}}authentication/login", "host": [ - "{{base_url}}" + "{{base_url}}authentication" ], "path": [ - "authentication", "login" ] } @@ -114,16 +111,6 @@ { "name": "register_user_role", "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "", - "type": "string" - } - ] - }, "method": "POST", "header": [], "body": { @@ -136,12 +123,11 @@ } }, "url": { - "raw": "{{base_url}}/authentication/register", + "raw": "{{base_url}}authentication/register", "host": [ - "{{base_url}}" + "{{base_url}}authentication" ], "path": [ - "authentication", "register" ] } @@ -151,16 +137,6 @@ { "name": "register_sales_role", "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "", - "type": "string" - } - ] - }, "method": "POST", "header": [], "body": { @@ -173,12 +149,11 @@ } }, "url": { - "raw": "{{base_url}}/authentication/register", + "raw": "{{base_url}}authentication/register", "host": [ - "{{base_url}}" + "{{base_url}}authentication" ], "path": [ - "authentication", "register" ] } @@ -188,16 +163,6 @@ { "name": "register_admin_role", "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "", - "type": "string" - } - ] - }, "method": "POST", "header": [], "body": { @@ -210,12 +175,11 @@ } }, "url": { - "raw": "{{base_url}}/authentication/register", + "raw": "{{base_url}}authentication/register", "host": [ - "{{base_url}}" + "{{base_url}}authentication" ], "path": [ - "authentication", "register" ] } @@ -250,12 +214,11 @@ } }, "url": { - "raw": "{{base_url}}/authentication/login", + "raw": "{{base_url}}authentication/login", "host": [ - "{{base_url}}" + "{{base_url}}authentication" ], "path": [ - "authentication", "login" ] } @@ -280,12 +243,11 @@ } }, "url": { - "raw": "{{base_url}}/authentication/login", + "raw": "{{base_url}}authentication/login", "host": [ - "{{base_url}}" + "{{base_url}}authentication" ], "path": [ - "authentication", "login" ] } @@ -300,16 +262,6 @@ { "name": "register_invalid_user", "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "", - "type": "string" - } - ] - }, "method": "POST", "header": [], "body": { @@ -322,12 +274,11 @@ } }, "url": { - "raw": "{{base_url}}/authentication/register", + "raw": "{{base_url}}authentication/register", "host": [ - "{{base_url}}" + "{{base_url}}authentication" ], "path": [ - "authentication", "register" ] } @@ -337,16 +288,6 @@ { "name": "register_empty_body", "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "", - "type": "string" - } - ] - }, "method": "POST", "header": [], "body": { @@ -359,12 +300,11 @@ } }, "url": { - "raw": "{{base_url}}/authentication/register", + "raw": "{{base_url}}authentication/register", "host": [ - "{{base_url}}" + "{{base_url}}authentication" ], "path": [ - "authentication", "register" ] } @@ -398,9 +338,9 @@ } }, "url": { - "raw": "{{base_url}}/manufacturer/add", + "raw": "{{base_url}}service/manufacturer/add", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -416,9 +356,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/manufacturer/get/6", + "raw": "{{base_url}}service/manufacturer/get/6", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -435,9 +375,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/manufacturer/get/all", + "raw": "{{base_url}}service/manufacturer/get/all", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -463,9 +403,9 @@ } }, "url": { - "raw": "{{base_url}}/manufacturer/update", + "raw": "{{base_url}}service/manufacturer/update", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -481,9 +421,9 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{base_url}}/manufacturer/delete/5", + "raw": "{{base_url}}service/manufacturer/delete/5", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -514,9 +454,9 @@ } }, "url": { - "raw": "{{base_url}}/manufacturer/add", + "raw": "{{base_url}}service/manufacturer/add", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -532,9 +472,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/manufacturer/get/55", + "raw": "{{base_url}}service/manufacturer/get/55", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -551,9 +491,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/manufacturer/get/allInvalid", + "raw": "{{base_url}}service/manufacturer/get/allInvalid", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -579,9 +519,9 @@ } }, "url": { - "raw": "{{base_url}}/manufacturer/update", + "raw": "{{base_url}}service/manufacturer/update", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -606,9 +546,9 @@ } }, "url": { - "raw": "{{base_url}}/manufacturer/update", + "raw": "{{base_url}}service/manufacturer/update", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -624,9 +564,9 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{base_url}}/manufacturer/delete/33", + "raw": "{{base_url}}service/manufacturer/delete/33", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -643,9 +583,9 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{base_url}}/manufacturer/delete/1", + "raw": "{{base_url}}service/manufacturer/delete/1", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "manufacturer", @@ -682,9 +622,9 @@ } }, "url": { - "raw": "{{base_url}}/motorcycle/model/add", + "raw": "{{base_url}}service/motorcycle/model/add", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -701,9 +641,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/model/get/1", + "raw": "{{base_url}}service/motorcycle/model/get/1", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -721,9 +661,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/model/get/types", + "raw": "{{base_url}}service/motorcycle/model/get/types", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -741,9 +681,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/model/get/all", + "raw": "{{base_url}}service/motorcycle/model/get/all", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -770,9 +710,9 @@ } }, "url": { - "raw": "{{base_url}}/motorcycle/model/update", + "raw": "{{base_url}}service/motorcycle/model/update", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -789,9 +729,9 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/model/delete/6", + "raw": "{{base_url}}service/motorcycle/model/delete/6", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -823,9 +763,9 @@ } }, "url": { - "raw": "{{base_url}}/motorcycle/model/add", + "raw": "{{base_url}}service/motorcycle/model/add", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -842,9 +782,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/model/get/55", + "raw": "{{base_url}}service/motorcycle/model/get/55", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -862,9 +802,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/model/get/allInvalid", + "raw": "{{base_url}}service/motorcycle/model/get/allInvalid", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -891,9 +831,9 @@ } }, "url": { - "raw": "{{base_url}}/motorcycle/model/update", + "raw": "{{base_url}}service/motorcycle/model/update", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -919,9 +859,9 @@ } }, "url": { - "raw": "{{base_url}}/motorcycle/model/update", + "raw": "{{base_url}}service/motorcycle/model/update", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -938,9 +878,9 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/model/delete/99", + "raw": "{{base_url}}service/motorcycle/model/delete/99", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -958,9 +898,9 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/model/delete/7", + "raw": "{{base_url}}service/motorcycle/model/delete/7", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -998,9 +938,9 @@ } }, "url": { - "raw": "{{base_url}}/motorcycle/stock/add", + "raw": "{{base_url}}service/motorcycle/stock/add", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1017,9 +957,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/stock/get/8", + "raw": "{{base_url}}service/motorcycle/stock/get/8", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1037,9 +977,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/stock/get/all", + "raw": "{{base_url}}service/motorcycle/stock/get/all", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1066,9 +1006,9 @@ } }, "url": { - "raw": "{{base_url}}/motorcycle/stock/update", + "raw": "{{base_url}}service/motorcycle/stock/update", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1085,9 +1025,9 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/stock/delete/9", + "raw": "{{base_url}}service/motorcycle/stock/delete/9", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1119,9 +1059,9 @@ } }, "url": { - "raw": "{{base_url}}/motorcycle/stock/add", + "raw": "{{base_url}}service/motorcycle/stock/add", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1138,9 +1078,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/stock/get/55", + "raw": "{{base_url}}service/motorcycle/stock/get/55", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1158,9 +1098,9 @@ "method": "GET", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/stock/get/allInvalid", + "raw": "{{base_url}}service/motorcycle/stock/get/allInvalid", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1187,9 +1127,9 @@ } }, "url": { - "raw": "{{base_url}}/motorcycle/stock/update", + "raw": "{{base_url}}service/motorcycle/stock/update", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1215,9 +1155,9 @@ } }, "url": { - "raw": "{{base_url}}/motorcycle/stock/update", + "raw": "{{base_url}}service/motorcycle/stock/update", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1234,9 +1174,9 @@ "method": "DELETE", "header": [], "url": { - "raw": "{{base_url}}/motorcycle/stock/delete/99", + "raw": "{{base_url}}service/motorcycle/stock/delete/99", "host": [ - "{{base_url}}" + "{{base_url}}service" ], "path": [ "motorcycle", @@ -1254,6 +1194,16 @@ "description": "This folder is for testing Motorcycle model related APIs." } ], + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "", + "type": "string" + } + ] + }, "event": [ { "listen": "prerequest", @@ -1277,7 +1227,7 @@ "variable": [ { "key": "base_url", - "value": "http://localhost:8080", + "value": "http://localhost:8080/", "type": "string" } ] From b589d510b569e3acec206236d62cb26fe631598e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rdos=20Istv=C3=A1n?= Date: Tue, 13 Feb 2024 09:59:18 +0100 Subject: [PATCH 6/9] Change test package naming to make it consistent with new routing policy --- .../adminRole/ManufacturerControllerApiAdminRoleTests.java | 6 +----- .../MotorcycleModelControllerApiAdminRoleTests.java | 6 +----- .../MotorcycleStockControllerApiAdminRoleTests.java | 6 +----- .../salesRole/ManufacturerControllerApiSalesRoleTests.java | 6 +----- .../MotorcycleModelControllerApiSalesRoleTests.java | 6 +----- .../MotorcycleStockControllerApiSalesRoleTests.java | 6 +----- .../userRole/ManufacturerControllerApiUserRoleTests.java | 6 +----- .../userRole/MotorcycleModelControllerApiUserRoleTests.java | 6 +----- .../userRole/MotorcycleStockControllerApiUserRoleTests.java | 6 +----- 9 files changed, 9 insertions(+), 45 deletions(-) rename src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/{erpCore => service}/adminRole/ManufacturerControllerApiAdminRoleTests.java (98%) rename src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/{erpCore => service}/adminRole/MotorcycleModelControllerApiAdminRoleTests.java (99%) rename src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/{erpCore => service}/adminRole/MotorcycleStockControllerApiAdminRoleTests.java (98%) rename src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/{erpCore => service}/salesRole/ManufacturerControllerApiSalesRoleTests.java (98%) rename src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/{erpCore => service}/salesRole/MotorcycleModelControllerApiSalesRoleTests.java (99%) rename src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/{erpCore => service}/salesRole/MotorcycleStockControllerApiSalesRoleTests.java (98%) rename src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/{erpCore => service}/userRole/ManufacturerControllerApiUserRoleTests.java (98%) rename src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/{erpCore => service}/userRole/MotorcycleModelControllerApiUserRoleTests.java (99%) rename src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/{erpCore => service}/userRole/MotorcycleStockControllerApiUserRoleTests.java (98%) diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/ManufacturerControllerApiAdminRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/ManufacturerControllerApiAdminRoleTests.java similarity index 98% rename from src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/ManufacturerControllerApiAdminRoleTests.java rename to src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/ManufacturerControllerApiAdminRoleTests.java index 056b689..fd69c39 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/ManufacturerControllerApiAdminRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/ManufacturerControllerApiAdminRoleTests.java @@ -1,10 +1,8 @@ -package com.ibardos.motoShop.endToEndTest.apiTest.erpCore.adminRole; +package com.ibardos.motoShop.endToEndTest.apiTest.service.adminRole; import com.ibardos.motoShop.endToEndTest.util.EndToEndTestUtil; import jakarta.annotation.PostConstruct; -import org.json.JSONException; - import org.junit.jupiter.api.*; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -16,8 +14,6 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.jdbc.Sql; -import java.io.IOException; - import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleModelControllerApiAdminRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleModelControllerApiAdminRoleTests.java similarity index 99% rename from src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleModelControllerApiAdminRoleTests.java rename to src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleModelControllerApiAdminRoleTests.java index 064447d..6718eae 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleModelControllerApiAdminRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleModelControllerApiAdminRoleTests.java @@ -1,10 +1,8 @@ -package com.ibardos.motoShop.endToEndTest.apiTest.erpCore.adminRole; +package com.ibardos.motoShop.endToEndTest.apiTest.service.adminRole; import com.ibardos.motoShop.endToEndTest.util.EndToEndTestUtil; import jakarta.annotation.PostConstruct; -import org.json.JSONException; - import org.junit.jupiter.api.*; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -16,8 +14,6 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.jdbc.Sql; -import java.io.IOException; - import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleStockControllerApiAdminRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleStockControllerApiAdminRoleTests.java similarity index 98% rename from src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleStockControllerApiAdminRoleTests.java rename to src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleStockControllerApiAdminRoleTests.java index 7e00f6a..9763f02 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/adminRole/MotorcycleStockControllerApiAdminRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleStockControllerApiAdminRoleTests.java @@ -1,10 +1,8 @@ -package com.ibardos.motoShop.endToEndTest.apiTest.erpCore.adminRole; +package com.ibardos.motoShop.endToEndTest.apiTest.service.adminRole; import com.ibardos.motoShop.endToEndTest.util.EndToEndTestUtil; import jakarta.annotation.PostConstruct; -import org.json.JSONException; - import org.junit.jupiter.api.*; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -16,8 +14,6 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.jdbc.Sql; -import java.io.IOException; - import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/ManufacturerControllerApiSalesRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/ManufacturerControllerApiSalesRoleTests.java similarity index 98% rename from src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/ManufacturerControllerApiSalesRoleTests.java rename to src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/ManufacturerControllerApiSalesRoleTests.java index 4fc9df0..c4d31b1 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/ManufacturerControllerApiSalesRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/ManufacturerControllerApiSalesRoleTests.java @@ -1,11 +1,9 @@ -package com.ibardos.motoShop.endToEndTest.apiTest.erpCore.salesRole; +package com.ibardos.motoShop.endToEndTest.apiTest.service.salesRole; import com.ibardos.motoShop.endToEndTest.util.EndToEndTestUtil; import jakarta.annotation.PostConstruct; -import org.json.JSONException; - import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -18,8 +16,6 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.jdbc.Sql; -import java.io.IOException; - import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleModelControllerApiSalesRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleModelControllerApiSalesRoleTests.java similarity index 99% rename from src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleModelControllerApiSalesRoleTests.java rename to src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleModelControllerApiSalesRoleTests.java index ac63de9..bd9d91d 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleModelControllerApiSalesRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleModelControllerApiSalesRoleTests.java @@ -1,11 +1,9 @@ -package com.ibardos.motoShop.endToEndTest.apiTest.erpCore.salesRole; +package com.ibardos.motoShop.endToEndTest.apiTest.service.salesRole; import com.ibardos.motoShop.endToEndTest.util.EndToEndTestUtil; import jakarta.annotation.PostConstruct; -import org.json.JSONException; - import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -18,8 +16,6 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.jdbc.Sql; -import java.io.IOException; - import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleStockControllerApiSalesRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleStockControllerApiSalesRoleTests.java similarity index 98% rename from src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleStockControllerApiSalesRoleTests.java rename to src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleStockControllerApiSalesRoleTests.java index d6eb56d..c95d3ac 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/salesRole/MotorcycleStockControllerApiSalesRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleStockControllerApiSalesRoleTests.java @@ -1,11 +1,9 @@ -package com.ibardos.motoShop.endToEndTest.apiTest.erpCore.salesRole; +package com.ibardos.motoShop.endToEndTest.apiTest.service.salesRole; import com.ibardos.motoShop.endToEndTest.util.EndToEndTestUtil; import jakarta.annotation.PostConstruct; -import org.json.JSONException; - import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -18,8 +16,6 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.jdbc.Sql; -import java.io.IOException; - import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/ManufacturerControllerApiUserRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/ManufacturerControllerApiUserRoleTests.java similarity index 98% rename from src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/ManufacturerControllerApiUserRoleTests.java rename to src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/ManufacturerControllerApiUserRoleTests.java index 2eedce7..75c6feb 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/ManufacturerControllerApiUserRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/ManufacturerControllerApiUserRoleTests.java @@ -1,11 +1,9 @@ -package com.ibardos.motoShop.endToEndTest.apiTest.erpCore.userRole; +package com.ibardos.motoShop.endToEndTest.apiTest.service.userRole; import com.ibardos.motoShop.endToEndTest.util.EndToEndTestUtil; import jakarta.annotation.PostConstruct; -import org.json.JSONException; - import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -18,8 +16,6 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.jdbc.Sql; -import java.io.IOException; - import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleModelControllerApiUserRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleModelControllerApiUserRoleTests.java similarity index 99% rename from src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleModelControllerApiUserRoleTests.java rename to src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleModelControllerApiUserRoleTests.java index 0914e90..2499164 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleModelControllerApiUserRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleModelControllerApiUserRoleTests.java @@ -1,11 +1,9 @@ -package com.ibardos.motoShop.endToEndTest.apiTest.erpCore.userRole; +package com.ibardos.motoShop.endToEndTest.apiTest.service.userRole; import com.ibardos.motoShop.endToEndTest.util.EndToEndTestUtil; import jakarta.annotation.PostConstruct; -import org.json.JSONException; - import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -18,8 +16,6 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.jdbc.Sql; -import java.io.IOException; - import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleStockControllerApiUserRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleStockControllerApiUserRoleTests.java similarity index 98% rename from src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleStockControllerApiUserRoleTests.java rename to src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleStockControllerApiUserRoleTests.java index cfd0ddd..f1ee2c0 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/erpCore/userRole/MotorcycleStockControllerApiUserRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleStockControllerApiUserRoleTests.java @@ -1,11 +1,9 @@ -package com.ibardos.motoShop.endToEndTest.apiTest.erpCore.userRole; +package com.ibardos.motoShop.endToEndTest.apiTest.service.userRole; import com.ibardos.motoShop.endToEndTest.util.EndToEndTestUtil; import jakarta.annotation.PostConstruct; -import org.json.JSONException; - import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; @@ -18,8 +16,6 @@ import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.context.jdbc.Sql; -import java.io.IOException; - import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; From d0c2ecb7dbf40140924f1ddc6196b201c3033c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rdos=20Istv=C3=A1n?= Date: Tue, 13 Feb 2024 10:09:38 +0100 Subject: [PATCH 7/9] Change test package naming and structure for json files to make it consistent with new routing policy --- .../authentication/login/request}/LoginAdminRole.json | 0 .../authentication/login/request}/LoginEmptyBody.json | 0 .../login/request}/LoginInvalidApplicationUser.json | 0 .../authentication/login/request}/LoginSalesRole.json | 0 .../authentication/login/request}/LoginUserRole.json | 0 .../register/request}/RegisterNewEmptyBodyApplicationUser.json | 0 .../register/request}/RegisterNewInvalidApplicationUser.json | 0 .../request}/RegisterNewValidApplicationUserWithAdminRole.json | 0 .../request}/RegisterNewValidApplicationUserWithSalesRole.json | 0 .../request}/RegisterNewValidApplicationUserWithUserRole.json | 0 .../service}/manufacturer/request/AddInvalid.json | 0 .../service}/manufacturer/request/AddValid.json | 0 .../service}/manufacturer/request/UpdateInvalidId.json | 0 .../service}/manufacturer/request/UpdateInvalidJson.json | 0 .../service}/manufacturer/request/UpdateValid.json | 0 .../service}/manufacturer/response/Add.json | 0 .../service}/manufacturer/response/Get.json | 0 .../service}/manufacturer/response/GetAll.json | 0 .../service}/motorcycleModel/request/AddInvalid.json | 0 .../service}/motorcycleModel/request/AddValid.json | 0 .../service}/motorcycleModel/request/UpdateInvalidId.json | 0 .../service}/motorcycleModel/request/UpdateInvalidJson.json | 0 .../service}/motorcycleModel/request/UpdateValid.json | 0 .../service}/motorcycleModel/response/Add.json | 0 .../service}/motorcycleModel/response/Get.json | 0 .../service}/motorcycleModel/response/GetAll.json | 0 .../motorcycleModel/response/GetMotorcycleModelTypes.json | 0 .../service}/motorcycleStock/request/AddInvalid.json | 0 .../service}/motorcycleStock/request/AddValid.json | 0 .../service}/motorcycleStock/request/UpdateInvalidId.json | 0 .../service}/motorcycleStock/request/UpdateInvalidJson.json | 0 .../service}/motorcycleStock/request/UpdateValid.json | 0 .../service}/motorcycleStock/response/Add.json | 0 .../service}/motorcycleStock/response/Get.json | 0 .../service}/motorcycleStock/response/GetAll.json | 0 35 files changed, 0 insertions(+), 0 deletions(-) rename src/test/resources/{jsonsForEndToEndTests/authentication/request/login => jsonForEndToEndTest/authentication/login/request}/LoginAdminRole.json (100%) rename src/test/resources/{jsonsForEndToEndTests/authentication/request/login => jsonForEndToEndTest/authentication/login/request}/LoginEmptyBody.json (100%) rename src/test/resources/{jsonsForEndToEndTests/authentication/request/login => jsonForEndToEndTest/authentication/login/request}/LoginInvalidApplicationUser.json (100%) rename src/test/resources/{jsonsForEndToEndTests/authentication/request/login => jsonForEndToEndTest/authentication/login/request}/LoginSalesRole.json (100%) rename src/test/resources/{jsonsForEndToEndTests/authentication/request/login => jsonForEndToEndTest/authentication/login/request}/LoginUserRole.json (100%) rename src/test/resources/{jsonsForEndToEndTests/authentication/request/register => jsonForEndToEndTest/authentication/register/request}/RegisterNewEmptyBodyApplicationUser.json (100%) rename src/test/resources/{jsonsForEndToEndTests/authentication/request/register => jsonForEndToEndTest/authentication/register/request}/RegisterNewInvalidApplicationUser.json (100%) rename src/test/resources/{jsonsForEndToEndTests/authentication/request/register => jsonForEndToEndTest/authentication/register/request}/RegisterNewValidApplicationUserWithAdminRole.json (100%) rename src/test/resources/{jsonsForEndToEndTests/authentication/request/register => jsonForEndToEndTest/authentication/register/request}/RegisterNewValidApplicationUserWithSalesRole.json (100%) rename src/test/resources/{jsonsForEndToEndTests/authentication/request/register => jsonForEndToEndTest/authentication/register/request}/RegisterNewValidApplicationUserWithUserRole.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/manufacturer/request/AddInvalid.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/manufacturer/request/AddValid.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/manufacturer/request/UpdateInvalidId.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/manufacturer/request/UpdateInvalidJson.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/manufacturer/request/UpdateValid.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/manufacturer/response/Add.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/manufacturer/response/Get.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/manufacturer/response/GetAll.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleModel/request/AddInvalid.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleModel/request/AddValid.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleModel/request/UpdateInvalidId.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleModel/request/UpdateInvalidJson.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleModel/request/UpdateValid.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleModel/response/Add.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleModel/response/Get.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleModel/response/GetAll.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleModel/response/GetMotorcycleModelTypes.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleStock/request/AddInvalid.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleStock/request/AddValid.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleStock/request/UpdateInvalidId.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleStock/request/UpdateInvalidJson.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleStock/request/UpdateValid.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleStock/response/Add.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleStock/response/Get.json (100%) rename src/test/resources/{jsonsForEndToEndTests/erpCore => jsonForEndToEndTest/service}/motorcycleStock/response/GetAll.json (100%) diff --git a/src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginAdminRole.json b/src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginAdminRole.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginAdminRole.json rename to src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginAdminRole.json diff --git a/src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginEmptyBody.json b/src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginEmptyBody.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginEmptyBody.json rename to src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginEmptyBody.json diff --git a/src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginInvalidApplicationUser.json b/src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginInvalidApplicationUser.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginInvalidApplicationUser.json rename to src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginInvalidApplicationUser.json diff --git a/src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginSalesRole.json b/src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginSalesRole.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginSalesRole.json rename to src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginSalesRole.json diff --git a/src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginUserRole.json b/src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginUserRole.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginUserRole.json rename to src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginUserRole.json diff --git a/src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewEmptyBodyApplicationUser.json b/src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewEmptyBodyApplicationUser.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewEmptyBodyApplicationUser.json rename to src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewEmptyBodyApplicationUser.json diff --git a/src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewInvalidApplicationUser.json b/src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewInvalidApplicationUser.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewInvalidApplicationUser.json rename to src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewInvalidApplicationUser.json diff --git a/src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithAdminRole.json b/src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithAdminRole.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithAdminRole.json rename to src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithAdminRole.json diff --git a/src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithSalesRole.json b/src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithSalesRole.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithSalesRole.json rename to src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithSalesRole.json diff --git a/src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithUserRole.json b/src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithUserRole.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithUserRole.json rename to src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithUserRole.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/AddInvalid.json b/src/test/resources/jsonForEndToEndTest/service/manufacturer/request/AddInvalid.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/AddInvalid.json rename to src/test/resources/jsonForEndToEndTest/service/manufacturer/request/AddInvalid.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/AddValid.json b/src/test/resources/jsonForEndToEndTest/service/manufacturer/request/AddValid.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/AddValid.json rename to src/test/resources/jsonForEndToEndTest/service/manufacturer/request/AddValid.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateInvalidId.json b/src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateInvalidId.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateInvalidId.json rename to src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateInvalidId.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateInvalidJson.json b/src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateInvalidJson.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateInvalidJson.json rename to src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateInvalidJson.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json b/src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json rename to src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Add.json b/src/test/resources/jsonForEndToEndTest/service/manufacturer/response/Add.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Add.json rename to src/test/resources/jsonForEndToEndTest/service/manufacturer/response/Add.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Get.json b/src/test/resources/jsonForEndToEndTest/service/manufacturer/response/Get.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Get.json rename to src/test/resources/jsonForEndToEndTest/service/manufacturer/response/Get.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/GetAll.json b/src/test/resources/jsonForEndToEndTest/service/manufacturer/response/GetAll.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/GetAll.json rename to src/test/resources/jsonForEndToEndTest/service/manufacturer/response/GetAll.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/AddInvalid.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/AddInvalid.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/AddInvalid.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/AddInvalid.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/AddValid.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/AddValid.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/AddValid.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/AddValid.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateInvalidId.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateInvalidId.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateInvalidId.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateInvalidId.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateInvalidJson.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateInvalidJson.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateInvalidJson.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateInvalidJson.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateValid.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateValid.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateValid.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateValid.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Add.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/Add.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Add.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/Add.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Get.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/Get.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Get.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/Get.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetAll.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/GetAll.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetAll.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/GetAll.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetMotorcycleModelTypes.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/GetMotorcycleModelTypes.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetMotorcycleModelTypes.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/GetMotorcycleModelTypes.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/AddInvalid.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/AddInvalid.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/AddInvalid.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/AddInvalid.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/AddValid.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/AddValid.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/AddValid.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/AddValid.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateInvalidId.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateInvalidId.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateInvalidId.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateInvalidId.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateInvalidJson.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateInvalidJson.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateInvalidJson.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateInvalidJson.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateValid.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateValid.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateValid.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateValid.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Add.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/Add.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Add.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/Add.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Get.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/Get.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Get.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/Get.json diff --git a/src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/GetAll.json b/src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/GetAll.json similarity index 100% rename from src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/GetAll.json rename to src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/GetAll.json From 2043e1f0e61a15962fdf243afbe3e68947d66a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rdos=20Istv=C3=A1n?= Date: Tue, 13 Feb 2024 11:06:37 +0100 Subject: [PATCH 8/9] Update end-to-end tests for service APIs to use refactored JSON file routing at repo --- .../AuthenticationControllerApiTests.java | 38 +++++++++---------- ...nufacturerControllerApiAdminRoleTests.java | 16 ++++---- ...cycleModelControllerApiAdminRoleTests.java | 18 ++++----- ...cycleStockControllerApiAdminRoleTests.java | 16 ++++---- ...nufacturerControllerApiSalesRoleTests.java | 16 ++++---- ...cycleModelControllerApiSalesRoleTests.java | 18 ++++----- ...cycleStockControllerApiSalesRoleTests.java | 16 ++++---- ...anufacturerControllerApiUserRoleTests.java | 14 +++---- ...rcycleModelControllerApiUserRoleTests.java | 16 ++++---- ...rcycleStockControllerApiUserRoleTests.java | 14 +++---- .../endToEndTest/util/EndToEndTestUtil.java | 2 +- 11 files changed, 92 insertions(+), 92 deletions(-) diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/authentication/AuthenticationControllerApiTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/authentication/AuthenticationControllerApiTests.java index 118124c..1a0e7ad 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/authentication/AuthenticationControllerApiTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/authentication/AuthenticationControllerApiTests.java @@ -63,7 +63,7 @@ void register_newValidApplicationUserWithoutJwtToken_statusCode403() throws Exce HttpRequest registerRequest = HttpRequest.newBuilder(URI.create(registerUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + emptyJwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithSalesRole.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithSalesRole.json"))) .build(); // Act @@ -90,7 +90,7 @@ void register_newValidApplicationUserWithUserRole_statusCode403() throws Excepti HttpRequest registerRequest = HttpRequest.newBuilder(URI.create(registerUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenUserRole) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithSalesRole.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithSalesRole.json"))) .build(); // Act @@ -117,7 +117,7 @@ void register_newValidApplicationUserWithSalesRole_statusCode403() throws Except HttpRequest registerRequest = HttpRequest.newBuilder(URI.create(registerUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenSalesRole) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithSalesRole.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithSalesRole.json"))) .build(); // Act @@ -141,7 +141,7 @@ void register_newEmptyBodyApplicationUserWithAdminRole_statusCode400() throws Ex HttpRequest registerRequest = HttpRequest.newBuilder(URI.create(registerUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenAdminRole) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewEmptyBodyApplicationUser.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewEmptyBodyApplicationUser.json"))) .build(); // Act @@ -165,7 +165,7 @@ void register_newInvalidApplicationUserWithAdminRole_statusCode500() throws Exce HttpRequest registerRequest = HttpRequest.newBuilder(URI.create(registerUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenAdminRole) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewInvalidApplicationUser.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewInvalidApplicationUser.json"))) .build(); // Act @@ -189,7 +189,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke HttpRequest registerRequest = HttpRequest.newBuilder(URI.create(registerUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenAdminRole) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithUserRole.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithUserRole.json"))) .build(); // Act @@ -220,7 +220,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke HttpRequest testCallRequest = HttpRequest.newBuilder(URI.create(testCallUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenForTestCall) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json"))) .build(); // Act @@ -242,7 +242,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke HttpRequest registerRequest = HttpRequest.newBuilder(URI.create(registerUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenAdminRole) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithSalesRole.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithSalesRole.json"))) .build(); // Act @@ -273,7 +273,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke HttpRequest testCallRequest = HttpRequest.newBuilder(URI.create(testCallUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenForTestCall) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json"))) .build(); // Act @@ -295,7 +295,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke HttpRequest registerRequest = HttpRequest.newBuilder(URI.create(registerUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenAdminRole) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/register/RegisterNewValidApplicationUserWithAdminRole.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/register/request/RegisterNewValidApplicationUserWithAdminRole.json"))) .build(); // Act @@ -326,7 +326,7 @@ void register_newValidApplicationUserWithAdminRole_statusCode200WithValidJwtToke HttpRequest testCallRequest = HttpRequest.newBuilder(URI.create(testCallUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtTokenForTestCall) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json"))) .build(); // Act @@ -349,7 +349,7 @@ void login_emptyBodyApplicationUser_statusCode400() throws Exception { HttpRequest loginRequest = HttpRequest.newBuilder(URI.create(loginUrl)) .headers("Content-Type", "application/json") - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginEmptyBody.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginEmptyBody.json"))) .build(); // Act @@ -373,7 +373,7 @@ void login_invalidApplicationUser_statusCode403() throws Exception { HttpRequest loginRequest = HttpRequest.newBuilder(URI.create(loginUrl)) .headers("Content-Type", "application/json") - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginInvalidApplicationUser.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginInvalidApplicationUser.json"))) .build(); // Act @@ -397,7 +397,7 @@ void login_existingApplicationUserWithUserRole_statusCode200WithValidJwtTokenInR HttpRequest loginRequest = HttpRequest.newBuilder(URI.create(loginUrl)) .headers("Content-Type", "application/json") - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginUserRole.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginUserRole.json"))) .build(); // Act @@ -427,7 +427,7 @@ void login_existingApplicationUserWithUserRole_statusCode200WithValidJwtTokenInR HttpRequest testCallRequest = HttpRequest.newBuilder(URI.create(testCallUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json"))) .build(); // Act @@ -449,7 +449,7 @@ void login_existingApplicationUserWithSalesRole_statusCode200WithValidJwtTokenIn HttpRequest loginRequest = HttpRequest.newBuilder(URI.create(loginUrl)) .headers("Content-Type", "application/json") - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginSalesRole.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginSalesRole.json"))) .build(); // Act @@ -479,7 +479,7 @@ void login_existingApplicationUserWithSalesRole_statusCode200WithValidJwtTokenIn HttpRequest testCallRequest = HttpRequest.newBuilder(URI.create(testCallUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json"))) .build(); // Act @@ -501,7 +501,7 @@ void login_existingApplicationUserWithAdminRole_statusCode200WithValidJwtTokenIn HttpRequest loginRequest = HttpRequest.newBuilder(URI.create(loginUrl)) .headers("Content-Type", "application/json") - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/login/LoginAdminRole.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/login/request/LoginAdminRole.json"))) .build(); // Act @@ -531,7 +531,7 @@ void login_existingApplicationUserWithAdminRole_statusCode200WithValidJwtTokenIn HttpRequest testCallRequest = HttpRequest.newBuilder(URI.create(testCallUrl)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json"))) .build(); // Act diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/ManufacturerControllerApiAdminRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/ManufacturerControllerApiAdminRoleTests.java index fd69c39..cecdc99 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/ManufacturerControllerApiAdminRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/ManufacturerControllerApiAdminRoleTests.java @@ -55,11 +55,11 @@ void add_newValidManufacturer_statusCode201WithProperJson() throws Exception { String url = baseUrl + "service/manufacturer/add"; int expectedResponseStatus = 201; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Add.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/response/Add.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/AddValid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/AddValid.json"))) .build(); // Act @@ -83,7 +83,7 @@ void add_newInvalidManufacturer_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/AddInvalid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/AddInvalid.json"))) .build(); // Act @@ -102,7 +102,7 @@ void get_manufacturerWithValidId_statusCode200WithProperJson() throws Exception String url = baseUrl + "service/manufacturer/get/6"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Get.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/response/Get.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -149,7 +149,7 @@ void getAll_listOfManufacturers_statusCode200WithProperJson() throws Exception { String url = baseUrl + "service/manufacturer/get/all"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/GetAll.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/response/GetAll.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -199,7 +199,7 @@ void update_manufacturerWithValidId_statusCode204() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json"))) .build(); // Act @@ -221,7 +221,7 @@ void update_manufacturerWithInvalidId_statusCode404() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateInvalidId.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateInvalidId.json"))) .build(); // Act @@ -243,7 +243,7 @@ void update_manufacturerWithInvalidJson_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateInvalidJson.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateInvalidJson.json"))) .build(); // Act diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleModelControllerApiAdminRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleModelControllerApiAdminRoleTests.java index 6718eae..6347e1b 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleModelControllerApiAdminRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleModelControllerApiAdminRoleTests.java @@ -55,11 +55,11 @@ void add_newValidMotorcycleModel_statusCode201WithProperJson() throws Exception String url = baseUrl + "service/motorcycle/model/add"; int expectedResponseStatus = 201; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Add.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/Add.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/AddValid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/AddValid.json"))) .build(); // Act @@ -83,7 +83,7 @@ void add_newInvalidMotorcycleModel_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/AddInvalid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/AddInvalid.json"))) .build(); // Act @@ -102,7 +102,7 @@ void get_motorcycleModelWithValidId_statusCode200WithProperJson() throws Excepti String url = baseUrl + "service/motorcycle/model/get/1"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Get.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/Get.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -149,7 +149,7 @@ void getAll_listOfMotorcycleModels_statusCode200WithProperJson() throws Exceptio String url = baseUrl + "service/motorcycle/model/get/all"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetAll.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/GetAll.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -199,7 +199,7 @@ void update_motorcycleModelWithValidId_statusCode204() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateValid.json"))) .build(); // Act @@ -221,7 +221,7 @@ void update_motorcycleModelWithInvalidId_statusCode404() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateInvalidId.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateInvalidId.json"))) .build(); // Act @@ -243,7 +243,7 @@ void update_motorcycleModelWithInvalidJson_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateInvalidJson.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateInvalidJson.json"))) .build(); // Act @@ -328,7 +328,7 @@ void get_motorcycleModelTypes_statusCode200WithProperJson() throws Exception { String url = baseUrl + "service/motorcycle/model/get/types"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetMotorcycleModelTypes.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/GetMotorcycleModelTypes.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleStockControllerApiAdminRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleStockControllerApiAdminRoleTests.java index 9763f02..b7e763d 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleStockControllerApiAdminRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/adminRole/MotorcycleStockControllerApiAdminRoleTests.java @@ -55,11 +55,11 @@ void add_newValidMotorcycleStock_statusCode201WithProperJson() throws Exception String url = baseUrl + "service/motorcycle/stock/add"; int expectedResponseStatus = 201; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Add.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/Add.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/AddValid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/AddValid.json"))) .build(); // Act @@ -83,7 +83,7 @@ void add_newInvalidMotorcycleStock_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/AddInvalid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/AddInvalid.json"))) .build(); // Act @@ -102,7 +102,7 @@ void get_motorcycleStockWithValidId_statusCode200WithProperJson() throws Excepti String url = baseUrl + "service/motorcycle/stock/get/8"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Get.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/Get.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -149,7 +149,7 @@ void getAll_listOfMotorcycleStocks_statusCode200WithProperJson() throws Exceptio String url = baseUrl + "service/motorcycle/stock/get/all"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/GetAll.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/GetAll.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -199,7 +199,7 @@ void update_motorcycleStockWithValidId_statusCode204() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateValid.json"))) .build(); // Act @@ -221,7 +221,7 @@ void update_motorcycleStockWithInvalidId_statusCode404() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateInvalidId.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateInvalidId.json"))) .build(); // Act @@ -243,7 +243,7 @@ void update_motorcycleStockWithInvalidJson_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateInvalidJson.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateInvalidJson.json"))) .build(); // Act diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/ManufacturerControllerApiSalesRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/ManufacturerControllerApiSalesRoleTests.java index c4d31b1..3c0a98e 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/ManufacturerControllerApiSalesRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/ManufacturerControllerApiSalesRoleTests.java @@ -59,11 +59,11 @@ void add_newValidManufacturer_statusCode201WithProperJson() throws Exception { String url = baseUrl + "service/manufacturer/add"; int expectedResponseStatus = 201; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Add.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/response/Add.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/AddValid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/AddValid.json"))) .build(); // Act @@ -87,7 +87,7 @@ void add_newInvalidManufacturer_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/AddInvalid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/AddInvalid.json"))) .build(); // Act @@ -106,7 +106,7 @@ void get_manufacturerWithValidId_statusCode200WithProperJson() throws Exception String url = baseUrl + "service/manufacturer/get/6"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Get.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/response/Get.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -153,7 +153,7 @@ void getAll_listOfManufacturers_statusCode200WithProperJson() throws Exception { String url = baseUrl + "service/manufacturer/get/all"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/GetAll.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/response/GetAll.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -203,7 +203,7 @@ void update_manufacturerWithValidId_statusCode204() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json"))) .build(); // Act @@ -225,7 +225,7 @@ void update_manufacturerWithInvalidId_statusCode404() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateInvalidId.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateInvalidId.json"))) .build(); // Act @@ -247,7 +247,7 @@ void update_manufacturerWithInvalidJson_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateInvalidJson.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateInvalidJson.json"))) .build(); // Act diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleModelControllerApiSalesRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleModelControllerApiSalesRoleTests.java index bd9d91d..8ce1a22 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleModelControllerApiSalesRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleModelControllerApiSalesRoleTests.java @@ -59,11 +59,11 @@ void add_newValidMotorcycleModel_statusCode201WithProperJson() throws Exception String url = baseUrl + "service/motorcycle/model/add"; int expectedResponseStatus = 201; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Add.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/Add.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/AddValid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/AddValid.json"))) .build(); // Act @@ -87,7 +87,7 @@ void add_newInvalidMotorcycleModel_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/AddInvalid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/AddInvalid.json"))) .build(); // Act @@ -106,7 +106,7 @@ void get_motorcycleModelWithValidId_statusCode200WithProperJson() throws Excepti String url = baseUrl + "service/motorcycle/model/get/1"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Get.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/Get.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -153,7 +153,7 @@ void getAll_listOfMotorcycleModels_statusCode200WithProperJson() throws Exceptio String url = baseUrl + "service/motorcycle/model/get/all"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetAll.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/GetAll.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -203,7 +203,7 @@ void update_motorcycleModelWithValidId_statusCode204() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateValid.json"))) .build(); // Act @@ -225,7 +225,7 @@ void update_motorcycleModelWithInvalidId_statusCode404() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateInvalidId.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateInvalidId.json"))) .build(); // Act @@ -247,7 +247,7 @@ void update_motorcycleModelWithInvalidJson_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateInvalidJson.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateInvalidJson.json"))) .build(); // Act @@ -332,7 +332,7 @@ void get_motorcycleModelTypes_statusCode200WithProperJson() throws Exception { String url = baseUrl + "service/motorcycle/model/get/types"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetMotorcycleModelTypes.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/GetMotorcycleModelTypes.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleStockControllerApiSalesRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleStockControllerApiSalesRoleTests.java index c95d3ac..ed51a27 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleStockControllerApiSalesRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/salesRole/MotorcycleStockControllerApiSalesRoleTests.java @@ -59,11 +59,11 @@ void add_newValidMotorcycleStock_statusCode201WithProperJson() throws Exception String url = baseUrl + "service/motorcycle/stock/add"; int expectedResponseStatus = 201; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Add.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/Add.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/AddValid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/AddValid.json"))) .build(); // Act @@ -87,7 +87,7 @@ void add_newInvalidMotorcycleStock_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/AddInvalid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/AddInvalid.json"))) .build(); // Act @@ -106,7 +106,7 @@ void get_motorcycleStockWithValidId_statusCode200WithProperJson() throws Excepti String url = baseUrl + "service/motorcycle/stock/get/8"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Get.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/Get.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -153,7 +153,7 @@ void getAll_listOfMotorcycleStocks_statusCode200WithProperJson() throws Exceptio String url = baseUrl + "service/motorcycle/stock/get/all"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/GetAll.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/GetAll.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -203,7 +203,7 @@ void update_motorcycleStockWithValidId_statusCode204() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateValid.json"))) .build(); // Act @@ -225,7 +225,7 @@ void update_motorcycleStockWithInvalidId_statusCode404() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateInvalidId.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateInvalidId.json"))) .build(); // Act @@ -247,7 +247,7 @@ void update_motorcycleStockWithInvalidJson_statusCode400() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateInvalidJson.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateInvalidJson.json"))) .build(); // Act diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/ManufacturerControllerApiUserRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/ManufacturerControllerApiUserRoleTests.java index 75c6feb..435f75d 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/ManufacturerControllerApiUserRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/ManufacturerControllerApiUserRoleTests.java @@ -62,7 +62,7 @@ void add_newValidManufacturer_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/AddValid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/AddValid.json"))) .build(); // Act @@ -84,7 +84,7 @@ void add_newInvalidManufacturer_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/AddInvalid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/AddInvalid.json"))) .build(); // Act @@ -103,7 +103,7 @@ void get_manufacturerWithValidId_statusCode200WithProperJson() throws Exception String url = baseUrl + "service/manufacturer/get/6"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/Get.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/response/Get.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -150,7 +150,7 @@ void getAll_listOfManufacturers_statusCode200WithProperJson() throws Exception { String url = baseUrl + "service/manufacturer/get/all"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/response/GetAll.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/response/GetAll.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -200,7 +200,7 @@ void update_manufacturerWithValidId_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateValid.json"))) .build(); // Act @@ -222,7 +222,7 @@ void update_manufacturerWithInvalidId_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateInvalidId.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateInvalidId.json"))) .build(); // Act @@ -244,7 +244,7 @@ void update_manufacturerWithInvalidJson_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/manufacturer/request/UpdateInvalidJson.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/manufacturer/request/UpdateInvalidJson.json"))) .build(); // Act diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleModelControllerApiUserRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleModelControllerApiUserRoleTests.java index 2499164..8fa5776 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleModelControllerApiUserRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleModelControllerApiUserRoleTests.java @@ -62,7 +62,7 @@ void add_newValidMotorcycleModel_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/AddValid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/AddValid.json"))) .build(); // Act @@ -84,7 +84,7 @@ void add_newInvalidMotorcycleModel_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/AddInvalid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/AddInvalid.json"))) .build(); // Act @@ -103,7 +103,7 @@ void get_motorcycleModelWithValidId_statusCode200WithProperJson() throws Excepti String url = baseUrl + "service/motorcycle/model/get/1"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/Get.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/Get.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -152,7 +152,7 @@ void getAll_listOfMotorcycleModels_statusCode200WithProperJson() throws Exceptio String url = baseUrl + "service/motorcycle/model/get/all"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetAll.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/GetAll.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -202,7 +202,7 @@ void update_motorcycleModelWithValidId_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateValid.json"))) .build(); // Act @@ -224,7 +224,7 @@ void update_motorcycleModelWithInvalidId_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateInvalidId.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateInvalidId.json"))) .build(); // Act @@ -246,7 +246,7 @@ void update_motorcycleModelWithInvalidJson_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/request/UpdateInvalidJson.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/request/UpdateInvalidJson.json"))) .build(); // Act @@ -331,7 +331,7 @@ void get_motorcycleModelTypes_statusCode200WithProperJson() throws Exception { String url = baseUrl + "service/motorcycle/model/get/types"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleModel/response/GetMotorcycleModelTypes.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleModel/response/GetMotorcycleModelTypes.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleStockControllerApiUserRoleTests.java b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleStockControllerApiUserRoleTests.java index f1ee2c0..d9968ce 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleStockControllerApiUserRoleTests.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/apiTest/service/userRole/MotorcycleStockControllerApiUserRoleTests.java @@ -62,7 +62,7 @@ void add_newValidMotorcycleStock_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/AddValid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/AddValid.json"))) .build(); // Act @@ -84,7 +84,7 @@ void add_newInvalidMotorcycleStock_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/AddInvalid.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/AddInvalid.json"))) .build(); // Act @@ -103,7 +103,7 @@ void get_motorcycleStockWithValidId_statusCode200WithProperJson() throws Excepti String url = baseUrl + "service/motorcycle/stock/get/8"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/Get.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/Get.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -150,7 +150,7 @@ void getAll_listOfMotorcycleStocks_statusCode200WithProperJson() throws Exceptio String url = baseUrl + "service/motorcycle/stock/get/all"; int expectedResponseStatus = 200; - String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/response/GetAll.json"))); + String expectedResponseBody = new String(Files.readAllBytes(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/response/GetAll.json"))); HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) @@ -200,7 +200,7 @@ void update_motorcycleStockWithValidId_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateValid.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateValid.json"))) .build(); // Act @@ -222,7 +222,7 @@ void update_motorcycleStockWithInvalidId_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateInvalidId.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateInvalidId.json"))) .build(); // Act @@ -244,7 +244,7 @@ void update_motorcycleStockWithInvalidJson_statusCode403() throws Exception { HttpRequest request = HttpRequest.newBuilder(URI.create(url)) .headers("Content-Type", "application/json", "Authorization", "Bearer " + jwtToken) - .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/erpCore/motorcycleStock/request/UpdateInvalidJson.json"))) + .PUT(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/service/motorcycleStock/request/UpdateInvalidJson.json"))) .build(); // Act diff --git a/src/test/java/com/ibardos/motoShop/endToEndTest/util/EndToEndTestUtil.java b/src/test/java/com/ibardos/motoShop/endToEndTest/util/EndToEndTestUtil.java index 9c6a689..1cd3d6f 100644 --- a/src/test/java/com/ibardos/motoShop/endToEndTest/util/EndToEndTestUtil.java +++ b/src/test/java/com/ibardos/motoShop/endToEndTest/util/EndToEndTestUtil.java @@ -29,7 +29,7 @@ public class EndToEndTestUtil { public static String retrieveJwtToken(String baseUrl, HttpClient client, String role) throws IOException, InterruptedException, JSONException { HttpRequest request = HttpRequest.newBuilder(URI.create(baseUrl + "authentication/login")) .headers("Content-Type", "application/json") - .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonsForEndToEndTests/authentication/request/login/Login" + role + "Role.json"))) + .POST(HttpRequest.BodyPublishers.ofFile(Path.of("src/test/resources/jsonForEndToEndTest/authentication/login/request/Login" + role + "Role.json"))) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); From 78102fe063a5a34f846e1fd90f96a9884e02d540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1rdos=20Istv=C3=A1n?= Date: Tue, 13 Feb 2024 11:21:49 +0100 Subject: [PATCH 9/9] Update README.md [CI] --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index f82888c..52ba7d0 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,7 @@ With Postman: 4. Start the back-end server in your IDE - Database tables will be created and initialized with data automatically 5. Test the API endpoints with the predefined HTTP requests in Postman (edge cases are also covered) + - Remember to retrieve the proper (see hints) JWT token to be able to call service APIs With my set of End-to-End tests: 1. Run the tests I've created for API endpoint testing, located here: ```~/src/test/java/com/ibardos/motoShop/endToEndTests/apiTests``` @@ -206,3 +207,7 @@ with ORM as well. - Create a compound in your IDE to be able to run back-end and front-end servers simultaneously with a push of a button. - You don't need to bother with database initialisation at any point, as I managed to do that programmatically. - If you don't understand something, Google it, ask ChatGPT about it, or feel free to contact me. +- Security configuration: + - User role: read permission + - Sales role: create, read, update permissions + - Admin role: create, read, update, delete permissions