Extend probe mechanism 29/90429/3
authorWojciech Sliwka <wojciech.sliwka@nokia.com>
Tue, 25 Jun 2019 09:42:46 +0000 (11:42 +0200)
committerWojciech Sliwka <wojciech.sliwka@nokia.com>
Mon, 1 Jul 2019 07:24:34 +0000 (09:24 +0200)
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 <wojciech.sliwka@nokia.com>
23 files changed:
vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClient.java
vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClientInterface.java
vid-app-common/src/main/java/org/onap/vid/asdc/AsdcClient.java
vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java
vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java
vid-app-common/src/main/java/org/onap/vid/controller/ProbeController.java
vid-app-common/src/main/java/org/onap/vid/controller/ProbeInterface.java [new file with mode: 0644]
vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
vid-app-common/src/main/java/org/onap/vid/model/probes/HttpRequestMetadata.java
vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerService.java
vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerServiceImpl.java
vid-app-common/src/main/java/org/onap/vid/services/VidService.java
vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java
vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java
vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientTest.java
vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java
vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
vid-app-common/src/test/java/org/onap/vid/services/SchedulerServiceImplTest.java
vid-app-common/src/test/java/org/onap/vid/services/VidServiceImplTest.java

index 1710d98..7b78f07 100644 (file)
@@ -744,7 +744,7 @@ public class AaiClient implements AaiClientInterface {
     }
 
     @Override
