summaryrefslogtreecommitdiffstats
path: root/vid-automation
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-10-31 11:59:25 +0200
committerEylon Malin <eylon.malin@intl.att.com>2019-10-31 10:11:25 +0000
commit94b51c73b499978aaddbb115de2b0f16f2d4db96 (patch)
tree3a408abed6db5b2e67ba1f483e126e25fc6c32ee /vid-automation
parent2faaef3c1c05fcef0cbcda7f77f6c173826e57b6 (diff)
assert that InvocationId is unique in API tests
Issue-ID: VID-253 Change-Id: I8bb4c752a9609d5b5a4c649befb7344a800b00b5 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
Diffstat (limited to 'vid-automation')
-rw-r--r--vid-automation/src/test/java/org/onap/vid/more/LoggerFormatTest.java10
1 files changed, 10 insertions, 0 deletions
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 597851086..7f2d48469 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
@@ -7,6 +7,7 @@ import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.containsInRelativeOrder;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
@@ -18,6 +19,8 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
@@ -143,12 +146,16 @@ public class LoggerFormatTest extends BaseApiTest {
assertThat("X-ONAP-PartnerName", request.headers.get("X-ONAP-PartnerName"), contains("VID.VID"));
});
+ List<String> allInvocationIds = new LinkedList<>();
+
underTestRequests.forEach(request->{
List<String> invocationIds = request.headers.get("X-InvocationID");
assertThat(invocationIds, hasSize(1));
String invocationId = invocationIds.get(0);
+ allInvocationIds.add(invocationId);
+
assertThat("request id and invocation id must be found in exactly two rows",
logLines,
containsInRelativeOrder(
@@ -162,6 +169,9 @@ public class LoggerFormatTest extends BaseApiTest {
containsString("InvokeReturn"))
));
});
+ //make sure no InvocationId is repeated twice
+ assertThat("expect all InvocationIds to be unique",
+ allInvocationIds, containsInAnyOrder(new HashSet<>(allInvocationIds).toArray()));
}
private JsonNode getCheckerResults(String logtype, String logLines) {