From 129b3904c875018bea237a3f376a0e1c3ab9a4f9 Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Mon, 4 Nov 2019 09:07:34 +0200 Subject: improve async instantiation log test, to verify all outgoing requests Issue-ID: VID-253 Signed-off-by: Eylon Malin Change-Id: I7717ddd2cbfaec6430b89f88109de8f12f9e9211 --- .../org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'vid-automation/src/test') diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java index 9b1dc6506..25b40ed6b 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java @@ -1,7 +1,6 @@ package org.onap.vid.api; import static java.util.Collections.emptyMap; -import static java.util.stream.Collectors.toList; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.hasItems; import static org.hamcrest.MatcherAssert.assertThat; @@ -418,9 +417,7 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { deploy1ServiceFromCypress__verifyStatusAndMsoCalls_andRetry("none", emptyMap(), emptyMap(), true); List logLines = LoggerFormatTest.getLogLinesAsList(LogName.metrics2019, 200, 1, restTemplate, uri); - List requests = retrieveRecordedRequests(); - List underTestRequests = - requests.stream().filter(x->x.path.contains(msoURL)).collect(toList()); + List underTestRequests = retrieveRecordedRequests(); underTestRequests.forEach(request-> { assertThat("X-ONAP-RequestID", request.headers.get("X-ONAP-RequestID"), contains(matchesPattern(UUID_REGEX))); @@ -430,14 +427,16 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { }); List allInvocationIds = new LinkedList<>(); - List allRequestsIds = new LinkedList<>(); + List allMsoRequestsIds = new LinkedList<>(); underTestRequests.forEach(request->{ String invocationId = request.headers.get("X-InvocationID").get(0); allInvocationIds.add(invocationId); String requestId = request.headers.get("X-ONAP-RequestID").get(0); - allRequestsIds.add(requestId); + if (request.path.contains(msoURL)) { + allMsoRequestsIds.add(requestId); + } assertThat("request id and invocation id must be found in two rows", logLines, @@ -459,7 +458,7 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase { //make sure no RequestId is repeated twice assertThat("expect all RequestIds to be unique", - allRequestsIds, containsInAnyOrder(new HashSet<>(allRequestsIds).toArray())); + allMsoRequestsIds, containsInAnyOrder(new HashSet<>(allMsoRequestsIds).toArray())); } -- cgit 1.2.3-korg