Create API test that verify original template should not be changed after deploy 37/99937/2
authorAlexey Sandler <alexey.sandler@intl.att.com>
Mon, 30 Dec 2019 13:00:10 +0000 (15:00 +0200)
committerAlexey Sandler <alexey.sandler@intl.att.com>
Mon, 30 Dec 2019 14:17:48 +0000 (16:17 +0200)
Issue-ID: VID-724
Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Change-Id: I9e2b6ec52e95c4bcccef640b32118860338f3c46
Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
vid-automation/src/test/java/org/onap/vid/api/InstantiationTemplatesApiTest.java

index 3c97861..bc47ad8 100644 (file)
@@ -97,6 +97,20 @@ public class InstantiationTemplatesApiTest extends AsyncInstantiationBase {
             fileAsJsonNode("asyncInstantiation/templates__instance_template.json"));
     }
 
+    @Test
+    public void templateTopology_givenDeploy_OriginalTemplateNotChanged() throws IOException {
+        String uuidOriginTemplate = postAsyncInstanceRequest(fileAsJsonNode("asyncInstantiation/templates__instance_template.json"));
+        JsonNode originTemplateBeforeDeploy = restTemplate.getForObject(templateTopologyUri(uuidOriginTemplate), JsonNode.class);
+
+        ObjectNode changedNode = originTemplateBeforeDeploy.deepCopy();
+        changedNode.put("instanceName", "Cloned_Node_Instance_Name");
+        postAsyncInstanceRequest(changedNode);
+
+        JsonNode originTemplateAfterDeploy = restTemplate.getForObject(templateTopologyUri(uuidOriginTemplate), JsonNode.class);
+        assertThat(cleanupTemplate(originTemplateBeforeDeploy), jsonEquals(cleanupTemplate(originTemplateAfterDeploy)));
+
+    }
+
     @Test
     @FeatureTogglingTest(Features.FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE)
     public void templateTopology_givenDeploy_getServiceInfoHoldsRequestSummary() throws IOException {