Skip to content

Commit

Permalink
Moved New API in PATCH method in order to get Application details and…
Browse files Browse the repository at this point in the history
… update application endpoints.
  • Loading branch information
vertigo17 committed Dec 27, 2023
1 parent dc89b19 commit c8792d3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.springframework.stereotype.Service;
import org.cerberus.core.crud.service.ICountryEnvironmentParametersService;
import org.cerberus.core.crud.service.ILogEventService;
import org.cerberus.core.util.StringUtil;
import org.cerberus.core.util.answer.AnswerUtil;

/**
Expand Down Expand Up @@ -207,6 +208,10 @@ public Answer compareListAndUpdateInsertDeleteElements(String system, String app
for (CountryEnvironmentParameters objectDifference : listToUpdateOrInsertToIterate) {
for (CountryEnvironmentParameters objectInDatabase : oldList) {
if (objectDifference.hasSameKey(objectInDatabase)) {
// If new value has a SECRET String, we replace it by the initial Password.
if (objectDifference.getIp().contains(StringUtil.SECRET_STRING)) {
objectDifference.setIp(objectDifference.getIp().replace(StringUtil.SECRET_STRING, StringUtil.getPasswordFromAnyUrl(objectInDatabase.getIp())));
}
ans = this.update(objectDifference);
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, ans);
listToUpdateOrInsert.remove(objectDifference);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.cerberus.core.enums.MessageEventEnum;
import org.cerberus.core.exception.CerberusException;
import org.cerberus.core.util.ParameterParserUtil;
import org.cerberus.core.util.StringUtil;
import org.cerberus.core.util.answer.AnswerItem;
import org.cerberus.core.util.answer.AnswerList;
import org.cerberus.core.util.answer.AnswerUtil;
Expand Down Expand Up @@ -79,7 +80,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re

// Calling Servlet Transversal Util.
ServletUtil.servletStart(request);

// Default message to unexpected error.
MessageEvent msg = new MessageEvent(MessageEventEnum.DATA_OPERATION_ERROR_UNEXPECTED);
msg.setDescription(msg.getDescription().replace("%DESCRIPTION%", ""));
Expand Down Expand Up @@ -204,6 +205,10 @@ private AnswerItem<JSONObject> findCountryEnvironmentParametersList(String syste
private JSONObject convertCountryEnvParamtoJSONObject(CountryEnvironmentParameters cepl) throws JSONException {
Gson gson = new Gson();
JSONObject result = new JSONObject(gson.toJson(cepl));
if (StringUtil.isNotEmptyOrNullValue(StringUtil.getPasswordFromAnyUrl(cepl.getIp()))) {
result.put("ip", cepl.getIp().replace(StringUtil.getPasswordFromAnyUrl(cepl.getIp()), StringUtil.SECRET_STRING));
}

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* Added possibility to get base64 value from application object using syntax : %object.OBJNAME.base64%. That allow to use object pictures as file upload on test cases.
* New API in order to get Application details and update application endpoints.
* Preselect country environment and robot on rerun testcase modal.
* Secure Password display from URL in execution modal and application modal


*Warning to be considered before applying the version (deprecated features)*
Expand Down

0 comments on commit c8792d3

Please sign in to comment.