From 4751c29632d2f32abba85dd91296fb91672a2f59 Mon Sep 17 00:00:00 2001 From: Wojciech Sliwka Date: Tue, 25 Jun 2019 11:42:46 +0200 Subject: Extend probe mechanism Fixes from latest review. Introduce probe interface. ResponseWithRequestInfo is not used - it belongs to aai package and requires javax.ws.rs.core.Response. Fallback in aai client will be removed as soon as sdc provides https support (hopefully in El Alto). Change-Id: I4527d447a273328d38ff2ef7f9d2a93453cec9f2 Issue-ID: VID-490 Signed-off-by: Wojciech Sliwka --- .../src/main/java/org/onap/vid/services/VidServiceImpl.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java') diff --git a/vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java index 5ff227f3c..9d6f74def 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java @@ -52,6 +52,7 @@ import static org.onap.vid.properties.Features.FLAG_SERVICE_MODEL_CACHE; * The Class VidController. */ +@org.springframework.stereotype.Service public class VidServiceImpl implements VidService { /** * The Constant LOG. @@ -61,7 +62,6 @@ public class VidServiceImpl implements VidService { protected final AsdcClient asdcClient; private final FeatureManager featureManager; - @Autowired private ToscaParserImpl2 toscaParser; private final LoadingCache serviceModelCache; @@ -72,10 +72,11 @@ public class VidServiceImpl implements VidService { } } - public VidServiceImpl(AsdcClient asdcClient, FeatureManager featureManager) { + @Autowired + public VidServiceImpl(AsdcClient asdcClient, ToscaParserImpl2 toscaParser, FeatureManager featureManager) { this.asdcClient = asdcClient; this.featureManager = featureManager; - + this.toscaParser=toscaParser; this.serviceModelCache = CacheBuilder.newBuilder() .maximumSize(1000) .expireAfterAccess(7, TimeUnit.DAYS) @@ -148,13 +149,13 @@ public class VidServiceImpl implements VidService { } @Override - public ExternalComponentStatus probeSDCConnection() { + public ExternalComponentStatus probeComponent() { long startTime = System.currentTimeMillis(); ExternalComponentStatus externalComponentStatus; try { HttpResponse stringHttpResponse = asdcClient.checkSDCConnectivity(); - HttpRequestMetadata httpRequestMetadata = new HttpRequestMetadata(stringHttpResponse, HttpMethod.GET, "SDC healthCheck", - System.currentTimeMillis() - startTime, AsdcClient.URIS.HEALTH_CHECK_ENDPOINT); + HttpRequestMetadata httpRequestMetadata = new HttpRequestMetadata(HttpMethod.GET, stringHttpResponse.getStatus(), asdcClient.getBaseUrl() + AsdcClient.URIS.HEALTH_CHECK_ENDPOINT, stringHttpResponse.getBody(), "SDC healthCheck", + System.currentTimeMillis() - startTime); externalComponentStatus = new ExternalComponentStatus(ExternalComponentStatus.Component.SDC, stringHttpResponse.isSuccessful(), httpRequestMetadata); } catch (Exception e) { HttpRequestMetadata httpRequestMetadata = new HttpRequestMetadata(HttpMethod.GET, 0, -- cgit 1.2.3-korg