diff options
author | Piotr Borelowski <p.borelowski@partner.samsung.com> | 2020-04-06 16:03:44 +0200 |
---|---|---|
committer | Piotr Borelowski <p.borelowski@partner.samsung.com> | 2020-04-08 12:56:39 +0200 |
commit | 4c362743550cc5696eab0cb7d1fd1b03b872e2b0 (patch) | |
tree | 5cc73f68f39ea5bb0c9ed628861a9a5d1bcc491f /adapters/mso-ve-vnfm-adapter/src/test | |
parent | 858a52f53fc62b5da552e8f3a80d42998bab7671 (diff) |
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 <p.borelowski@partner.samsung.com>
Change-Id: Id5330d995194ba9d995266c6b9dfe11cdb39f4dd
Diffstat (limited to 'adapters/mso-ve-vnfm-adapter/src/test')
4 files changed, 20 insertions, 11 deletions
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,16 +34,21 @@ 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; @InjectMocks 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); |