Merge "Add a semicolon at the end of this statement"
authorIttay Stern <ittay.stern@att.com>
Mon, 2 Sep 2019 12:54:07 +0000 (12:54 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 2 Sep 2019 12:54:07 +0000 (12:54 +0000)
epsdk-app-onap/src/main/webapp/app/fusion/external/ebz/js/attHeaderSnippet.js
vid-app-common/src/main/webapp/app/vid/scripts/controller/iframeController.js
vid-app-common/src/main/webapp/app/vid/scripts/controller/iframeDialogController.js
vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java
vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
vid-app-common/src/test/resources/payload_jsons/vfModuleDeactivateAndCloudDelete.json

index 105c48b..5f05d21 100644 (file)
@@ -22,6 +22,6 @@
 
 var iframeController = function($scope, $location) {
     $scope.url = "app/ui/#" +  $location.$$url;
-}
+};
 
 app.controller("iframeController", [ "$scope", "$location", iframeController ]);
index e388470..b4371c4 100644 (file)
@@ -48,7 +48,7 @@ var iframeDialogController = function (COMPONENT, FIELD, PARAMETER, $scope, $htt
                     $scope.popup.isVisible = false;
                     // }
                 }
-            })
+            });
         }
         $scope.$apply();
     }
index a2f86f4..a324505 100644 (file)
@@ -27,6 +27,7 @@ import static org.mockito.BDDMockito.given;
 import static org.mockito.BDDMockito.then;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.only;
+import static org.mockito.Mockito.when;
 import static org.springframework.http.MediaType.APPLICATION_JSON;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
@@ -48,6 +49,7 @@ import org.junit.Test;
 import org.onap.vid.model.RequestReferencesContainer;
 import org.onap.vid.mso.MsoBusinessLogic;
 import org.onap.vid.mso.MsoResponseWrapper;
+import org.onap.vid.mso.MsoResponseWrapper2;
 import org.onap.vid.mso.RestObject;
 import org.onap.vid.mso.rest.MsoRestClientNew;
 import org.onap.vid.mso.rest.Request;
@@ -447,4 +449,38 @@ public class MsoControllerTest {
     private <T> T objectEqualTo(T expected) {
         return argThat(given -> asJson(given).equals(asJson(expected)));
     }
-}
\ No newline at end of file
+
+    @Test
+    public void testActivateFabricConfiguration() throws Exception {
+
+        String serviceInstanceId = "tempId";
+
+        //define mock response object
+        String responseString = "{" +
+            "      \"requestReferences\": {" +
+            "        \"instanceId\": \"tempId\"," +
+            "        \"requestId\": \"dbe54591-c8ed-46d3-abc7-d3a24873dfbd\"" +
+            "      }" +
+            "    }";
+        final RestObject<RequestReferencesContainer> restObject = new RestObject<>();
+        restObject.set(objectMapper.readValue(responseString, RequestReferencesContainer.class));
+        restObject.setStatusCode(200);
+
+        //register mock
+        String msoPath = "justAFakePath";
+
+        when(msoBusinessLogic.getActivateFabricConfigurationPath(serviceInstanceId)).thenReturn(msoPath);
+        when(msoRestClient.PostForObject(new RequestDetails(), msoPath, RequestReferencesContainer.class)).thenReturn(restObject);
+
+        //expected response
+        MsoResponseWrapper2<RequestReferencesContainer> expectedResponse = new MsoResponseWrapper2<>(restObject);
+
+        //get response from controller
+        // when & then
+        mockMvc.perform(post(format("/mso/mso_activate_fabric_configuration/%s", serviceInstanceId))
+            .content(asJson(new RequestDetails()))
+            .contentType(APPLICATION_JSON))
+            .andExpect(status().isOk())
+            .andExpect(content().json(asJson(expectedResponse)));
+    }
+}
index c068342..2ea37f4 100644 (file)
@@ -21,6 +21,7 @@
 
 package org.onap.vid.mso;
 
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
 import static org.assertj.core.api.Assertions.tuple;
@@ -89,7 +90,6 @@ import org.onap.vid.mso.model.CloudConfiguration;
 import org.onap.vid.mso.model.ModelInfo;
 import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo;
 import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo;
-import org.onap.vid.mso.model.RequestInfo;
 import org.onap.vid.mso.model.RequestParameters;
 import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails;
 import org.onap.vid.mso.rest.Request;
@@ -862,39 +862,11 @@ public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
     }
 
     @Test
-    public void shouldProperlyBuildRequestDetailsForSoftDeleteWithProperParameters() {
-        //  given
-        SoftDeleteRequest softDeleteRequest = new SoftDeleteRequest();
-        RequestDetails requestDetails = new RequestDetails();
-
-        String userId = "testUserID";
-        String tenantId = "testTenantId ";
-        String cloudRegionId = "testCloudId";
-
-
-        RequestInfo requestInfo = new RequestInfo();
-        requestInfo.setSource("VID");
-        requestInfo.setRequestorId(userId);
-        requestDetails.setRequestInfo(requestInfo);
-
-        CloudConfiguration cloudConfiguration = new CloudConfiguration();
-        cloudConfiguration.setTenantId(tenantId);
-        cloudConfiguration.setLcpCloudRegionId(cloudRegionId);
-        requestDetails.setCloudConfiguration(cloudConfiguration);
-
-        setModelInfoForRequestDetails(requestDetails);
-
-        setRequestParametersForRequestDetails(requestDetails);
-
-        softDeleteRequest.setLcpCloudRegionId(cloudRegionId);
-        softDeleteRequest.setTenantId(tenantId);
-        softDeleteRequest.setUserId(userId);
-
-        //  when
-        RequestDetails response = msoBusinessLogic.buildRequestDetailsForSoftDelete(softDeleteRequest);
-
-        //  then
-        assertThat(response).isEqualTo(requestDetails);
+    public void shouldProperlyBuildRequestDetailsForSoftDeleteWithProperParameters() throws IOException {
+        SoftDeleteRequest request = new SoftDeleteRequest("testTenantId", "testCloudId", "testUserID");
+        String expected = IOUtils.toString(this.getClass().getResource("/payload_jsons/vfModuleDeactivateAndCloudDelete.json"), "UTF-8");
+        final RequestDetails result = msoBusinessLogic.buildRequestDetailsForSoftDelete(request);
+        MatcherAssert.assertThat(result, jsonEquals(expected));
     }
 
     private void setRequestParametersForRequestDetails(RequestDetails requestDetails) {
index d86ad19..dbac138 100644 (file)
@@ -3,15 +3,15 @@
     "modelType": "vfModule"
   },
   "cloudConfiguration": {
-    "lcpCloudRegionId": "mdt1",
-    "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+    "lcpCloudRegionId": "testCloudId",
+    "tenantId": "testTenantId"
   },
   "requestInfo": {
     "source": "VID",
-    "requestorId": "az2016"
+    "requestorId": "testUserID"
   },
   "requestParameters" : {
     "testApi" : "GR_API",
     "userParams": []
   }
-}
\ No newline at end of file
+}