From 650a6df3eae52518129a5b52da53e433c8ad2e48 Mon Sep 17 00:00:00 2001 From: Kalaiyarasiganeshalingam Date: Mon, 18 Nov 2024 11:51:09 +0530 Subject: [PATCH] Use ConcurrentHashMap --- .../integration/test/odata/ODataETagTestCase.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/integration/dataservice-hosting-tests/tests-integration/tests/src/test/java/org/wso2/ei/dataservice/integration/test/odata/ODataETagTestCase.java b/integration/dataservice-hosting-tests/tests-integration/tests/src/test/java/org/wso2/ei/dataservice/integration/test/odata/ODataETagTestCase.java index 3e76088c01..face3e1a0b 100644 --- a/integration/dataservice-hosting-tests/tests-integration/tests/src/test/java/org/wso2/ei/dataservice/integration/test/odata/ODataETagTestCase.java +++ b/integration/dataservice-hosting-tests/tests-integration/tests/src/test/java/org/wso2/ei/dataservice/integration/test/odata/ODataETagTestCase.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import static org.wso2.ei.dataservice.integration.test.odata.ODataTestUtils.getETag; import static org.wso2.ei.dataservice.integration.test.odata.ODataTestUtils.sendDELETE; @@ -58,7 +59,7 @@ public void destroy() throws Exception { public void validateETagRetrievalTestCase() throws Exception { String endpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES"; String content = "{\"FILENAME\": \"WSO2PROD\" ,\"TYPE\" : \"dss\"}"; - Map headers = new HashMap<>(); + ConcurrentHashMap headers = new ConcurrentHashMap<>(); headers.put("Accept", "application/json"); Object[] response = sendPOST(endpoint, content, headers); Assert.assertEquals(response[0], ODataTestUtils.CREATED); @@ -87,7 +88,7 @@ public void validateETagRetrievalTestCase() throws Exception { public void validateETagGenerationTestCase() throws Exception { String endpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES"; String content = "{\"FILENAME\": \"WSO2\" ,\"TYPE\" : \"bam\"}"; - Map headers = new HashMap<>(); + ConcurrentHashMap headers = new ConcurrentHashMap<>(); headers.put("Accept", "application/json"); Object[] response = sendPOST(endpoint, content, headers); Thread.sleep(1000); @@ -112,7 +113,7 @@ public void validateETagGenerationTestCase() throws Exception { @Test(groups = "wso2.dss", description = "etag concurrent handling with put method test", dependsOnMethods = "validateETagGenerationTestCase") public void validateETagConcurrentHandlingTestCaseForPutMethod() throws Exception { String endpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES(\'WSO2PROD\')"; - Map headers = new HashMap<>(); + ConcurrentHashMap headers = new ConcurrentHashMap<>(); headers.put("Accept", "application/json"); Object[] response = sendGET(endpoint, headers); Thread.sleep(1000); @@ -181,7 +182,7 @@ public void validateETagConcurrentHandlingTestCaseForPutMethod() throws Exceptio @Test(groups = "wso2.dss", description = "etag concurrent handling with patch method test", dependsOnMethods = "validateETagConcurrentHandlingTestCaseForPutMethod") public void validateETagConcurrentHandlingTestCaseForPatchMethod() throws Exception { String endpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES(\'WSO2\')"; - Map headers = new HashMap<>(); + ConcurrentHashMap headers = new ConcurrentHashMap<>(); headers.put("Accept", "application/json"); Object[] response = sendGET(endpoint, headers); Thread.sleep(1000); @@ -252,7 +253,7 @@ public void validateETagConcurrentHandlingTestCaseForDeleteMethod() throws Excep System.out.println("This test is temporarily skipped for this workflow"); String endpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES"; String content = "{\"FILENAME\": \"WSO2PROD\" ,\"TYPE\" : \"dss\"}"; - Map headers = new HashMap<>(); + ConcurrentHashMap headers = new ConcurrentHashMap<>(); headers.put("Accept", "application/json"); Object[] response = sendPOST(endpoint, content, headers); Thread.sleep(1000); @@ -314,7 +315,7 @@ public void validateETagConcurrentHandlingTestCaseForUpdatePropertyWithPutMethod if (!Boolean.parseBoolean(System.getenv("CI_BUILD_SKIP"))) { String endpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES"; String content = "{\"FILENAME\": \"WSO2PROD\" ,\"TYPE\" : \"dss\"}"; - Map headers = new HashMap<>(); + ConcurrentHashMap headers = new ConcurrentHashMap<>(); headers.put("Accept", "application/json"); Object[] response = sendPOST(endpoint, content, headers); Thread.sleep(1000); @@ -378,7 +379,7 @@ public void validateETagConcurrentHandlingTestCaseForUpdatePropertyWithPatchMeth System.out.println("This test is temporarily skipped for this workflow"); String entityEndpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES(\'WSO2PROD\')"; String endpoint = webAppUrl + "/odata/" + serviceName + "/" + configId + "/FILES(\'WSO2PROD\')/TYPE"; - Map headers = new HashMap<>(); + ConcurrentHashMap headers = new ConcurrentHashMap<>(); headers.put("Accept", "application/json"); Object[] response = sendGET(entityEndpoint, headers); Thread.sleep(1000);