aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-07-01 08:13:33 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-01 08:13:33 +0000
commit3e884e186983f1c5a84da07ed82e5c8c1caf55a2 (patch)
treeba4cb8ee2536e24af4030cc745ad9087cb8c38f1 /vid-app-common/src
parent02d53313aa3ad07efdb1de0caf4d8a9792cc9143 (diff)
parent4751c29632d2f32abba85dd91296fb91672a2f59 (diff)
Merge "Extend probe mechanism"
Diffstat (limited to 'vid-app-common/src')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java7
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClient.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClientInterface.java7
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/AsdcClient.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/ProbeController.java31
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/ProbeInterface.java26
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java5
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/probes/HttpRequestMetadata.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java18
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerService.java5
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerServiceImpl.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/VidService.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/VidServiceImpl.java13
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java8
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientTest.java4
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java4
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java2
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/SchedulerServiceImplTest.java8
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/VidServiceImplTest.java6
23 files changed, 84 insertions, 96 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
index 1710d984f..7b78f0712 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
@@ -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);
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
index 43be049a6..3f914649d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
@@ -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);
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClient.java
index 46bb6cef4..6dc7b6860 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClient.java
@@ -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;
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClientInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClientInterface.java
index c430b098e..4cc95890d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClientInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiOverTLSClientInterface.java
@@ -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();
-
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/AsdcClient.java b/vid-app-common/src/main/java/org/onap/vid/asdc/AsdcClient.java
index e264e4e3e..fc04080d9 100644
--- a/vid-app-common/src/main/java/org/onap/vid/asdc/AsdcClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/asdc/AsdcClient.java
@@ -56,4 +56,6 @@ public interface AsdcClient {
HttpResponse<String> checkSDCConnectivity();
+
+ String getBaseUrl();
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java b/vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java
index 0bd581abc..7cfd094df 100644
--- a/vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/asdc/local/LocalAsdcClient.java
@@ -163,6 +163,12 @@ public class LocalAsdcClient implements AsdcClient {
return HttpResponse.fallback("");
}
+
+ @Override
+ public String getBaseUrl(){
+ return "";
+ }
+
/**
* The Class Builder.
*/
diff --git a/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java b/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java
index 428083e7b..a82110744 100644
--- a/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/asdc/rest/SdcRestClient.java
@@ -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),
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/ProbeController.java b/vid-app-common/src/main/java/org/onap/vid/controller/ProbeController.java
index 0206af420..c181c6f30 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/ProbeController.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/ProbeController.java
@@ -21,49 +21,28 @@
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
index 000000000..1b3265971
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/ProbeInterface.java
@@ -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();
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
index e00c2d7a5..fc656fc14 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
@@ -69,11 +69,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);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/probes/HttpRequestMetadata.java b/vid-app-common/src/main/java/org/onap/vid/model/probes/HttpRequestMetadata.java
index 58d9e242f..1638a376c 100644
--- a/vid-app-common/src/main/java/org/onap/vid/model/probes/HttpRequestMetadata.java
+++ b/vid-app-common/src/main/java/org/onap/vid/model/probes/HttpRequestMetadata.java
@@ -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() {
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
index 23c891fbf..ed64d2066 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogic.java
@@ -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();
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
index c2ac51a40..dbeaa90cb 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/MsoBusinessLogicImpl.java
@@ -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";
diff --git a/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerService.java b/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerService.java
index 5a38bc08a..643cd22af 100644
--- a/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerService.java
+++ b/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerService.java
@@ -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 {
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerServiceImpl.java
index d4f136a01..5513cf4a6 100644
--- a/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/scheduler/SchedulerServiceImpl.java
@@ -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();
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/VidService.java b/vid-app-common/src/main/java/org/onap/vid/services/VidService.java
index 1143a8ec3..18d8398a3 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/VidService.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/VidService.java
@@ -22,14 +22,12 @@
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();
}
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<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,
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java
index b98e20010..fdeeb0076 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java
@@ -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;
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientTest.java
index da937cade..a1b750e53 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiOverTLSClientTest.java
@@ -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);
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java b/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java
index 6a49396ed..7e50c8959 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java
@@ -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
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
index 8681ecbce..a7fa8cd13 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
@@ -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);
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/SchedulerServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/SchedulerServiceImplTest.java
index b959fa6af..fd562ace1 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/SchedulerServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/SchedulerServiceImplTest.java
@@ -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));
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/VidServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/VidServiceImplTest.java
index 3cd3aa8a6..4f7faab99 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/VidServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/VidServiceImplTest.java
@@ -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"));