aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test
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/test
parent02d53313aa3ad07efdb1de0caf4d8a9792cc9143 (diff)
parent4751c29632d2f32abba85dd91296fb91672a2f59 (diff)
Merge "Extend probe mechanism"
Diffstat (limited to 'vid-app-common/src/test')
-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
6 files changed, 16 insertions, 16 deletions
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"));