diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-12-17 11:48:12 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-12-17 12:12:14 +0200 |
commit | e2801985291583854dcedcad69c858c81c64d3de (patch) | |
tree | 7c1f75654ad6eb8f66750e6c7d904fa738f90209 /vid-automation/src/test/java | |
parent | a9f9a844ec795058a1867614b88284c3b324af7f (diff) |
Templates: Test deployment of a Cypress *edited* template
templates__instance_from_template__set_without_modify.json
is currently a plain copy of original template, but this
will be changed later on
Issue-ID: VID-724
Change-Id: Ib527fc33b684b0886c7aa407d5ba90be65fad159
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-automation/src/test/java')
-rw-r--r-- | vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java | 27 |
1 files changed, 21 insertions, 6 deletions
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 ab59f087d..721c9ead6 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 @@ -22,7 +22,6 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; -import vid.automation.test.Constants; import vid.automation.test.Constants.Users; import vid.automation.test.model.User; import vid.automation.test.services.AsyncJobsService; @@ -77,18 +76,34 @@ public class InstantiationTemplatesApiTest extends AsyncInstantiationBase { @Test public void templateTopology_givenDeployFromCypressE2E_getTemplateTopologyDataIsEquivalent() throws IOException { - templateTopology_givenDeploy_templateTopologyIsEquivalent(objectMapper.readValue( - convertRequest(objectMapper, "asyncInstantiation/templates__instance_template.json"), - JsonNode.class)); + templateTopology_givenDeploy_templateTopologyIsEquivalentToBody( + fileAsJsonNode("asyncInstantiation/templates__instance_template.json")); } - public void templateTopology_givenDeploy_templateTopologyIsEquivalent(JsonNode body) { + @Test + public void templateTopology_givenDeployFromEditedTemplateCypressE2E_getTemplateTopologyDataIsEquivalentToOriginalTemplate() throws IOException { + templateTopology_givenDeploy_templateTopologyIsEquivalent( + fileAsJsonNode("asyncInstantiation/templates__instance_from_template__set_without_modify.json"), + fileAsJsonNode("asyncInstantiation/templates__instance_template.json")); + } + + private JsonNode fileAsJsonNode(String fileName) throws IOException { + return objectMapper.readValue( + convertRequest(objectMapper, fileName), + JsonNode.class); + } + + public void templateTopology_givenDeploy_templateTopologyIsEquivalentToBody(JsonNode body) { + templateTopology_givenDeploy_templateTopologyIsEquivalent(body, body); + } + + public void templateTopology_givenDeploy_templateTopologyIsEquivalent(JsonNode body, JsonNode expectedTemplateTopology) { registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), RegistrationStrategy.CLEAR_THEN_SET); String uuid1 = postAsyncInstanceRequest(body); JsonNode templateTopology1 = restTemplate.getForObject(templateTopologyUri(uuid1), JsonNode.class); - assertThat(cleanupTemplate(templateTopology1), jsonEquals(cleanupTemplate(body))); + assertThat(cleanupTemplate(templateTopology1), jsonEquals(cleanupTemplate(expectedTemplateTopology))); } private JsonNode cleanupTemplate(JsonNode templateTopology) { |