From 4c362743550cc5696eab0cb7d1fd1b03b872e2b0 Mon Sep 17 00:00:00 2001
From: Piotr Borelowski
Date: Mon, 6 Apr 2020 16:03:44 +0200
Subject: Small improvements to Notification and Subscription filters
Ve-Vnfm (SOL002) Adapter project
- change after code review
Issue-ID: SO-2574
Signed-off-by: Piotr Borelowski
Change-Id: Id5330d995194ba9d995266c6b9dfe11cdb39f4dd
---
.../adapters/vevnfm/controller/NotificationControllerTest.java | 8 +++++---
.../onap/so/adapters/vevnfm/service/StartupServiceTest.java | 5 +++++
.../onap/so/adapters/vevnfm/service/SubscribeSenderTest.java | 8 +++++---
.../org/onap/so/adapters/vevnfm/service/VnfAaiCheckerTest.java | 10 +++++-----
4 files changed, 20 insertions(+), 11 deletions(-)
(limited to 'adapters/mso-ve-vnfm-adapter/src/test/java/org/onap')
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
index 56c53a72e8..27def126ef 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
@@ -26,9 +26,9 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
import org.onap.so.adapters.vevnfm.configuration.StartupConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@@ -52,8 +52,8 @@ public class NotificationControllerTest {
private static final String MINIMAL_JSON_CONTENT = "{}";
private static final int ZERO = 0;
- @Value("${vnfm.notification}")
- private String notification;
+ @Autowired
+ private ConfigProperties configProperties;
@Autowired
private WebApplicationContext webApplicationContext;
@@ -61,11 +61,13 @@ public class NotificationControllerTest {
@Autowired
private RestTemplate restTemplate;
+ private String notification;
private MockMvc mvc;
private MockRestServiceServer mockRestServer;
@Before
public void init() {
+ notification = configProperties.getVnfmNotification();
mvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
index 9b18cf96dc..5d5ffa6555 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
@@ -34,15 +34,20 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.aai.AaiConnection;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
@RunWith(MockitoJUnitRunner.class)
public class StartupServiceTest {
private static final String URL = "rt";
+ private static final String ENDPOINT = "localhost";
@Rule
public ExpectedException thrown = ExpectedException.none();
+ @Mock
+ private ConfigProperties configProperties;
+
@Mock
private AaiConnection aaiConnection;
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
index b7f1f982a2..02d664e206 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
@@ -33,11 +33,11 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
import org.onap.so.adapters.vevnfm.configuration.StartupConfiguration;
import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
@@ -64,8 +64,8 @@ public class SubscribeSenderTest {
GSON = builder.create();
}
- @Value("${vnfm.subscription}")
- private String vnfmSubscription;
+ @Autowired
+ private ConfigProperties configProperties;
@Autowired
private SubscribeSender sender;
@@ -73,10 +73,12 @@ public class SubscribeSenderTest {
@Autowired
private RestTemplate restTemplate;
+ private String vnfmSubscription;
private MockRestServiceServer mockRestServer;
@Before
public void init() {
+ vnfmSubscription = configProperties.getVnfmSubscription();
mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/VnfAaiCheckerTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/VnfAaiCheckerTest.java
index 84705d10ce..da5992ee42 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/VnfAaiCheckerTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/VnfAaiCheckerTest.java
@@ -30,7 +30,7 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.adapters.vevnfm.aai.AaiConnection;
-import org.onap.so.adapters.vevnfm.constant.VnfNotificationFilterType;
+import org.onap.so.adapters.vevnfm.constant.NotificationVnfFilterType;
@RunWith(MockitoJUnitRunner.class)
public class VnfAaiCheckerTest {
@@ -46,7 +46,7 @@ public class VnfAaiCheckerTest {
@Test
public void testAll() {
// when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.ALL, VNF_ID);
+ final boolean response = checker.vnfCheck(NotificationVnfFilterType.ALL, VNF_ID);
// then
assertTrue(response);
@@ -58,7 +58,7 @@ public class VnfAaiCheckerTest {
when(aaiConnection.checkGenericVnfId(eq(VNF_ID))).thenReturn(true);
// when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.AAI_CHECKED, VNF_ID);
+ final boolean response = checker.vnfCheck(NotificationVnfFilterType.AAI_CHECKED, VNF_ID);
// then
assertTrue(response);
@@ -70,7 +70,7 @@ public class VnfAaiCheckerTest {
when(aaiConnection.checkGenericVnfId(eq(VNF_ID))).thenReturn(false);
// when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.AAI_CHECKED, VNF_ID);
+ final boolean response = checker.vnfCheck(NotificationVnfFilterType.AAI_CHECKED, VNF_ID);
// then
assertFalse(response);
@@ -79,7 +79,7 @@ public class VnfAaiCheckerTest {
@Test
public void testNone() {
// when
- final boolean response = checker.vnfCheck(VnfNotificationFilterType.NONE, VNF_ID);
+ final boolean response = checker.vnfCheck(NotificationVnfFilterType.NONE, VNF_ID);
// then
assertFalse(response);
--
cgit 1.2.3-korg