summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2019-10-29 09:03:16 +0200
committerIttay Stern <ittay.stern@att.com>2019-10-29 07:58:16 +0000
commitf8acfcf82a1b99eb2d293c03314d5c12b87540d1 (patch)
treedb65179b2d60ede39b56908a6a9f6888fdf082ff
parent6254ac7fc6309bc283fecad8242133add5bada25 (diff)
Add API test that call to MSO and asserts headers in request and metric log
Issue-ID: VID-253 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com> Change-Id: Ie3beccb2fd1c70a81fd245abd03e33cdfa79efdd
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java
index ef582099d..28b407697 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/ServiceInstanceMsoApiTest.java
@@ -1,19 +1,25 @@
package org.onap.vid.api;
+import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import java.io.IOException;
+import java.net.URISyntaxException;
import org.apache.commons.text.StringEscapeUtils;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId;
+import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSOActivateFabricConfiguration;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSOActivateFabricConfigurationErrorResponse;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeactivateAndCloudDelete;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeactivateAndCloudDeleteErrorResponse;
+import org.onap.vid.more.LoggerFormatTest;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.testng.annotations.Test;
+import vid.automation.test.services.SimulatorApi.RegistrationStrategy;
-import java.io.IOException;
-import java.net.URISyntaxException;
public class ServiceInstanceMsoApiTest extends BaseMsoApiTest{
@@ -123,6 +129,18 @@ public class ServiceInstanceMsoApiTest extends BaseMsoApiTest{
HttpStatus.ACCEPTED.value(), EXPECTED_SUCCESS_MSO_RESPONSE, HttpMethod.POST);
}
+ @Test
+ public void testWhenCallMsoRequestLoggedInMetrics() {
+ String msoRootPath = "/mso/serviceInstantiation/v7";
+ String requestBody = TestUtils.convertRequest(objectMapper, ACTIVATE_FABRIC_CONFIGURATION_REQUEST_DETAILS);
+ registerExpectationFromPresets(ImmutableList.of(
+ new PresetMSOActivateFabricConfiguration("f36f5734-e9df-4fbf-9f35-61be13f028a1", "b6dc9806-b094-42f7-9386-a48de8218ce8"),
+ new PresetAAIGetSubscribersGet()), RegistrationStrategy.CLEAR_THEN_SET);
+ ResponseEntity<String> responseEntity = restTemplate.postForEntity(buildUri(MSO_ACTIVATE_FABRIC_CONFIGURATION), requestBody, String.class);
+ String requestId = responseEntity.getHeaders().getFirst("X-ECOMP-RequestID-echo");
+ LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId, msoRootPath, 1);
+ }
+
@Test(dataProvider = "errorCodes")
public void testActivateFabricConfigurationFailed(int errorCode) throws IOException, URISyntaxException {
String requestBody = TestUtils.convertRequest(objectMapper, ACTIVATE_FABRIC_CONFIGURATION_REQUEST_DETAILS);