remove 2016 logger aspects + verify audit score
[vid.git] / vid-automation / src / test / java / org / onap / vid / api / pProbeMsoApiTest.java
index c082ef9..534dc69 100644 (file)
@@ -1,7 +1,11 @@
 package org.onap.vid.api;
 
+import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import org.apache.commons.text.StringEscapeUtils;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId;
+import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSOActOnConfiguration;
+import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSOCreateConfiguration;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;
 import org.testng.annotations.Test;
@@ -15,7 +19,7 @@ public class pProbeMsoApiTest extends BaseMsoApiTest{
     private static final String MSO_REMOVE_RELATIONSHIP = "/mso/mso_remove_relationship/f36f5734-e9df-4fbf-9f35-61be13f028a1";
     private static final String MSO_ADD_RELATIONSHIP = "/mso/mso_add_relationship/f36f5734-e9df-4fbf-9f35-61be13f028a1";
     public static final String MSO_CREATE_CONFIGURATION = "mso/mso_create_configuration_instance/f36f5734-e9df-4fbf-9f35-61be13f028a1/configurations/";
-    public static final String MSO_ACTIVATE_CONFIGURATION = "mso/mso_activate_configuration/f36f5734-e9df-4fbf-9f35-61be13f028a1/configurations/a53c9ca8-8986-44da-9e5e-9e4179e6c78a";
+    public static final String MSO_ACTIVATE_CONFIGURATION = "mso/mso_activate_configuration/c187e9fe-40c3-4862-b73e-84ff056205f6/configurations/9533-config-LB1113";
 
 
 
@@ -24,15 +28,12 @@ public class pProbeMsoApiTest extends BaseMsoApiTest{
 
     //Request Details
     private static final String CREATE_CONFIGURATION_REQUEST_DETAILS = "registration_to_simulator/body_jsons/mso_request_create_configuration.json";
-
+    private static final String ACTIVATE_CONFIGURATION_REQUEST_DETAILS = "registration_to_simulator/body_jsons/mso_request_activate_configuration.json";
     //Jsons
     private static final String DISSOCIATE_OK_JSON = "dissociate_pnf_from_service_instance.json";
     private static final String DISSOCIATE_FAILED_JSON = "dissociate_pnf_from_service_instance_error.json";
     private static final String ASSOCIATE_OK_JSON = "mso_add_relationships.json";
     private static final String ASSOCIATE_FAILED_JSON = "mso_add_relationships_error.json";
-    private static final String CREATE_CONFIGURATION_OK_JSON = "mso_create_configurations.json";
-    private static final String CREATE_CONFIGURATION_FAILED_JSON = "mso_create_configurations_error.json";
-    private static final String ACTIVATE_CONFIGURATION_OK_JSON = "mso_activate_configurations.json";
 
     //Expected Responses
     private static final String EXPECTED_SUCCESS_MSO_RESPONSE = "{\"requestReferences\": {\"instanceId\": \"f36f5734-e9df-4fbf-9f35-61be13f028a1\", \"requestId\": \"b6dc9806-b094-42f7-9386-a48de8218ce8\"}}";
@@ -73,25 +74,31 @@ public class pProbeMsoApiTest extends BaseMsoApiTest{
     @Test
     public void testCreateConfigurationSucceed() throws Exception {
         String requestBody = TestUtils.convertRequest(objectMapper, CREATE_CONFIGURATION_REQUEST_DETAILS);
-        callMsoWithFineRequest(CREATE_CONFIGURATION_OK_JSON, ImmutableMap.of(), buildUri(MSO_CREATE_CONFIGURATION),
-                requestBody, HttpStatus.ACCEPTED.value(),EXPECTED_SUCCESS_MSO_RESPONSE , HttpMethod.POST);
+        callMsoWithFineRequest(ImmutableList.of(
+                new PresetMSOCreateConfiguration("f36f5734-e9df-4fbf-9f35-61be13f028a1"),
+                PresetAAIGetCloudOwnersByCloudRegionId.PRESET_AAIAIC25_TO_ATT_AIC
+                ),
+                buildUri(MSO_CREATE_CONFIGURATION), requestBody,
+                HttpStatus.ACCEPTED.value(), EXPECTED_SUCCESS_MSO_RESPONSE, HttpMethod.POST);
     }
 
     @Test
     public void testActivateConfigurationSucceed() throws Exception {
-        String requestBody = "" +
-                "{" +
-                "   \"val\": \"dummy payload\"" +
-                "}";
-        callMsoWithFineRequest(ACTIVATE_CONFIGURATION_OK_JSON, ImmutableMap.of(), buildUri(MSO_ACTIVATE_CONFIGURATION),
-                requestBody, HttpStatus.ACCEPTED.value(),EXPECTED_SUCCESS_MSO_RESPONSE , HttpMethod.POST);
+        String requestBody = TestUtils.convertRequest(objectMapper, ACTIVATE_CONFIGURATION_REQUEST_DETAILS);
+        callMsoWithFineRequest(ImmutableList.of(
+                new PresetMSOActOnConfiguration("activate", "b6dc9806-b094-42f7-9386-a48de8218ce8", "f36f5734-e9df-4fbf-9f35-61be13f028a1"),
+                PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC
+                ),
+                buildUri(MSO_ACTIVATE_CONFIGURATION),
+                requestBody, HttpStatus.ACCEPTED.value(), EXPECTED_SUCCESS_MSO_RESPONSE, HttpMethod.POST);
     }
 
     @Test(dataProvider = "errorCodes")
     public void testCreateConfigurationError(int errorCode) throws IOException, URISyntaxException {
         String requestBody = TestUtils.convertRequest(objectMapper, CREATE_CONFIGURATION_REQUEST_DETAILS);
-        callMsoWithSimulatedErrorResponse(CREATE_CONFIGURATION_FAILED_JSON,
-                ImmutableMap.of("\"<ERROR_CODE>\"", Integer.toString(errorCode),"\"<ERROR_PAYLOAD>\"", StringEscapeUtils.escapeJson(EXPECTED_ERROR_MSO_RESPONSE)),
+        callMsoWithSimulatedErrorResponse(ImmutableList.of(
+                new PresetMSOCreateConfiguration("f36f5734-e9df-4fbf-9f35-61be13f028a1", errorCode, EXPECTED_ERROR_MSO_RESPONSE),
+                PresetAAIGetCloudOwnersByCloudRegionId.PRESET_AAIAIC25_TO_ATT_AIC),
                 buildUri(MSO_CREATE_CONFIGURATION), requestBody,errorCode,EXPECTED_ERROR_MSO_RESPONSE,HttpMethod.POST);
 
     }
@@ -99,8 +106,9 @@ public class pProbeMsoApiTest extends BaseMsoApiTest{
     @Test
     public void testCreateConfigurationFail() throws Exception {
         String requestBody = "498/*ht5ru7 mjhnb";
-        callMsoWithSimulatedErrorResponse(CREATE_CONFIGURATION_FAILED_JSON,
-                ImmutableMap.of("\"<ERROR_CODE>\"", 500),
+        callMsoWithSimulatedErrorResponse(ImmutableList.of(
+                new PresetMSOCreateConfiguration("f36f5734-e9df-4fbf-9f35-61be13f028a1", 500, EXPECTED_ERROR_MSO_RESPONSE),
+                PresetAAIGetCloudOwnersByCloudRegionId.PRESET_AAIAIC25_TO_ATT_AIC),
                 buildUri(MSO_CREATE_CONFIGURATION), requestBody,500,EXPECTED_ERROR_MSO_RESPONSE,HttpMethod.POST);
 
     }