From 42e59f3f3af996a2de92186203d67231c994fa9e Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Wed, 1 Jan 2020 10:10:27 +0200 Subject: Add a reference-template with 2 templated Networks: fetch by jobId Issue-ID: VID-724 Change-Id: Id8906366ebf01ca95045450cb1870fa82f53a3dd Signed-off-by: Ittay Stern --- .../java/org/onap/vid/api/InstantiationTemplatesApiTest.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'vid-automation/src') diff --git a/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java index cf3d508e8..9d84e965d 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java @@ -138,13 +138,12 @@ public class InstantiationTemplatesApiTest extends AsyncInstantiationBase { String jobId = postAsyncInstanceRequest(request); - assertThat(fetchRecentTemplateInfo(request.at("/modelInfo/modelVersionId").asText()), allOf( - jsonPartEquals("jobId", jobId), + assertThat(fetchTemplateInfo(request.at("/modelInfo/modelVersionId").asText(), jobId), jsonPartEquals("requestSummary", ImmutableMap.of( "vnf", 1L, "vfModule", 2L, "volumeGroup", 1L - )))); + ))); } @Test @@ -157,8 +156,7 @@ public class InstantiationTemplatesApiTest extends AsyncInstantiationBase { String jobId = postAsyncInstanceRequest(request); - assertThat(fetchRecentTemplateInfo(request.at("/modelInfo/modelVersionId").asText()), allOf( - jsonPartEquals("jobId", jobId), + assertThat(fetchTemplateInfo(request.at("/modelInfo/modelVersionId").asText(), jobId), allOf( jsonEquals(templateInfoFromFile()).when(IGNORING_VALUES), // Assert only field types jsonEquals(templateInfoFromFile()).whenIgnoringPaths( // Ignore the fields where values are always changing @@ -169,8 +167,9 @@ public class InstantiationTemplatesApiTest extends AsyncInstantiationBase { ))); } - private JsonNode fetchRecentTemplateInfo(String serviceModelId) { + private JsonNode fetchTemplateInfo(String serviceModelId, String jobId) { return stream(restTemplate.getForObject(getTemplateInfoUrl(serviceModelId), JsonNode[].class)) + .filter(it -> it.at("/jobId").asText().equals(jobId)) .findFirst() .orElseGet(() -> { throw new AssertionError(getTemplateInfoUrl(serviceModelId) + " returned zero results"); -- cgit 1.2.3-korg