summaryrefslogtreecommitdiffstats
path: root/adapters/mso-ve-vnfm-adapter
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-ve-vnfm-adapter')
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java6
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java12
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java6
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java48
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java39
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java11
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java21
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java9
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml4
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java13
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java33
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java8
12 files changed, 179 insertions, 31 deletions
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
index 91a79b29bf..188b6718f2 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
@@ -40,7 +40,7 @@ public class AaiConnection {
private static final int FIRST_INDEX = 0;
- public String receiveVnfm() {
+ public EsrSystemInfo receiveVnfm() {
final AAIResourcesClient resourcesClient = new AAIResourcesClient();
final Optional<EsrVnfmList> response =
resourcesClient.get(EsrVnfmList.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST));
@@ -61,7 +61,7 @@ public class AaiConnection {
return null;
}
- private String receiveVnfmServiceUrl(final AAIResourcesClient resourcesClient, final String vnfmId) {
+ private EsrSystemInfo receiveVnfmServiceUrl(final AAIResourcesClient resourcesClient, final String vnfmId) {
final Optional<EsrVnfm> response = resourcesClient.get(EsrVnfm.class,
AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).depth(Depth.ONE));
@@ -74,7 +74,7 @@ public class AaiConnection {
return null;
}
- return esrSystemInfo.get(FIRST_INDEX).getServiceUrl();
+ return esrSystemInfo.get(FIRST_INDEX);
}
return null;
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
index 108b2ee896..411572ff5b 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
@@ -20,6 +20,8 @@
package org.onap.so.adapters.vevnfm.configuration;
+import org.onap.so.adapters.vevnfm.provider.AuthorizationHeadersProvider;
+import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.springframework.context.annotation.Bean;
@@ -30,7 +32,13 @@ import org.springframework.web.client.RestTemplate;
public class ApplicationConfiguration {
@Bean
- public HttpRestServiceProvider restProvider(final RestTemplate restTemplate) {
- return new HttpRestServiceProviderImpl(restTemplate);
+ public AuthorizationHeadersProvider headersProvider() {
+ return new AuthorizationHeadersProvider();
+ }
+
+ @Bean
+ public HttpRestServiceProvider restProvider(final RestTemplate restTemplate,
+ final HttpHeadersProvider headersProvider) {
+ return new HttpRestServiceProviderImpl(restTemplate, headersProvider);
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
index 2e5a00ad02..1882b4e183 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
@@ -20,9 +20,11 @@
package org.onap.so.adapters.vevnfm.controller;
+import org.onap.so.adapters.vevnfm.service.DmaapService;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -33,9 +35,13 @@ public class NotificationController {
private static final Logger logger = LoggerFactory.getLogger(NotificationController.class);
+ @Autowired
+ private DmaapService dmaapService;
+
@PostMapping("${notification.url}")
public ResponseEntity receiveNotification(@RequestBody final VnfLcmOperationOccurrenceNotification notification) {
logger.info("Notification received {}", notification);
+ dmaapService.send(notification);
return ResponseEntity.ok().build();
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
new file mode 100644
index 0000000000..eca5240cb5
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SO
+ * ================================================================================
+ * Copyright (C) 2020 Samsung. 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.so.adapters.vevnfm.provider;
+
+import java.util.List;
+import org.apache.logging.log4j.util.Strings;
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.springframework.http.HttpHeaders;
+
+public class AuthorizationHeadersProvider extends BasicHttpHeadersProvider {
+
+ private List<String> previousAuthorization;
+
+ public void addAuthorization(final String authorization) {
+ final HttpHeaders headers = getHttpHeaders();
+ previousAuthorization = headers.get(AUTHORIZATION_HEADER);
+ headers.set(AUTHORIZATION_HEADER, authorization);
+ }
+
+ public void resetPrevious() {
+ if (!isPreviousAuthorizationBlank()) {
+ getHttpHeaders().addAll(AUTHORIZATION_HEADER, previousAuthorization);
+ }
+ }
+
+ private boolean isPreviousAuthorizationBlank() {
+ return previousAuthorization == null || previousAuthorization.isEmpty()
+ || Strings.isBlank(previousAuthorization.get(0));
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
new file mode 100644
index 0000000000..59397cead3
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
@@ -0,0 +1,39 @@
+package org.onap.so.adapters.vevnfm.service;
+
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DmaapService {
+
+ private static final Logger logger = LoggerFactory.getLogger(DmaapService.class);
+
+ @Value("${dmaap.endpoint}")
+ private String endpoint;
+
+ @Value("${dmaap.topic}")
+ private String topic;
+
+ @Autowired
+ private HttpRestServiceProvider restProvider;
+
+ public void send(final VnfLcmOperationOccurrenceNotification notification) {
+ final ResponseEntity<String> response = restProvider.postHttpRequest(notification, getUrl(), String.class);
+
+ final HttpStatus statusCode = response.getStatusCode();
+ final String body = response.getBody();
+
+ logger.info("The DMaaP replied with the code {} and the body {}", statusCode, body);
+ }
+
+ private String getUrl() {
+ return endpoint + topic;
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
index 7a9ec9659e..dfbafa223c 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
@@ -21,6 +21,7 @@
package org.onap.so.adapters.vevnfm.service;
import org.apache.logging.log4j.util.Strings;
+import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.aai.AaiConnection;
import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,16 +36,16 @@ public class StartupService {
@Autowired
private SubscriberService subscriberService;
- private static void isValid(final String endpoint) throws VeVnfmException {
- if (Strings.isBlank(endpoint)) {
+ private static void isValid(final EsrSystemInfo info) throws VeVnfmException {
+ if (Strings.isBlank(info.getServiceUrl())) {
throw new VeVnfmException("No 'url' field in VNFM info");
}
}
public void run() throws Exception {
- final String endpoint = aaiConnection.receiveVnfm();
- isValid(endpoint);
- final boolean done = subscriberService.subscribe(endpoint);
+ final EsrSystemInfo info = aaiConnection.receiveVnfm();
+ isValid(info);
+ final boolean done = subscriberService.subscribe(info);
if (!done) {
throw new VeVnfmException("Could not subscribe to VNFM");
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
index c1a56fb452..0e77ce4073 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
@@ -20,7 +20,10 @@
package org.onap.so.adapters.vevnfm.service;
+import com.squareup.okhttp.Credentials;
import java.util.Collections;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vevnfm.provider.AuthorizationHeadersProvider;
import org.onap.so.adapters.vevnfm.subscription.SubscribeSender;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthentication;
@@ -50,11 +53,23 @@ public class SubscriberService {
private String openpass;
@Autowired
+ private AuthorizationHeadersProvider headersProvider;
+
+ @Autowired
private SubscribeSender sender;
- public boolean subscribe(final String endpoint) {
- final LccnSubscriptionRequest request = createRequest();
- return sender.send(endpoint, request);
+ private static String getAuthorization(final EsrSystemInfo info) {
+ return Credentials.basic(info.getUserName(), info.getPassword());
+ }
+
+ public boolean subscribe(final EsrSystemInfo info) {
+ try {
+ headersProvider.addAuthorization(getAuthorization(info));
+ final LccnSubscriptionRequest request = createRequest();
+ return sender.send(info, request);
+ } finally {
+ headersProvider.resetPrevious();
+ }
}
private LccnSubscriptionRequest createRequest() {
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java
index 1b3a049bcf..8fdfb41d26 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java
@@ -20,6 +20,7 @@
package org.onap.so.adapters.vevnfm.subscription;
+import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
@@ -41,8 +42,8 @@ public class SubscribeSender {
@Autowired
private HttpRestServiceProvider restProvider;
- public boolean send(final String endpoint, final LccnSubscriptionRequest request) {
- final ResponseEntity<String> response = restProvider.postHttpRequest(request, getUrl(endpoint), String.class);
+ public boolean send(final EsrSystemInfo info, final LccnSubscriptionRequest request) {
+ final ResponseEntity<String> response = restProvider.postHttpRequest(request, getUrl(info), String.class);
final HttpStatus statusCode = response.getStatusCode();
final String body = response.getBody();
@@ -52,7 +53,7 @@ public class SubscribeSender {
return HttpStatus.CREATED == statusCode;
}
- private String getUrl(final String endpoint) {
- return endpoint + vnfmSubscription;
+ private String getUrl(final EsrSystemInfo info) {
+ return info.getServiceUrl() + vnfmSubscription;
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
index f3ad9615ec..35871c51ac 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
@@ -33,6 +33,10 @@ aai:
vnfm:
subscription: /vnflcm/v1/subscriptions
+dmaap:
+ endpoint: http://message-router:30227
+ topic: /events/unauthenticated.DCAE_CL_OUTPUT
+
spring:
security:
usercredentials:
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 418c2e2201..57638a165a 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
@@ -21,6 +21,9 @@
package org.onap.so.adapters.vevnfm.controller;
import static org.junit.Assert.assertEquals;
+import static org.springframework.test.web.client.ExpectedCount.once;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.anything;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -33,11 +36,13 @@ import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.WebApplicationContext;
@SpringBootTest
@@ -54,11 +59,16 @@ public class NotificationControllerTest {
@Autowired
private WebApplicationContext webApplicationContext;
+ @Autowired
+ private RestTemplate restTemplate;
+
private MockMvc mvc;
+ private MockRestServiceServer mockRestServer;
@Before
public void init() {
mvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
+ mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
}
@Test
@@ -67,6 +77,8 @@ public class NotificationControllerTest {
final MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(notificationUrl)
.contentType(MediaType.APPLICATION_JSON).content(MINIMAL_JSON_CONTENT);
+ mockRestServer.expect(once(), anything()).andRespond(withSuccess());
+
// when
final MvcResult mvcResult = mvc.perform(request).andReturn();
@@ -74,5 +86,6 @@ public class NotificationControllerTest {
final MockHttpServletResponse response = mvcResult.getResponse();
assertEquals(HttpStatus.OK.value(), response.getStatus());
assertEquals(ZERO, response.getContentLength());
+ mockRestServer.verify();
}
}
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 8c480d0415..0f9c23e261 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
@@ -21,11 +21,14 @@
package org.onap.so.adapters.vevnfm.service;
import static org.mockito.Mockito.*;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
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.exception.VeVnfmException;
@@ -41,38 +44,46 @@ public class StartupServiceTest {
@InjectMocks
private StartupService startupService;
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
@Test
public void testSuccess() throws Exception {
// given
- final String endpoint = "lh";
-
- when(aaiConnection.receiveVnfm()).thenReturn(endpoint);
- when(subscriberService.subscribe(endpoint)).thenReturn(true);
+ final EsrSystemInfo info = new EsrSystemInfo();
+ info.setServiceUrl("lh");
+ when(aaiConnection.receiveVnfm()).thenReturn(info);
+ when(subscriberService.subscribe(info)).thenReturn(true);
// when
startupService.run();
// then
verify(aaiConnection, times(1)).receiveVnfm();
- verify(subscriberService, times(1)).subscribe(endpoint);
+ verify(subscriberService, times(1)).subscribe(info);
}
- @Test(expected = VeVnfmException.class)
+ @Test
public void testFailureAai() throws Exception {
// given
- when(aaiConnection.receiveVnfm()).thenReturn(null);
+ final EsrSystemInfo info = new EsrSystemInfo();
+ when(aaiConnection.receiveVnfm()).thenReturn(info);
+
+ thrown.expect(VeVnfmException.class);
// when
startupService.run();
}
- @Test(expected = VeVnfmException.class)
+ @Test
public void testFailureSubscriber() throws Exception {
// given
- final String endpoint = "lh";
+ final EsrSystemInfo info = new EsrSystemInfo();
+ info.setServiceUrl("lh");
+ when(aaiConnection.receiveVnfm()).thenReturn(info);
+ when(subscriberService.subscribe(info)).thenReturn(false);
- when(aaiConnection.receiveVnfm()).thenReturn(endpoint);
- when(subscriberService.subscribe(endpoint)).thenReturn(false);
+ thrown.expect(VeVnfmException.class);
// when
startupService.run();
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java
index 62a624a983..d1fda0eee6 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java
@@ -31,6 +31,7 @@ import org.hamcrest.CoreMatchers;
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.StartupConfiguration;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.springframework.beans.factory.annotation.Autowired;
@@ -79,16 +80,17 @@ public class SubscribeSenderTest {
@Test
public void testSuccess() {
// given
- final String endpoint = "lh";
+ final EsrSystemInfo info = new EsrSystemInfo();
+ info.setServiceUrl("lh");
final LccnSubscriptionRequest request = new LccnSubscriptionRequest();
- mockRestServer.expect(once(), requestTo(SLASH + endpoint + vnfmSubscription))
+ mockRestServer.expect(once(), requestTo(SLASH + info.getServiceUrl() + vnfmSubscription))
.andExpect(header(CONTENT_TYPE, CoreMatchers.containsString(MediaType.APPLICATION_JSON_VALUE)))
.andExpect(method(HttpMethod.POST)).andExpect(content().json(GSON.toJson(request)))
.andRespond(withStatus(HttpStatus.CREATED).body(MINIMAL_JSON_CONTENT));
// when
- final boolean done = sender.send(endpoint, request);
+ final boolean done = sender.send(info, request);
// then
assertTrue(done);