Skip to content

Commit

Permalink
MOSIP-36037 : Sonar coverage (#1071)
Browse files Browse the repository at this point in the history
Signed-off-by: sudeep <[email protected]>
  • Loading branch information
Sudeep7353 authored Jan 7, 2025
1 parent 34636a2 commit 3aea9eb
Show file tree
Hide file tree
Showing 3 changed files with 602 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,12 @@ public FtpCertificateResponseDto uploadCertificate(FtpChipCertificateRequestDto
RequestWrapper<FtpCertificateRequestDto> request = new RequestWrapper<>();
request.setRequest(certRequest);
Map<String, Object> uploadApiResponse = restUtil.postApi(environment.getProperty("pmp.partner.certificaticate.upload.rest.uri"), null, "", "",
MediaType.APPLICATION_JSON, request, Map.class);
FtpCertificateResponseDto responseObject = mapper.readValue(mapper.writeValueAsString(uploadApiResponse.get("response")), FtpCertificateResponseDto.class);
if(responseObject == null && uploadApiResponse.containsKey(ERRORS)) {
MediaType.APPLICATION_JSON, request, Map.class);
if(uploadApiResponse == null) {
throw new ApiAccessibleException(ApiAccessibleExceptionConstant.API_NULL_RESPONSE_EXCEPTION.getErrorCode(),
ApiAccessibleExceptionConstant.API_NULL_RESPONSE_EXCEPTION.getErrorMessage());
}
if(uploadApiResponse.containsKey(ERRORS)) {
List<Map<String, Object>> certServiceErrorList = (List<Map<String, Object>>) uploadApiResponse.get(ERRORS);
if(!certServiceErrorList.isEmpty()) {
throw new ApiAccessibleException(certServiceErrorList.get(0).get(ERRORCODE).toString(),certServiceErrorList.get(0).get(ERRORMESSAGE).toString());
Expand All @@ -363,11 +366,7 @@ public FtpCertificateResponseDto uploadCertificate(FtpChipCertificateRequestDto
ApiAccessibleExceptionConstant.UNABLE_TO_PROCESS.getErrorMessage());
}
}
if(responseObject == null) {
throw new ApiAccessibleException(ApiAccessibleExceptionConstant.API_NULL_RESPONSE_EXCEPTION.getErrorCode(),
ApiAccessibleExceptionConstant.API_NULL_RESPONSE_EXCEPTION.getErrorMessage());
}

FtpCertificateResponseDto responseObject = mapper.readValue(mapper.writeValueAsString(uploadApiResponse.get("response")), FtpCertificateResponseDto.class);
FTPChipDetail updateObject = chipDetail.get();
updateObject.setCertificateAlias(responseObject.getCertificateId());
Authentication authN = SecurityContextHolder.getContext().getAuthentication();
Expand Down
Loading

0 comments on commit 3aea9eb

Please sign in to comment.