Skip to content

Commit

Permalink
Merge branch 'portal_autosetup_2405' into portal_autosetup_2405_part2
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinargade123 committed May 24, 2024
2 parents 663bcbd + f367753 commit 72e5d20
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public ResponseEntity<String> handleValidationException(ValidationException ex,
}

@ExceptionHandler(FeignException.class)
public ResponseEntity<Map<String, String>> handleFeignException(FeignException ex, WebRequest request) {
public ResponseEntity<Map<String, String>> handleFeignException(FeignException ex) {
log.error("FeignException: " + ex.getMessage());
log.error("FeignException RequestBody: " + ex.request());
log.error("FeignException ResponseBody: " + ex.contentUTF8());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private String checkSubcriptionHaveConnectorRegister(Map<String, String> header,
String remoteSubscriptionId = "";//JsonObjectProcessingUtility.getValueFromJsonNode(jsonNode,
//SUBSCRIPTION_ID);

if (subscriptionId.equalsIgnoreCase(remoteSubscriptionId)) {
if (subscriptionId.equalsIgnoreCase(remoteSubscriptionId) && jsonNode!=null) {

JsonNode connectorIds = null;//JsonObjectProcessingUtility.getArrayNodeFromJsonNode(jsonNode,
//"connectorIds");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ private ServiceInstanceResultResponse processAppServiceGetResponse(String subscr
String appServiceURIPath) {

ServiceInstanceResultResponse serviceInstanceResultResponse = verifyIsAlreadySubcribedActivatedAndGetDetails(
subscriptionId, offerId, header, serviceInstanceResultRequest, appServiceURIPath);
subscriptionId, offerId, header, appServiceURIPath);

if (serviceInstanceResultResponse == null) {

Expand All @@ -221,23 +221,22 @@ private ServiceInstanceResultResponse processAppServiceGetResponse(String subscr
log.info("Post App/Service instanceURL, going to read credentials asynchronously");

serviceInstanceResultResponse = verifyIsAlreadySubcribedActivatedAndGetDetails(subscriptionId, offerId,
header, serviceInstanceResultRequest, appServiceURIPath);
header, appServiceURIPath);

}

if (serviceInstanceResultResponse == null) {
throw new ServiceException("Unable to read technical user detials from portal auto setup");
}

readTechnicalUserDetails(subscriptionId, header, serviceInstanceResultResponse);
readTechnicalUserDetails(header, serviceInstanceResultResponse);

return serviceInstanceResultResponse;
}

@SneakyThrows
private ServiceInstanceResultResponse verifyIsAlreadySubcribedActivatedAndGetDetails(String subscriptionId,
String offerId, Map<String, String> header, ServiceInstanceResultRequest serviceInstanceResultRequest,
String appServiceURIPath) {
String offerId, Map<String, String> header, String appServiceURIPath) {

int retry = 5;
int counter = 1;
Expand All @@ -256,28 +255,28 @@ private ServiceInstanceResultResponse verifyIsAlreadySubcribedActivatedAndGetDet

offerSubscriptionStatus = serviceInstanceResultResponse.getOfferSubscriptionStatus();

log.info("VerifyIsAlreadySubcribedActivatedAndGetDetails: The subscription details found for " + offerId
log.info(LogUtil.encode("VerifyIsAlreadySubcribedActivatedAndGetDetails: The subscription details found for " + offerId
+ ", " + subscriptionId + ", status is " + offerSubscriptionStatus + ", result is "
+ serviceInstanceResultResponse.toJsonString());
+ serviceInstanceResultResponse.toJsonString()));

} catch (FeignException e) {
log.error("VerifyIsAlreadySubcribedActivatedAndGetDetails FeignException request: " + e.request());
log.error("VerifyIsAlreadySubcribedActivatedAndGetDetails FeignException response Body: "
+ e.responseBody());
log.error(LogUtil.encode("VerifyIsAlreadySubcribedActivatedAndGetDetails FeignException request: " + e.request()));
log.error(LogUtil.encode("VerifyIsAlreadySubcribedActivatedAndGetDetails FeignException response Body: "
+ e.responseBody()));
String error = e.contentUTF8();
error = StringUtils.isAllEmpty(error) ? error : e.getMessage();

if (e.status() == 404) {
log.warn("VerifyIsAlreadySubcribedActivatedAndGetDetails: The no app or subscription found for "
+ offerId + ", " + subscriptionId + ", result is " + error);
log.warn(LogUtil.encode("VerifyIsAlreadySubcribedActivatedAndGetDetails: The no app or subscription found for "
+ offerId + ", " + subscriptionId + ", result is " + error));
} else {
log.error("VerifyIsAlreadySubcribedActivatedAndGetDetails FeignException Exception response: "
+ error);
log.error(LogUtil.encode("VerifyIsAlreadySubcribedActivatedAndGetDetails FeignException Exception response: "
+ error));
}

} catch (Exception e) {
log.error("VerifyIsAlreadySubcribedActivatedAndGetDetails Exception processing portal call "
+ e.getMessage());
log.error(LogUtil.encode("VerifyIsAlreadySubcribedActivatedAndGetDetails Exception processing portal call "
+ e.getMessage()));
}
counter++;

Expand All @@ -287,7 +286,7 @@ private ServiceInstanceResultResponse verifyIsAlreadySubcribedActivatedAndGetDet
}

@SneakyThrows
private void readTechnicalUserDetails(String subscriptionId, Map<String, String> header,
private void readTechnicalUserDetails(Map<String, String> header,
ServiceInstanceResultResponse serviceInstanceResultResponse) {

if (serviceInstanceResultResponse.getTechnicalUserData() != null) {
Expand Down

0 comments on commit 72e5d20

Please sign in to comment.