diff --git a/sunbird_service_api_test/src/test/java/org/sunbird/common/util/Constant.java b/sunbird_service_api_test/src/test/java/org/sunbird/common/util/Constant.java index b7eb52f7..a427aacc 100644 --- a/sunbird_service_api_test/src/test/java/org/sunbird/common/util/Constant.java +++ b/sunbird_service_api_test/src/test/java/org/sunbird/common/util/Constant.java @@ -6,16 +6,31 @@ private Constant() {} public static final String EMAIL = "email"; public static final String USER_NAME = "userName"; - public static final String REQUEST = "request"; public static final String CHANNEL = "channel"; public static final String PROVIDER = "provider"; public static final String EXTERNAL_ID = "externalId"; public static final String PASSWORD = "password"; public static final String LAST_NAME = "lastName"; public static final String FIRST_NAME = "firstName"; - public static final String ID = "id"; public static final String USER_ID = "userId"; public static final String REG_ORG_ID = "regOrgId"; public static final String ROOT_ORG_ID = "rootOrgId"; + public static final String UPDATE_USER_TEMPLATE_LOCATION = "templates/user/update/"; + public static final String AUTHORIZATION = "Authorization"; + public static final String BEARER = "Bearer "; + public static final String CONTENT_TYPE_APPLICATION_JSON = "application/json"; + public static final String EQUAL_SIGN = "="; + public static final String USER_TEMPLATE_LOCATION = "templates/user/create/"; + public static final String USER_NAME_PREFIX = "ft_testinstance"; + public static final String X_AUTHENTICATED_USER_TOKEN = "x-authenticated-user-token"; + public static final String PARENT_CODE = "parentCode"; + public static final String CODE = "code"; + public static final String LOCATION_TYPE = "type"; + public static final String PARENT_ID = "parentId"; + public static final String NAME = "name"; + public static final String ID = "id"; + public static final String REQUEST = "request"; public static final String RESPONSE = "response"; + public static final String ES_REST_API_PORT = "9200"; + public static final String MULTIPART_FILE_NAME = "file"; } diff --git a/sunbird_service_api_test/src/test/java/org/sunbird/common/util/Constants.java b/sunbird_service_api_test/src/test/java/org/sunbird/common/util/Constants.java deleted file mode 100644 index a397b773..00000000 --- a/sunbird_service_api_test/src/test/java/org/sunbird/common/util/Constants.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.sunbird.common.util; - -/** @author Manzarul */ -public class Constants { - public static final String UPDATE_USER_TEMPLATE_LOCATION = "templates/user/update/"; - public static final String AUTHORIZATION = "Authorization"; - public static final String BEARER= "Bearer "; - public static final String CONTENT_TYPE_APPLICATION_JSON = "application/json"; - public static final String EQUAL_SIGN = "="; - public static final String USER_TEMPLATE_LOCATION = "templates/user/create/"; - public static final String USER_NAME_PREFIX = "ft_testinstance"; - public static final String X_AUTHENTICATED_USER_TOKEN = "x-authenticated-user-token"; - public static final String PARENT_CODE = "parentCode"; - public static final String CODE = "code"; - public static final String LOCATION_TYPE = "type"; - public static final String PARENT_ID = "parentId"; - public static final String NAME = "name"; - public static final String ID = "id"; - public static final String REQUEST = "request"; - public static final String RESPONSE = "response"; - public static final String ES_REST_API_PORT = "9200"; - public static final String MULTIPART_FILE_NAME = "file"; -} diff --git a/sunbird_service_api_test/src/test/java/org/sunbird/common/util/ElasticSearchCleanUp.java b/sunbird_service_api_test/src/test/java/org/sunbird/common/util/ElasticSearchCleanUp.java index 31849f7f..be2061a1 100644 --- a/sunbird_service_api_test/src/test/java/org/sunbird/common/util/ElasticSearchCleanUp.java +++ b/sunbird_service_api_test/src/test/java/org/sunbird/common/util/ElasticSearchCleanUp.java @@ -1,6 +1,5 @@ package org.sunbird.common.util; -import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; @@ -8,33 +7,38 @@ /** * Class to perform the clean up from elastic search. + * * @author arvind. */ public class ElasticSearchCleanUp { - @Autowired - private TestGlobalProperty initGlobalValues; + @Autowired private TestGlobalProperty initGlobalValues; private static ElasticSearchCleanUp elasticSearchcleanUp; - private ElasticSearchCleanUp(){ - } + private ElasticSearchCleanUp() {} - public static ElasticSearchCleanUp getInstance(){ - if(null == elasticSearchcleanUp){ + public static ElasticSearchCleanUp getInstance() { + if (null == elasticSearchcleanUp) { elasticSearchcleanUp = new ElasticSearchCleanUp(); } return elasticSearchcleanUp; } - public void deleteFromElasticSearch(Map> map){ - map.forEach((k, v) -> { - if (v != null) - for (String value : v) { - boolean response = deleteDataFromES(initGlobalValues.getEsHost(), Constants.ES_REST_API_PORT, - initGlobalValues.getIndex(), k, value); - } - }); + public void deleteFromElasticSearch(Map> map) { + map.forEach( + (k, v) -> { + if (v != null) + for (String value : v) { + boolean response = + deleteDataFromES( + initGlobalValues.getEsHost(), + Constant.ES_REST_API_PORT, + initGlobalValues.getIndex(), + k, + value); + } + }); } private boolean deleteDataFromES(String host, String port, String index, String type, String id) { @@ -44,16 +48,11 @@ private boolean deleteDataFromES(String host, String port, String index, String /** * This method will create url for ES get and deleted by Id. * - * @param host - * String - * @param port - * String - * @param index - * String - * @param type - * String - * @param id - * String + * @param host String + * @param port String + * @param index String + * @param type String + * @param id String * @return String */ private static String createURL(String host, String port, String index, String type, String id) { @@ -62,5 +61,4 @@ private static String createURL(String host, String port, String index, String t builder.append(":" + port + "/" + index + "/" + type + "/" + id); return builder.toString(); } - } diff --git a/sunbird_service_api_test/src/test/java/org/sunbird/common/util/HttpUtil.java b/sunbird_service_api_test/src/test/java/org/sunbird/common/util/HttpUtil.java index 77849476..02ce7821 100644 --- a/sunbird_service_api_test/src/test/java/org/sunbird/common/util/HttpUtil.java +++ b/sunbird_service_api_test/src/test/java/org/sunbird/common/util/HttpUtil.java @@ -77,10 +77,12 @@ public void multipartPost( new Scanner(new File(getClass().getClassLoader().getResource(formDataFile).getFile()))) { while (scanner.hasNext()) { - String[] param = scanner.nextLine().split(Constants.EQUAL_SIGN); + String[] param = scanner.nextLine().split(Constant.EQUAL_SIGN); if (param != null && param.length == 2) { - if (param[0].equalsIgnoreCase(Constants.MULTIPART_FILE_NAME)) { - formData.add(Constants.MULTIPART_FILE_NAME, new ClassPathResource(formDataFileFolderPath + "/" + param[1])); + if (param[0].equalsIgnoreCase(Constant.MULTIPART_FILE_NAME)) { + formData.add( + Constant.MULTIPART_FILE_NAME, + new ClassPathResource(formDataFileFolderPath + "/" + param[1])); } else { formData.add(param[0], param[1]); } @@ -95,7 +97,7 @@ public void multipartPost( .send() .post(url) .contentType(MediaType.MULTIPART_FORM_DATA) - .header(Constants.AUTHORIZATION, Constants.BEARER + config.getApiKey()) + .header(Constant.AUTHORIZATION, Constant.BEARER + config.getApiKey()) .payload(formData); } } diff --git a/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/location/LocationTest.java b/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/location/LocationTest.java index fb173a68..2e0e647e 100644 --- a/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/location/LocationTest.java +++ b/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/location/LocationTest.java @@ -20,7 +20,7 @@ import org.sunbird.common.models.response.Response; import org.sunbird.common.models.response.ResponseCode; import org.sunbird.common.util.CassandraCleanUp; -import org.sunbird.common.util.Constants; +import org.sunbird.common.util.Constant; import org.sunbird.common.util.ElasticSearchCleanUp; import org.sunbird.integration.test.common.BaseCitrusTest; import org.sunbird.integration.test.user.EndpointConfig.TestGlobalProperty; @@ -164,8 +164,8 @@ public void testCreateLocationState(String requestJson, String responseJson, Str .client(restTestClient) .send() .post(CREATE_LOCATION_URI) - .contentType(Constants.CONTENT_TYPE_APPLICATION_JSON) - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()) + .contentType(Constant.CONTENT_TYPE_APPLICATION_JSON) + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()) .payload(requestJson); if ((LOCATION_TEMPLATE_PATH + "create_location_success_response.json").equals(responseJson)) { HttpClientReceiveActionBuilder response = http().client(restTestClient).receive(); @@ -199,8 +199,8 @@ public void testUpdateStateLocation(String requestJson, String responseJson, Str .client(restTestClient) .send() .patch(UPDATE_LOCATION_URI) - .contentType(Constants.CONTENT_TYPE_APPLICATION_JSON) - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()) + .contentType(Constant.CONTENT_TYPE_APPLICATION_JSON) + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()) .payload(requestJson); if ((LOCATION_TEMPLATE_PATH_UPDATE + "update_location_name_success_response.json") .equals(responseJson)) { @@ -240,8 +240,8 @@ public void testCreateLocationDistrict(String requestJson, String responseJson, .client(restTestClient) .send() .post(CREATE_LOCATION_URI) - .contentType(Constants.CONTENT_TYPE_APPLICATION_JSON) - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()) + .contentType(Constant.CONTENT_TYPE_APPLICATION_JSON) + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()) .payload(requestJson); if ((LOCATION_TEMPLATE_PATH + "create_location_success_response.json").equals(responseJson)) { HttpClientReceiveActionBuilder response = http().client(restTestClient).receive(); @@ -274,8 +274,8 @@ public void testUpdateDistrictLocation(String requestJson, String responseJson, .client(restTestClient) .send() .patch(UPDATE_LOCATION_URI) - .contentType(Constants.CONTENT_TYPE_APPLICATION_JSON) - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()) + .contentType(Constant.CONTENT_TYPE_APPLICATION_JSON) + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()) .payload(requestJson); if ((LOCATION_TEMPLATE_PATH_UPDATE + "update_location_name_success_response.json") .equals(responseJson)) { @@ -308,7 +308,7 @@ public void testDeleteStateLocation(String responseJson, String testName) { .client(restTestClient) .send() .delete(DELETE_LOCATION_URI + "/" + stateLocationId) - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()); + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()); http() .client(restTestClient) .receive() @@ -333,7 +333,7 @@ public void testDeleteDistrictLocation(String responseJson, String testName) { .client(restTestClient) .send() .delete(DELETE_LOCATION_URI + "/" + districtLocationId) - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()); + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()); http() .client(restTestClient) .receive() @@ -344,7 +344,7 @@ public void testDeleteDistrictLocation(String responseJson, String testName) { .client(restTestClient) .send() .delete(DELETE_LOCATION_URI + "/" + districtLocationId + "invalid") - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()); + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()); http() .client(restTestClient) .receive() @@ -365,8 +365,8 @@ public void validate( Response response, Map headers, TestContext context) { Assert.assertNotNull(response.getId()); Assert.assertEquals(response.getResponseCode(), ResponseCode.OK); - Assert.assertNotNull(response.getResult().get(Constants.RESPONSE)); - String locationId = (String) response.getResult().get(Constants.ID); + Assert.assertNotNull(response.getResult().get(Constant.RESPONSE)); + String locationId = (String) response.getResult().get(Constant.ID); Assert.assertNotNull(locationId); if (locationType.equalsIgnoreCase("state")) { stateLocationId = locationId; @@ -397,12 +397,12 @@ public void validate( private String createStateLocationMap() { Map requestMap = new HashMap<>(); Map innerMap = new HashMap<>(); - innerMap.put(Constants.CODE, STATE_CODE); - innerMap.put(Constants.NAME, STATE_NAME); - innerMap.put(Constants.PARENT_CODE, null); - innerMap.put(Constants.LOCATION_TYPE, "state"); - innerMap.put(Constants.PARENT_ID, null); - requestMap.put(Constants.REQUEST, innerMap); + innerMap.put(Constant.CODE, STATE_CODE); + innerMap.put(Constant.NAME, STATE_NAME); + innerMap.put(Constant.PARENT_CODE, null); + innerMap.put(Constant.LOCATION_TYPE, "state"); + innerMap.put(Constant.PARENT_ID, null); + requestMap.put(Constant.REQUEST, innerMap); try { return objectMapper.writeValueAsString(requestMap); } catch (JsonProcessingException e) { @@ -415,11 +415,11 @@ private Object createDistrictLocationMap() { Map requestMap = new HashMap<>(); Map innerMap = new HashMap<>(); - innerMap.put(Constants.CODE, DISTRICT_CODE); - innerMap.put(Constants.NAME, DISTRICT_NAME); - innerMap.put(Constants.LOCATION_TYPE, "district"); - innerMap.put(Constants.PARENT_CODE, STATE_CODE); - requestMap.put(Constants.REQUEST, innerMap); + innerMap.put(Constant.CODE, DISTRICT_CODE); + innerMap.put(Constant.NAME, DISTRICT_NAME); + innerMap.put(Constant.LOCATION_TYPE, "district"); + innerMap.put(Constant.PARENT_CODE, STATE_CODE); + requestMap.put(Constant.REQUEST, innerMap); try { return objectMapper.writeValueAsString(requestMap); } catch (JsonProcessingException e) { @@ -431,9 +431,9 @@ private Object createDistrictLocationMap() { private Object updateStateLocationMap() { Map requestMap = new HashMap<>(); Map innerMap = new HashMap<>(); - innerMap.put(Constants.NAME, STATE_NAME + 01); - innerMap.put(Constants.ID, stateLocationId); - requestMap.put(Constants.REQUEST, innerMap); + innerMap.put(Constant.NAME, STATE_NAME + 01); + innerMap.put(Constant.ID, stateLocationId); + requestMap.put(Constant.REQUEST, innerMap); try { return objectMapper.writeValueAsString(requestMap); } catch (JsonProcessingException e) { @@ -445,9 +445,9 @@ private Object updateStateLocationMap() { private Object updateStateLocationTypeMap() { Map requestMap = new HashMap<>(); Map innerMap = new HashMap<>(); - innerMap.put(Constants.LOCATION_TYPE, "district"); - innerMap.put(Constants.ID, stateLocationId); - requestMap.put(Constants.REQUEST, innerMap); + innerMap.put(Constant.LOCATION_TYPE, "district"); + innerMap.put(Constant.ID, stateLocationId); + requestMap.put(Constant.REQUEST, innerMap); try { return objectMapper.writeValueAsString(requestMap); } catch (JsonProcessingException e) { @@ -459,9 +459,9 @@ private Object updateStateLocationTypeMap() { private Object updateDistrictNameLocationMap() { Map requestMap = new HashMap<>(); Map innerMap = new HashMap<>(); - innerMap.put(Constants.NAME, DISTRICT_NAME + 01); - innerMap.put(Constants.ID, districtLocationId); - requestMap.put(Constants.REQUEST, innerMap); + innerMap.put(Constant.NAME, DISTRICT_NAME + 01); + innerMap.put(Constant.ID, districtLocationId); + requestMap.put(Constant.REQUEST, innerMap); try { return objectMapper.writeValueAsString(requestMap); } catch (JsonProcessingException e) { @@ -473,9 +473,9 @@ private Object updateDistrictNameLocationMap() { private Object updateDistrictLocationTypeMap() { Map requestMap = new HashMap<>(); Map innerMap = new HashMap<>(); - innerMap.put(Constants.LOCATION_TYPE, "state"); - innerMap.put(Constants.ID, districtLocationId); - requestMap.put(Constants.REQUEST, innerMap); + innerMap.put(Constant.LOCATION_TYPE, "state"); + innerMap.put(Constant.ID, districtLocationId); + requestMap.put(Constant.REQUEST, innerMap); try { return objectMapper.writeValueAsString(requestMap); } catch (JsonProcessingException e) { diff --git a/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/UserTest.java b/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/UserTest.java index 4a399daa..958cf2a2 100644 --- a/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/UserTest.java +++ b/sunbird_service_api_test/src/test/java/org/sunbird/integration/test/user/UserTest.java @@ -19,7 +19,6 @@ import org.sunbird.common.models.response.Response; import org.sunbird.common.models.response.ResponseCode; import org.sunbird.common.util.Constant; -import org.sunbird.common.util.Constants; import org.sunbird.integration.test.user.EndpointConfig.TestGlobalProperty; import org.testng.Assert; import org.testng.annotations.DataProvider; @@ -53,28 +52,28 @@ public class UserTest extends TestNGCitrusTestDesigner { public Object[][] createUserDataProvider() { return new Object[][] { new Object[] { - Constants.USER_TEMPLATE_LOCATION + "user_first_name_mandatory.json", - Constants.USER_TEMPLATE_LOCATION + "user_first_name_mandatory_response.json", + Constant.USER_TEMPLATE_LOCATION + "user_first_name_mandatory.json", + Constant.USER_TEMPLATE_LOCATION + "user_first_name_mandatory_response.json", "firstNameMandatoryTest" }, new Object[] { - Constants.USER_TEMPLATE_LOCATION + "user_name_mandatory.json", - Constants.USER_TEMPLATE_LOCATION + "user_name_mandatory_response.json", + Constant.USER_TEMPLATE_LOCATION + "user_name_mandatory.json", + Constant.USER_TEMPLATE_LOCATION + "user_name_mandatory_response.json", "UserNameMandatory" }, new Object[] { - Constants.USER_TEMPLATE_LOCATION + "user_invalid_role_type.json", - Constants.USER_TEMPLATE_LOCATION + "user_invalid_role_type_response.json", + Constant.USER_TEMPLATE_LOCATION + "user_invalid_role_type.json", + Constant.USER_TEMPLATE_LOCATION + "user_invalid_role_type_response.json", "invalidRoleType" }, new Object[] { - Constants.USER_TEMPLATE_LOCATION + "user_invalid_language_type.json", - Constants.USER_TEMPLATE_LOCATION + "user_invalid_language_type_response.json", + Constant.USER_TEMPLATE_LOCATION + "user_invalid_language_type.json", + Constant.USER_TEMPLATE_LOCATION + "user_invalid_language_type_response.json", "invalidLanguageType" }, new Object[] { - Constants.USER_TEMPLATE_LOCATION + "user_invalid_dob_format.json", - Constants.USER_TEMPLATE_LOCATION + "user_invalid_dob_response.json", + Constant.USER_TEMPLATE_LOCATION + "user_invalid_dob_format.json", + Constant.USER_TEMPLATE_LOCATION + "user_invalid_dob_response.json", "invalidDobFormat" } }; @@ -86,22 +85,22 @@ public Object[][] createUserDynamicJsonData() { new Object[] {createUserMap(), "usersuccessresponse.json", "createUser"}, new Object[] { createUserWithDuplicateEmail(), - Constants.USER_TEMPLATE_LOCATION + "user_duplicate_email_response.json", + Constant.USER_TEMPLATE_LOCATION + "user_duplicate_email_response.json", "duplicateEmailTest" }, new Object[] { createUserWithDuplicateUserName(), - Constants.USER_TEMPLATE_LOCATION + "user_username_exist_response.json", + Constant.USER_TEMPLATE_LOCATION + "user_username_exist_response.json", "duplicateUsernameTest" }, new Object[] { createUserWithDuplicateExtIdAndProvider(), - Constants.USER_TEMPLATE_LOCATION + "user_already_exist_response.json", + Constant.USER_TEMPLATE_LOCATION + "user_already_exist_response.json", "duplicateExtIdAndProviderTest" }, new Object[] { createUserWithInvalidChannel(), - Constants.USER_TEMPLATE_LOCATION + "invalid_channel_response.json", + Constant.USER_TEMPLATE_LOCATION + "invalid_channel_response.json", "invalidChannelTest" } }; @@ -118,17 +117,17 @@ public Object[][] updateUserDataProvider() { }, new Object[] { updateUserWithRegOrgId(), - Constants.UPDATE_USER_TEMPLATE_LOCATION + "user_update_bad_request_response.json", + Constant.UPDATE_USER_TEMPLATE_LOCATION + "user_update_bad_request_response.json", "invalidRequestDataRegOrgIdTest" }, new Object[] { updateUserWithRootOrgId(), - Constants.UPDATE_USER_TEMPLATE_LOCATION + "user_update_bad_request_response.json", + Constant.UPDATE_USER_TEMPLATE_LOCATION + "user_update_bad_request_response.json", "invalidRequestDataRootOrgIdTest" }, new Object[] { updateUserWithChannel(), - Constants.UPDATE_USER_TEMPLATE_LOCATION + "user_update_bad_request_response.json", + Constant.UPDATE_USER_TEMPLATE_LOCATION + "user_update_bad_request_response.json", "invalidRequestDataChannelTest" } }; @@ -154,8 +153,8 @@ public void testCreateUser(String requestJson, String responseJson, String testN .client(restTestClient) .send() .post(CREATE_USER_URI) - .contentType(Constants.CONTENT_TYPE_APPLICATION_JSON) - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()) + .contentType(Constant.CONTENT_TYPE_APPLICATION_JSON) + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()) .payload(requestJson); if (!"usersuccessresponse.json".equals(responseJson)) { http() @@ -186,8 +185,8 @@ public void testCreateUserFailure(String requestJson, String responseJson, Strin .client(restTestClient) .send() .post(CREATE_USER_URI) - .contentType(Constants.CONTENT_TYPE_APPLICATION_JSON) - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()) + .contentType(Constant.CONTENT_TYPE_APPLICATION_JSON) + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()) .payload(new ClassPathResource(requestJson)); http() .client(restTestClient) @@ -264,8 +263,8 @@ public void updateUserRequiredLoginActionTest() { .client(restTestClient) .send() .put("/auth/admin/realms/" + initGlobalValues.getRelam() + "/users/" + userId) - .header(Constants.AUTHORIZATION, Constants.BEARER + admin_token) - .contentType(Constants.CONTENT_TYPE_APPLICATION_JSON) + .header(Constant.AUTHORIZATION, Constant.BEARER + admin_token) + .contentType(Constant.CONTENT_TYPE_APPLICATION_JSON) .payload("{\"requiredActions\":[]}"); http().client(restTestClient).receive().response(HttpStatus.NO_CONTENT); } @@ -315,10 +314,10 @@ public void testUpdateUser(String requestJson, String responseJson, String testN .client(restTestClient) .send() .patch(UPDATE_USER_URI) - .contentType(Constants.CONTENT_TYPE_APPLICATION_JSON) - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()) + .contentType(Constant.CONTENT_TYPE_APPLICATION_JSON) + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()) .payload(requestJson) - .header(Constants.X_AUTHENTICATED_USER_TOKEN, user_auth_token); + .header(Constant.X_AUTHENTICATED_USER_TOKEN, user_auth_token); if (!"update_user_success_response.json".equals(responseJson)) { http() .client(restTestClient) @@ -338,10 +337,10 @@ public void getUserTest() { .client(restTestClient) .send() .get("/api/user/v1/read/" + userId + "?Fields=completeness,missingFields,topic") - .accept(Constants.CONTENT_TYPE_APPLICATION_JSON) - .header(Constants.AUTHORIZATION, Constants.BEARER + initGlobalValues.getApiKey()) - .contentType(Constants.CONTENT_TYPE_APPLICATION_JSON) - .header(Constants.X_AUTHENTICATED_USER_TOKEN, user_auth_token); + .accept(Constant.CONTENT_TYPE_APPLICATION_JSON) + .header(Constant.AUTHORIZATION, Constant.BEARER + initGlobalValues.getApiKey()) + .contentType(Constant.CONTENT_TYPE_APPLICATION_JSON) + .header(Constant.X_AUTHENTICATED_USER_TOKEN, user_auth_token); http() .client(restTestClient) .receive() @@ -392,8 +391,8 @@ private String createUserWithDuplicateExtIdAndProvider() { Map requestMap = new HashMap<>(); Map innerMap = createUserInnerMap(); innerMap.put( - Constant.EMAIL, Constants.USER_NAME_PREFIX + UUID.randomUUID().toString() + "@gmail.com"); - innerMap.put(Constant.USER_NAME, Constants.USER_NAME_PREFIX + UUID.randomUUID().toString()); + Constant.EMAIL, Constant.USER_NAME_PREFIX + UUID.randomUUID().toString() + "@gmail.com"); + innerMap.put(Constant.USER_NAME, Constant.USER_NAME_PREFIX + UUID.randomUUID().toString()); requestMap.put(Constant.REQUEST, innerMap); try { return objectMapper.writeValueAsString(requestMap); @@ -407,8 +406,8 @@ private String createUserWithInvalidChannel() { Map requestMap = new HashMap<>(); Map innerMap = createUserInnerMap(); innerMap.put( - Constant.EMAIL, Constants.USER_NAME_PREFIX + UUID.randomUUID().toString() + "@gmail.com"); - innerMap.put(Constant.USER_NAME, Constants.USER_NAME_PREFIX + UUID.randomUUID().toString()); + Constant.EMAIL, Constant.USER_NAME_PREFIX + UUID.randomUUID().toString() + "@gmail.com"); + innerMap.put(Constant.USER_NAME, Constant.USER_NAME_PREFIX + UUID.randomUUID().toString()); innerMap.put(Constant.EXTERNAL_ID, externalId + 123); innerMap.put(Constant.PROVIDER, provider + 234); innerMap.put(Constant.CHANNEL, "functionalTest#Invalid$Channel@1235123"); @@ -425,7 +424,7 @@ private String createUserWithDuplicateUserName() { Map requestMap = new HashMap<>(); Map innerMap = createUserInnerMap(); innerMap.put( - Constant.EMAIL, Constants.USER_NAME_PREFIX + UUID.randomUUID().toString() + "@gmail.com"); + Constant.EMAIL, Constant.USER_NAME_PREFIX + UUID.randomUUID().toString() + "@gmail.com"); requestMap.put(Constant.REQUEST, innerMap); try { return objectMapper.writeValueAsString(requestMap); @@ -438,7 +437,7 @@ private String createUserWithDuplicateUserName() { private String createUserWithDuplicateEmail() { Map requestMap = new HashMap<>(); Map innerMap = createUserInnerMap(); - innerMap.put(Constant.USER_NAME, Constants.USER_NAME_PREFIX + UUID.randomUUID().toString()); + innerMap.put(Constant.USER_NAME, Constant.USER_NAME_PREFIX + UUID.randomUUID().toString()); requestMap.put(Constant.REQUEST, innerMap); try { return objectMapper.writeValueAsString(requestMap); @@ -455,8 +454,8 @@ private static Map createUserInnerMap() { innerMap.put(Constant.PASSWORD, "password"); innerMap.put(Constant.EXTERNAL_ID, externalId); innerMap.put(Constant.PROVIDER, provider); - USER_NAME = Constants.USER_NAME_PREFIX + EndpointConfig.val; - String email = Constants.USER_NAME_PREFIX + EndpointConfig.val + "@gmail.com"; + USER_NAME = Constant.USER_NAME_PREFIX + EndpointConfig.val; + String email = Constant.USER_NAME_PREFIX + EndpointConfig.val + "@gmail.com"; innerMap.put(Constant.USER_NAME, USER_NAME); innerMap.put(Constant.EMAIL, email); return innerMap;