Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
UAT Release (#17)
Browse files Browse the repository at this point in the history
Co-authored-by: gdellorusso <[email protected]>
Co-authored-by: melissa-dellorco <[email protected]>
Co-authored-by: gdellorusso <[email protected]>
Co-authored-by: Melissa <[email protected]>
Co-authored-by: alessio-creo <[email protected]>
Co-authored-by: angelaantoniaceaa <[email protected]>
Co-authored-by: luigifortunato00 <[email protected]>
Co-authored-by: angelaantonia.cea <[email protected]>
Co-authored-by: AlessandroColucci <[email protected]>
Co-authored-by: acolucci <[email protected]>
  • Loading branch information
11 people authored Aug 1, 2023
1 parent f872323 commit 352ed16
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/openapi/probing-service-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tags:
Read data operations.
paths:
'/interop/probing/v1':
'/interop/probing':
get:
summary: Provides the status of the E-Service
tags:
Expand Down
2 changes: 1 addition & 1 deletion docs/xsd/probing_v1.xsd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<xsd:schema
targetNamespace="http://it/pagopa/interop/probing/v1"
targetNamespace="http://it/pagopa/interop/probing"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="probingRequest">
<xsd:complexType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public interface FeignSoapClient {

@RequestLine("POST")
@Headers({"SOAPAction: probing/v1", "Content-Type: text/xml;charset=UTF-8",
@Headers({"SOAPAction: interop/probing", "Content-Type: text/xml;charset=UTF-8",
"Authorization:Bearer {Authorization}", "Accept: text/xml"})
ProbingResponse probing(URI url, ProbingRequest body,
@Param(HttpHeaders.AUTHORIZATION) String authorizationHeader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import java.io.IOException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import com.amazonaws.SdkBaseException;
import com.amazonaws.xray.AWSXRay;
import com.fasterxml.jackson.databind.ObjectMapper;
import feign.Response;
Expand All @@ -17,6 +19,7 @@
import it.pagopa.interop.probing.caller.dtos.Problem;
import it.pagopa.interop.probing.caller.soap.probing.ObjectFactory;
import it.pagopa.interop.probing.caller.soap.probing.ProbingResponse;
import it.pagopa.interop.probing.caller.util.constant.ProjectConstants;
import it.pagopa.interop.probing.caller.util.logging.Logger;

@Component
Expand Down Expand Up @@ -48,9 +51,11 @@ public TelemetryDto callProbing(EserviceContentDto service) {
} else {
telemetryResult = callSoap(telemetryResult, service);
}

} catch (Exception e) {
} catch (SdkBaseException e) {
logger.logMessageException(e);
throw e;
} catch (Exception e) {
logger.logMessageHandledException(e);
telemetryResult.status(EserviceStatus.KO).koReason(e.getMessage());
}
logger.logMessageResponseCallProbing(telemetryResult);
Expand All @@ -61,9 +66,11 @@ private TelemetryDto callRest(TelemetryDto telemetryResult, EserviceContentDto s
throws IOException {
long before = System.currentTimeMillis();
telemetryResult.checkTime(String.valueOf(before));
AWSXRay.beginSubsegment("Rest_call_to :".concat(service.basePath()[0]));
Response response = restClientConfig.feignRestClient()
.probing(URI.create(service.basePath()[0]), jwtBuilder.buildJWT(service.audience()));
String eserviceUrl = StringUtils.removeEnd(service.basePath()[0], "/")
+ ProjectConstants.PROBING_ENDPOINT_SUFFIX;
AWSXRay.beginSubsegment("Rest_call_to :".concat(eserviceUrl));
Response response = restClientConfig.feignRestClient().probing(URI.create(eserviceUrl),
jwtBuilder.buildJWT(service.audience()));
AWSXRay.endSubsegment();
long elapsedTime = System.currentTimeMillis() - before;
return receiverResponse(response.status(), telemetryResult, decodeReason(response, elapsedTime),
Expand All @@ -74,10 +81,11 @@ private TelemetryDto callSoap(TelemetryDto telemetryResult, EserviceContentDto s
ObjectFactory o = new ObjectFactory();
long before = System.currentTimeMillis();
telemetryResult.checkTime(String.valueOf(before));
AWSXRay.beginSubsegment("Soap_call_to :".concat(service.basePath()[0]));
ProbingResponse response =
soapClientConfig.feignSoapClient().probing(URI.create(service.basePath()[0]),
o.createProbingRequest(), jwtBuilder.buildJWT(service.audience()));
String eserviceUrl = StringUtils.removeEnd(service.basePath()[0], "/")
+ ProjectConstants.PROBING_ENDPOINT_SUFFIX;
AWSXRay.beginSubsegment("Soap_call_to :".concat(eserviceUrl));
ProbingResponse response = soapClientConfig.feignSoapClient().probing(URI.create(eserviceUrl),
o.createProbingRequest(), jwtBuilder.buildJWT(service.audience()));
AWSXRay.endSubsegment();
long elapsedTime = System.currentTimeMillis() - before;
return receiverResponse(Integer.valueOf(response.getStatus()), telemetryResult,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ private ProjectConstants() {

public static final String SQS_TELEMETRY_LOG_LABEL = "Telemetry result";
public static final String SQS_POLLING_LOG_LABEL = "Polling result";
public static final String PROBING_ENDPOINT_SUFFIX = "/interop/probing";
public static final String JWT_SIGNING_ALGORITHM = "RSASSA_PKCS1_V1_5_SHA_256";

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public interface Logger {

void logMessageException(Exception exception);

void logMessageHandledException(Exception exception);

void logMessageCallProbing(String technology, String url);

void logResultCallProbing(int code, String body, long elapsedTime);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ public void logMessageException(Exception exception) {
log.error(ExceptionUtils.getStackTrace(exception));
}

@Override
public void logMessageHandledException(Exception exception) {
log.info(ExceptionUtils.getStackTrace(exception));
}

}
5 changes: 1 addition & 4 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@ feign.client.config.default.loggerLevel = FULL
threadpool.max-pool-size=${THREADPOOL_MAX_POOL_SIZE}
threadpool.queue-capacity=${THREADPOOL_QUEUE_CAPACITY}
threadpool.core-pool-size=${THREADPOOL_CORE_POOL_SIZE}
threadpool.thread-name-prefix=${THREADPOOL_THREAD_NAME_PREFIX}



threadpool.thread-name-prefix=${THREADPOOL_THREAD_NAME_PREFIX}

0 comments on commit 352ed16

Please sign in to comment.