add new format to fetch requests from MSO to the CM
[vid.git] / vid-app-common / src / test / java / org / onap / vid / mso / MsoBusinessLogicImplTest.java
index 63cd62c..9d5577c 100644 (file)
@@ -104,6 +104,7 @@ import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
 
 @ContextConfiguration(classes = {SystemProperties.class})
 public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
@@ -123,6 +124,10 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
     @Mock
     private RequestDetails msoRequest;
 
+    @Mock
+    private FeatureManager featureManager;
+
+
 
     private MsoBusinessLogicImpl msoBusinessLogic;
     private String userId = "testUserId";
@@ -131,14 +136,14 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
     @BeforeClass
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        msoBusinessLogic = new MsoBusinessLogicImpl(msoInterface);
+        msoBusinessLogic = new MsoBusinessLogicImpl(msoInterface, featureManager);
     }
 
     @Test
     public void shouldProperlyCreateConfigurationInstanceWithCorrectServiceInstanceId() throws Exception {
         // given
         String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
-        String endpointTemplate = String.format("/serviceInstances/v6/%s/configurations", serviceInstanceId);
+        String endpointTemplate = String.format("/serviceInstantiation/v7/serviceInstances/%s/configurations", serviceInstanceId);
         RequestDetailsWrapper requestDetailsWrapper = createRequestDetails();
         MsoResponseWrapper expectedResponse = createOkResponse();
         given(msoInterface.createConfigurationInstance(requestDetailsWrapper, endpointTemplate))
@@ -184,7 +189,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
     public void shouldProperlyCreateSvcInstanceWithProperParameters() {
 
         MsoResponseWrapper expectedResponse = createOkResponse();
-        String svcEndpoint = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+        String svcEndpoint = SystemProperties.getProperty(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
         given(msoInterface.createSvcInstance(msoRequest, svcEndpoint)).willReturn(expectedResponse);
 
         MsoResponseWrapper response = msoBusinessLogic.createSvcInstance(msoRequest);
@@ -833,7 +838,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
     public void shouldProperlyGetActivateFabricConfigurationPathWithProperParameters() {
         // given
         String serviceInstanceId = "testServiceId";
-        String path = validateEndpointPath(MsoProperties.MSO_REST_API_SERVICE_INSTANCE_CREATE);
+        String path = validateEndpointPath(MsoProperties.MSO_RESTAPI_SERVICE_INSTANCE);
         path += "/" + serviceInstanceId + "/activateFabricConfiguration";
 
         // when
@@ -1255,7 +1260,7 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
         UUID workflow_UUID = new UUID(3,30);
         String path = "/instanceManagement/v1/serviceInstances/"+serviceInstanceId+"/vnfs/"+vnfInstanceId+"/workflows/"+workflow_UUID;
 
-        given(msoInterface.invokeWorkflow(eq(request), eq(path), MockitoHamcrest.argThat(allOf(hasEntry("X-RequestorID", "testRequester"),hasEntry("X-ONAP-PartnerName", "VID"))))).willReturn(okResponse);
+        given(msoInterface.invokeWorkflow(eq(request), eq(path), MockitoHamcrest.argThat(allOf(hasEntry("X-RequestorID", "testRequester"),hasEntry("X-ONAP-PartnerName", "VID.VID"))))).willReturn(okResponse);
 
         // when
         MsoResponseWrapper response = msoBusinessLogic.invokeVnfWorkflow(request, "testRequester", serviceInstanceId, vnfInstanceId, workflow_UUID);