-    public ExternalComponentStatus probeAaiGetAllSubscribers(){
+    public ExternalComponentStatus probeComponent(){
         long startTime = System.currentTimeMillis();
         try {
             AaiResponseWithRequestInfo<SubscriberList> responseWithRequestInfo = getAllSubscribers(true);
index 43be049..3f91464 100644 (file)
@@ -31,13 +31,12 @@ import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
 import org.onap.vid.aai.model.PortDetailsTranslator;
 import org.onap.vid.aai.model.Properties;
 import org.onap.vid.aai.model.ResourceType;
+import org.onap.vid.controller.ProbeInterface;
 import org.onap.vid.model.SubscriberList;
-import org.onap.vid.model.probes.ExternalComponentStatus;
-
 /**
  * Created by Oren on 7/4/17.
  */
-public interface AaiClientInterface {
+public interface AaiClientInterface  extends ProbeInterface {
 
     boolean isNodeTypeExistsByName(String name, ResourceType type);
 
@@ -87,8 +86,6 @@ public interface AaiClientInterface {
 
     AaiResponse getInstanceGroupsByVnfInstanceId(String vnfInstanceId);
 
-    ExternalComponentStatus probeAaiGetAllSubscribers();
-
     Response doAaiGet(String uri, boolean xml);
 
     String getCloudOwnerByCloudRegionId(String cloudRegionId);
index 46bb6ce..6dc7b68 100644 (file)
@@ -98,7 +98,7 @@ public class AaiOverTLSClient implements AaiOverTLSClientInterface {
     }
 
     @Override
-    public ExternalComponentStatus probeGetAllSubscribers() {
+    public ExternalComponentStatus probeComponent() {
         String url = urlBase + String.format(URIS.SUBSCRIBERS, 0);
         long startTime = System.currentTimeMillis();
         ExternalComponentStatus externalComponentStatus;
index c430b09..4cc9589 100644 (file)
@@ -23,10 +23,10 @@ package org.onap.vid.aai;
 import io.joshworks.restclient.http.HttpResponse;
 import org.onap.portalsdk.core.util.SystemProperties;
 import org.onap.vid.aai.model.ResourceType;
+import org.onap.vid.controller.ProbeInterface;
 import org.onap.vid.model.SubscriberList;
-import org.onap.vid.model.probes.ExternalComponentStatus;
 
-public interface AaiOverTLSClientInterface {
+public interface AaiOverTLSClientInterface extends ProbeInterface {
 
     class URIS {
 
@@ -48,7 +48,4 @@ public interface AaiOverTLSClientInterface {
 
     HttpResponse<SubscriberList> getAllSubscribers();
 
-
-    ExternalComponentStatus probeGetAllSubscribers();
-
 }
index e264e4e..fc04080 100644 (file)
@@ -56,4 +56,6 @@ public interface AsdcClient {
 
 
        HttpResponse<String> checkSDCConnectivity();
+
+       String getBaseUrl();
 }
index 0bd581a..7cfd094 100644 (file)
@@ -163,6 +163,12 @@ public class LocalAsdcClient implements AsdcClient {
         return HttpResponse.fallback("");
     }
 
+
+    @Override
+    public String getBaseUrl(){
+        return "";
+    }
+
     /**
      * The Class Builder.
      */
index 428083e..a821107 100644 (file)
@@ -98,6 +98,7 @@ public class SdcRestClient implements AsdcClient {
     }
 
 
+    @Override
     public HttpResponse<String> checkSDCConnectivity() {
         String finalUrl = baseUrl + URIS.HEALTH_CHECK_ENDPOINT;
 
@@ -105,6 +106,11 @@ public class SdcRestClient implements AsdcClient {
                 .get(finalUrl, prepareHeaders(auth, APPLICATION_JSON), Collections.emptyMap(), String.class);
     }
 
+    @Override
+    public String getBaseUrl() {
+        return baseUrl;
+    }
+
     private Map<String, String> prepareHeaders(String auth, String contentType) {
         return ImmutableMap.of(
                 X_ECOMP_INSTANCE_ID, SystemProperties.getProperty(APP_DISPLAY_NAME),
index 0206af4..c181c6f 100644 (file)
 package org.onap.vid.controller;
 
 import org.onap.portalsdk.core.controller.RestrictedBaseController;
-import org.onap.vid.aai.AaiClient;
-import org.onap.vid.aai.AaiOverTLSClientInterface;
 import org.onap.vid.model.probes.ExternalComponentStatus;
-import org.onap.vid.mso.MsoBusinessLogic;
-import org.onap.vid.scheduler.SchedulerService;
-import org.onap.vid.services.VidService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("probe")
 public class ProbeController extends RestrictedBaseController {
 
-    private final AaiClient aaiClient;
-    private final AaiOverTLSClientInterface newAaiClient;
-    private final VidService vidService;
-    private final MsoBusinessLogic msoBusinessLogic;
-    private final SchedulerService schedulerService;
-
+    private final List<ProbeInterface> probes;
 
     @Autowired
-    public ProbeController(AaiClient aaiClient, VidService vidService, MsoBusinessLogic msoBusinessLogic, SchedulerService schedulerService, AaiOverTLSClientInterface newAaiClient) {
-        this.aaiClient = aaiClient;
-        this.vidService = vidService;
-        this.msoBusinessLogic = msoBusinessLogic;
-        this.schedulerService = schedulerService;
-        this.newAaiClient = newAaiClient;
+    public ProbeController(List<ProbeInterface> probes) {
+        this.probes = probes;
     }
 
     @GetMapping
     public List<ExternalComponentStatus> getProbe() {
-        List<ExternalComponentStatus> componentStatuses = new ArrayList<>();
-        componentStatuses.add(aaiClient.probeAaiGetAllSubscribers());
-        componentStatuses.add(newAaiClient.probeGetAllSubscribers());
-        componentStatuses.add(schedulerService.probeGetSchedulerChangeManagements());
-        componentStatuses.add(msoBusinessLogic.probeGetOrchestrationRequests());
-        componentStatuses.add(vidService.probeSDCConnection());
-        return componentStatuses;
+        return probes.stream().map(ProbeInterface::probeComponent).collect(Collectors.toList());
     }
-
 }
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/ProbeInterface.java b/vid-app-common/src/main/java/org/onap/vid/controller/ProbeInterface.java
new file mode 100644 (file)
index 0000000..1b32659
--- /dev/null
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2019 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.vid.controller;
+
+import org.onap.vid.model.probes.ExternalComponentStatus;
+
+public interface ProbeInterface {
+    ExternalComponentStatus probeComponent();
+}
index e00c2d7..fc656fc 100644 (file)
@@ -68,11 +68,6 @@ public class WebConfig {
     }
 
 
-    @Bean
-    public VidService vidService(AsdcClient asdcClient, FeatureManager featureManager) {
-        return new VidServiceImpl(asdcClient, featureManager);
-    }
-
     @Bean
     public SchedulerService schedulerService(ChangeManagementService changeManagementService) {
         return new SchedulerServiceImpl(changeManagementService);
index 58d9e24..1638a37 100644 (file)
@@ -81,10 +81,6 @@ public class HttpRequestMetadata extends StatusMetadata {
                 duration);
     }
 
-    public HttpRequestMetadata(HttpResponse<String> response, HttpMethod method, String description, long duration, String url) {
-        this(method, response.getStatus(), url, response.getBody(), description, duration);
-    }
-
 
 
     public HttpMethod getHttpMethod() {
index 23c891f..ed64d20 100644 (file)
@@ -24,9 +24,9 @@ package org.onap.vid.mso;
 import org.onap.vid.changeManagement.RequestDetailsWrapper;
 import org.onap.vid.changeManagement.WorkflowRequestDetail;
 import org.onap.vid.controller.OperationalEnvironmentController;
+import org.onap.vid.controller.ProbeInterface;
 import org.onap.vid.model.SOWorkflowList;
 import org.onap.vid.model.SoftDeleteRequest;
-import org.onap.vid.model.probes.ExternalComponentStatus;
 import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo;
 import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo;
 import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails;
@@ -37,7 +37,7 @@ import org.onap.vid.mso.rest.Task;
 import java.util.List;
 import java.util.UUID;
 
-public interface MsoBusinessLogic {
+public interface MsoBusinessLogic extends ProbeInterface {
 
     // this function should get params from tosca and send them to instance at mso, then return success response.
     MsoResponseWrapper createSvcInstance(RequestDetails msoRequest);
@@ -142,6 +142,4 @@ public interface MsoBusinessLogic {
     MsoResponseWrapper2 activateFabricConfiguration(String serviceInstanceId, RequestDetails requestDetails);
 
     SOWorkflowList getWorkflowListByModelId(String modelVersionId);
-
-    ExternalComponentStatus probeGetOrchestrationRequests();
 }
index c2ac51a..dbeaa90 100644 (file)
@@ -28,7 +28,6 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import io.joshworks.restclient.http.HttpResponse;
 import org.apache.commons.collections4.ListUtils;
-import org.jetbrains.annotations.NotNull;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.util.SystemProperties;
 import org.onap.vid.changeManagement.ChangeManagementRequest;
@@ -866,17 +865,15 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
 
 
     @Override
-    public ExternalComponentStatus probeGetOrchestrationRequests() {
+    public ExternalComponentStatus probeComponent() {
         String url = SystemProperties.getProperty(
                 MsoProperties.MSO_SERVER_URL) + "/" + SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS);
         long startTime = System.currentTimeMillis();
         ExternalComponentStatus externalComponentStatus;
 
         try {
-            RestObject<List<Request>> restObject = createRequestsList(getOrchestrationRequestsForDashboard());
-
-            StatusMetadata statusMetadata = new HttpRequestMetadata(new RestObjectWithRequestInfo(HttpMethod.GET, url, restObject),
-                    "VID-SO communication works", System.currentTimeMillis() - startTime);
+            String rawBody = objectMapper.writeValueAsString(getOrchestrationRequestsForDashboard());
+            StatusMetadata statusMetadata=new HttpRequestMetadata(HttpMethod.GET,200,url,rawBody,"VID-SO",System.currentTimeMillis() - startTime);
 
             externalComponentStatus = new ExternalComponentStatus(ExternalComponentStatus.Component.MSO, true, statusMetadata);
         } catch (Exception e) {
@@ -887,15 +884,6 @@ public class MsoBusinessLogicImpl implements MsoBusinessLogic {
         return externalComponentStatus;
     }
 
-    @NotNull
-    private RestObject<List<Request>> createRequestsList(List<Request> orchestrationRequestsForDashboard) {
-        RestObject<List<Request>> restObject = new RestObject<>();
-        restObject.set(orchestrationRequestsForDashboard);
-        restObject.setStatusCode(200);
-        return restObject;
-    }
-
-
     private void validateUpdateVnfConfig(RequestDetails requestDetails) {
         final String noValidPayloadMsg = "No valid payload in " + ChangeManagementRequest.CONFIG_UPDATE + " request";
 
index 5a38bc0..643cd22 100644 (file)
@@ -20,8 +20,7 @@
 
 package org.onap.vid.scheduler;
 
-import org.onap.vid.model.probes.ExternalComponentStatus;
+import org.onap.vid.controller.ProbeInterface;
 
-public interface SchedulerService {
-    ExternalComponentStatus probeGetSchedulerChangeManagements();
+public interface SchedulerService  extends ProbeInterface {
 }
index d4f136a..5513cf4 100644 (file)
@@ -40,7 +40,7 @@ public class SchedulerServiceImpl implements SchedulerService{
     }
 
     @Override
-    public ExternalComponentStatus probeGetSchedulerChangeManagements() {
+    public ExternalComponentStatus probeComponent() {
         long startTime = System.currentTimeMillis();
         try {
             RestObjectWithRequestInfo response = this.changeManagementService.getSchedulerChangeManagementsWithRequestInfo();
index 1143a8e..18d8398 100644 (file)
 package org.onap.vid.services;
 
 import org.onap.vid.asdc.AsdcCatalogException;
+import org.onap.vid.controller.ProbeInterface;
 import org.onap.vid.model.ServiceModel;
-import org.onap.vid.model.probes.ExternalComponentStatus;
 
-public interface VidService {
+public interface VidService extends ProbeInterface {
 
        ServiceModel getService(String uuid) throws AsdcCatalogException;
 
     void invalidateServiceCache();
-
-    ExternalComponentStatus probeSDCConnection();
 }
index 5ff227f..9d6f74d 100644 (file)
@@ -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<String, ServiceModel> 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<String> 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,
index b98e200..fdeeb00 100644 (file)
@@ -146,8 +146,8 @@ public class AaiClientTest {
                 new AaiResponseWithRequestInfo<>(
                         HttpMethod.GET, "url", new AaiResponse<>(subscribers, null, 200),
                         "rawData"));
-        Mockito.when(aaiClientMock.probeAaiGetAllSubscribers()).thenCallRealMethod();
-        ExternalComponentStatus result  = aaiClientMock.probeAaiGetAllSubscribers();
+        Mockito.when(aaiClientMock.probeComponent()).thenCallRealMethod();
+        ExternalComponentStatus result  = aaiClientMock.probeComponent();
         assertThat(statusDataReflected(result),is(statusDataReflected(expectedStatus)));
         assertThat(requestMetadataReflected(result.getMetadata()),is(requestMetadataReflected(expectedStatus.getMetadata())));
     }
@@ -278,8 +278,8 @@ public class AaiClientTest {
     }
 
     private ExternalComponentStatus callProbeAaiGetAllSubscribersAndAssertNotAvailable() {
-        Mockito.when(aaiClientMock.probeAaiGetAllSubscribers()).thenCallRealMethod();
-        ExternalComponentStatus result  = aaiClientMock.probeAaiGetAllSubscribers();
+        Mockito.when(aaiClientMock.probeComponent()).thenCallRealMethod();
+        ExternalComponentStatus result  = aaiClientMock.probeComponent();
         assertFalse(result.isAvailable());
         return result;
     }
index da937ca..a1b750e 100644 (file)
@@ -102,7 +102,7 @@ public class AaiOverTLSClientTest {
         when(response.isSuccessful()).thenReturn(true);
 
 
-        ExternalComponentStatus externalComponentStatus = aaiRestClient.probeGetAllSubscribers();
+        ExternalComponentStatus externalComponentStatus = aaiRestClient.probeComponent();
 
         assertThat(externalComponentStatus.isAvailable()).isTrue();
         assertThat(externalComponentStatus.getComponent()).isEqualTo(ExternalComponentStatus.Component.AAI);
@@ -114,7 +114,7 @@ public class AaiOverTLSClientTest {
         when(syncRestClient.get(contains(SUBSCRIBERS), eq(getHeaders()), eq(Collections.emptyMap()),
                 eq(SubscriberList.class))).thenThrow(new RuntimeException("call failed"));
 
-        ExternalComponentStatus externalComponentStatus = aaiRestClient.probeGetAllSubscribers();
+        ExternalComponentStatus externalComponentStatus = aaiRestClient.probeComponent();
 
         assertThat(externalComponentStatus.isAvailable()).isFalse();
         assertThat(externalComponentStatus.getComponent()).isEqualTo(ExternalComponentStatus.Component.AAI);
index 6a49396..7e50c89 100644 (file)
@@ -60,8 +60,8 @@ public class LocalWebConfig {
 
 
     @Bean
-    public VidService vidService(AsdcClient asdcClient, FeatureManager featureManager) {
-        return new VidServiceImpl(asdcClient, featureManager);
+    public VidService vidService(AsdcClient asdcClient, ToscaParserImpl2 toscaParserImpl2,FeatureManager featureManager) {
+        return new VidServiceImpl(asdcClient,toscaParserImpl2, featureManager);
     }
 
     @Bean
index 8681ecb..a7fa8cd 100644 (file)
@@ -1398,7 +1398,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
         given(msoInterface.getOrchestrationRequest(anyString(),anyString(),
                 anyString(),any(RestObject.class),anyBoolean())).willReturn(wrapper);
 
-        ExternalComponentStatus externalComponentStatus = msoBusinessLogic.probeGetOrchestrationRequests();
+        ExternalComponentStatus externalComponentStatus = msoBusinessLogic.probeComponent();
 
         assertThat(externalComponentStatus.isAvailable()).isTrue();
         assertThat(externalComponentStatus.getComponent()).isEqualTo(ExternalComponentStatus.Component.MSO);
index b959fa6..fd562ac 100644 (file)
@@ -123,7 +123,7 @@ public class SchedulerServiceImplTest extends AbstractTestNGSpringContextTests {
                 restObjectWithRequestInfo
         );
 
-        final ExternalComponentStatus schedulerStatus = schedulerService.probeGetSchedulerChangeManagements();
+        final ExternalComponentStatus schedulerStatus = schedulerService.probeComponent();
 
         assertSchedulerStatus(schedulerStatus, true);
         assertMetadata(schedulerStatus, 200, startsWith(responseString.substring(0, 400)), "my pretty url", equalTo("OK"));
@@ -142,7 +142,7 @@ public class SchedulerServiceImplTest extends AbstractTestNGSpringContextTests {
                 restObjectWithRequestInfo
         );
 
-        final ExternalComponentStatus schedulerStatus = schedulerService.probeGetSchedulerChangeManagements();
+        final ExternalComponentStatus schedulerStatus = schedulerService.probeComponent();
 
         assertSchedulerStatus(schedulerStatus, true);
 
@@ -160,7 +160,7 @@ public class SchedulerServiceImplTest extends AbstractTestNGSpringContextTests {
         when(changeManagementService.getSchedulerChangeManagementsWithRequestInfo()).thenThrow(new ExceptionWithRequestInfo(HttpMethod.GET,
                 "my pretty url", responseString, 200, new JsonParseException(null, "Unrecognized token")));
 
-        final ExternalComponentStatus schedulerStatus = schedulerService.probeGetSchedulerChangeManagements();
+        final ExternalComponentStatus schedulerStatus = schedulerService.probeComponent();
 
         assertSchedulerStatus(schedulerStatus, false);
 
@@ -172,7 +172,7 @@ public class SchedulerServiceImplTest extends AbstractTestNGSpringContextTests {
         when(changeManagementService.getSchedulerChangeManagementsWithRequestInfo()).thenThrow(
                 new GenericUncheckedException(new NotFoundException("Get with status = 400")));
 
-        final ExternalComponentStatus schedulerStatus = schedulerService.probeGetSchedulerChangeManagements();
+        final ExternalComponentStatus schedulerStatus = schedulerService.probeComponent();
 
         assertThat(schedulerStatus.isAvailable(), is(false));
         assertThat(schedulerStatus.getComponent(), is(SCHEDULER));
index 3cd3aa8..4f7faab 100644 (file)
@@ -93,7 +93,7 @@ public class VidServiceImplTest {
     public void initMocks() throws AsdcCatalogException, SdcToscaParserException, IllegalAccessException {
         MockitoAnnotations.initMocks(this);
 
-        vidService = new VidServiceImpl(asdcClientMock, featureManager);
+        vidService = new VidServiceImpl(asdcClientMock, toscaParserMock, featureManager);
         FieldUtils.writeField(vidService, "toscaParser", toscaParserMock, true);
 
         when(featureManager.isActive(Features.FLAG_SERVICE_MODEL_CACHE)).thenReturn(true);
@@ -157,7 +157,7 @@ public class VidServiceImplTest {
         when(httpResponse.getBody()).thenReturn("sampleBody");
 
 
-        ExternalComponentStatus externalComponentStatus = vidService.probeSDCConnection();
+        ExternalComponentStatus externalComponentStatus = vidService.probeComponent();
 
         assertThat(externalComponentStatus.isAvailable(), is(true));
         assertThat(externalComponentStatus.getComponent(), is(ExternalComponentStatus.Component.SDC));
@@ -169,7 +169,7 @@ public class VidServiceImplTest {
     public void shouldProperlyHandleNotWorkingSDCConnection(){
         when(asdcClientMock.checkSDCConnectivity()).thenThrow(new RuntimeException("not working"));
 
-        ExternalComponentStatus externalComponentStatus = vidService.probeSDCConnection();
+        ExternalComponentStatus externalComponentStatus = vidService.probeComponent();
 
         assertThat(externalComponentStatus.isAvailable(), is(false));
         assertThat(externalComponentStatus.getMetadata().getDescription(),containsString("not working"));