diff options
Diffstat (limited to 'vid-automation/src/test/java')
4 files changed, 24 insertions, 4 deletions
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java index 39110c550..05d73a619 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AaiApiTest.java @@ -774,11 +774,12 @@ public class AaiApiTest extends BaseApiAaiTest { new PresetAAIGetVpnsByType(), new PresetAAIGetSubscribersGet() ),CLEAR_THEN_SET); - - String url = uri + "/aai_get_vpn_list"; + String internalPath = "/aai_get_vpn_list"; + String url = uri + internalPath; ResponseEntity<String> response = restTemplate.getForEntity(url, String.class); final String requestId = response.getHeaders().getFirst("X-ECOMP-RequestID-echo"); LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId,"/network/vpn-bindings" , 1); + LoggerFormatTest.verifyExistenceOfIncomingReqsInAuditLogs(restTemplate, uri, requestId, internalPath); } @Test diff --git a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java index f22b6de65..858b2f8ef 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/SdcApiTest.java @@ -220,7 +220,7 @@ public class SdcApiTest extends BaseApiTest { public void whenCallSdc_thenRequestRecordedInMetricsLog() { ModelInfo modelInfo = ModelInfo.transportWithPnfsService; - + String internalPath = SDC_GET_SERVICE_MODEL + modelInfo.modelVersionId; registerExpectationFromPresets(ImmutableList.of( new PresetSDCGetServiceToscaModelGet(modelInfo), new PresetSDCGetServiceMetadataGet(modelInfo), @@ -228,11 +228,12 @@ public class SdcApiTest extends BaseApiTest { ), CLEAR_THEN_SET); ResponseEntity<String> response = restTemplate.getForEntity( - buildUri(SDC_GET_SERVICE_MODEL + modelInfo.modelVersionId), String.class); + buildUri(internalPath), String.class); final String requestId = response.getHeaders().getFirst("X-ECOMP-RequestID-echo"); LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, requestId, SDC_ROOT_PATH, 2); + LoggerFormatTest.verifyExistenceOfIncomingReqsInAuditLogs(restTemplate, uri, requestId, internalPath); } } 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 28b407697..8bc2a7390 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 @@ -139,6 +139,7 @@ public class ServiceInstanceMsoApiTest extends BaseMsoApiTest{ 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); + LoggerFormatTest.verifyExistenceOfIncomingReqsInAuditLogs(restTemplate, uri, requestId, MSO_ACTIVATE_FABRIC_CONFIGURATION); } @Test(dataProvider = "errorCodes") diff --git a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java index a233f255e..7a4eedfa9 100644 --- a/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java +++ b/vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java @@ -131,6 +131,23 @@ public class LoggerFormatTest extends BaseApiTest { return lines; } + public static void verifyExistenceOfIncomingReqsInAuditLogs(RestTemplate restTemplate, URI uri, String requestId, + String path){ + List<String> logLines = getRequestLogLines(requestId, LogName.audit2019, restTemplate, uri); + String requestIdPrefix = "RequestID="; + assertThat("request id must be found in exactly two rows - entry & exit message in audit log, and include the req path", + logLines, + containsInRelativeOrder( + allOf( + containsString(requestIdPrefix+requestId), + containsString("ENTRY"), + containsString(path)), + allOf( + containsString(requestIdPrefix+requestId), + containsString("EXIT"), + containsString(path)) + )); + } public static void assertHeadersAndMetricLogs(RestTemplate restTemplate, URI uri, String requestId, String path, int requestsSize) { List<String> logLines = |